How to automate with switch events? #104
-
Probably not an issue but more a problem with understanding switch events. I have a f@h switch in my bathroom, that is not connected to a f@h actuator. In HA I want to have an automation that switches on a Shelly plug s to start warm water circulation. I just want to switch it on, regardless of where I press the button. Switching it off is done by a timer. I get the switch event in HA whenever I press top or bottom of the switch, regardless of the state. But when the state is off and I press off, nothing happens. The same is with on state and pressing on. Is there a way to just react to the event regardless of the state? Could you maybe point me in the right direction? Thanks a lot! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
A heads up, I converted this to a discussion. |
Beta Was this translation helpful? Give feedback.
-
Have you tried it without the `To``
|
Beta Was this translation helpful? Give feedback.
-
Even though the documentation says to set to or from to
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:
entity_id: switch.3rd_floor_landing_light
mode: single |
Beta Was this translation helpful? Give feedback.
-
FYI, I just noticed a theoretical issue with above solution: |
Beta Was this translation helpful? Give feedback.
Even though the documentation says to set to or from to
null
to record all events.That actually doesn't seem to work for me.
This did work for me.