Hello. Can someone check my code? Right know, light.k_1
comes on any part of the day.
What I want to happen is to have light.k_1
to come on between 10am - 4pm. Any other time will be light.k_1
& light.k_5
.
- alias: motion kitchen lights on
trigger:
platform: state
entity_id: binary_sensor.motion_kitchen_1_occupancy
to: 'on'
action:
service: light.turn_on
data_template:
entity_id: >
{% if now().hour > 16 %}
light.k_1, light.k_5
{% elif now().hour < 10 %}
light.k_1, light.k_5
{% else %}
light.k_1
{% endif %}