I would like to trigger an automation when a Zooz smart dimmer (ZEN77) is turned on manually at the physical switch. Is there any way to accomplish this?
Thanks in advance.
I would like to trigger an automation when a Zooz smart dimmer (ZEN77) is turned on manually at the physical switch. Is there any way to accomplish this?
Thanks in advance.
Here’s how I do it:
alias: Turn on Sink Light with Kitchen Light
description: ""
mode: single
triggers:
- entity_id:
- switch.kitchen
to: "on"
trigger: state
conditions: []
actions:
- target:
entity_id: switch.sink_light_switch
data: {}
action: switch.turn_on
You can look for the Zooz switch entity in Developer Tools → states.
Thanks for the input, but will that not trigger any time switch.kitchen is turned on (whether by automation or manually pressing the switch?
My actual use case is as follows. A motion detector normally triggers the light to come on when motion is detected via an automation. If the fan is turned off (I said on in the original post, my fault) manually at the physical switch, I want to run another automation. If the switch is not tuned off manually, a timer will turn off the switch when it expires.
I currently have the on with motion and off with timer working correctly. My better half would like a different action if she tuns off the light manually.
So for that the trigger is the fan turning off before the timer has expired?
You are correct. I haven’t needed that function, but I may try it.
automation:
- alias: "Light On with Physical Switch"
trigger:
platform: state
entity_id: switch.kitchen
to: "on"
condition:
condition: template
value_template: >
{{ trigger.from_state.attributes.source == "user" }}
actions:
- target:
entity_id: switch.sink_light_switch
data: {}
action: switch.turn_on
Yes, but only if done physically at thr switch.
Yes, there is. Enable Scene control on the dimmer. Tapping the on or off from the dimmer itself will always be interpreted as the first scene (as opposed to a status change due to a command from the Z-wave hub) and can be used to trigger the automations you want.
The example from tom_I is the correct answr here. As an example of a slightly different way of using it than Tom’s example, I also offer one here:
I have a situation that I only want to know when a light is turned OFF how it was turned off - if it was done by a dashboard, automation or physically. If it is on, I change the value to N/A for my purposes - but this code could be used in the opposite fashion as well:
#
# Bathroom Lights (for accessing these and with the last_changed value):
# {{ states('sensor.bathroom_lights_off_context') }}
# {{ states.sensor['bathroom_lights_off_context'].last_changed }}
#
# 1. Track the 'off' context changing (has to be triggered even if turning on,
# so any change at all will cause logic to be triggered if subsequent objects
# already set as "physical" will still be updated)
#
template:
- trigger:
- platform: state
entity_id: light.bathroom_shelly_1_relay
sensor:
- name: "Bathroom Lights Off Context"
state: >
{% set c_id = trigger.to_state.context.id %}
{% set c_parent = trigger.to_state.context.parent_id %}
{% set c_user = trigger.to_state.context.user_id %}
{% if states('light.bathroom_shelly_1_relay') == 'on' %}
n/a
{% elif c_id != none and c_parent == none and c_user == none %}
physical
{% elif c_id != none and c_parent == none and c_user != none %}
dashboard_ui
{% elif c_id != none and c_parent != none and c_user == none %}
automation
{% else %}
unknown
{% endif %}
unique_id: bathroom_lights_off_context
Thanks, everyone. I have a few circumstances that have popped up that I need to take care of before I get to this, but I am sure I can get it now.