Skip to content

How to automate with switch events? #104

Answered by kingsleyadam
nrenner73 asked this question in Q&A
Discussion options

You must be logged in to vote

Even though the documentation says to set to or from to null to record all events.

To trigger on all state changes, but not on changed attributes, set at least one of from, to, not_from, or not_to to null.

That actually doesn't seem to work for me.

This did work for me.

alias: Rocker Pressed On
description: Do something when the rocker is pressed on.
triggers:
  - trigger: event
    event_type: state_changed
    event_data:
      entity_id: event.office_rocker_switch_event_ch0000
conditions: []
actions:
  - condition: template
    value_template: "{{ trigger.event.data.new_state.attributes.event_type == \"on\" }}"
  - action: switch.turn_on
    metadata: {}
    data: {}
    target:
      

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@nrenner73
Comment options

Answer selected by nrenner73
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #102 on November 18, 2024 11:21.