Hi everyone, I’m newbie.
I want to setup my Hallway light automatic turn on on the time from 19:00 (7 PM) to 6:00 (Nextday) if switch turn off and Motion sensor active (I use S-onoff Motion sensor connect w hass through Zigbee2mttq).
I can’t find from time to time in Automation UI.
Please help me
You just need to add a time condition toi this: Motion activated lights automation
So:
trigger:
- platform: state
entity_id: binary_sensor.your_motion_sensor_here # change this
to: 'on'
- platform: state
entity_id: binary_sensor.your_motion_sensor_here # change this
to: 'off'
for:
minutes: 2 # adjust as necessary
condition:
condition: time
after: "19:00:00"
before: "06:00:00"
action:
- service: "light.turn_{{ trigger.to_state.state }}"
target:
entity_id: light.your_light_here # change this
mode: single
https://www.home-assistant.io/docs/scripts/conditions/#time-condition
Time condition windows can span across the midnight threshold if both
after
andbefore
keys are used.
1 Like