Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - alias: If there is motion in bedroom, turn the lights on
- trigger:
- platform: state
- entity_id: binary_sensor.motion_sensor_158d0002006c77_peter
- from: 'off'
- to: 'on'
- condition:
- condition: time
- after: '08:30:00'
- before: '22:00:00'
- action:
- service: scene.turn_on
- data_template:
- entity_id: >
- {% if now().hour >= 8 and now().hour < 16 %}
- scene.peter_dagslys
- {% elif now().hour >= 16 and now().hour < 20 %}
- scene.peter_ettermiddagslys
- {% elif now().hour >= 20 and now().hour < 23 %}
- scene.peter_kveldslys
- {% else %}
- scene.peter_nattlyslys
- {% endif %}
- - alias: Change scene in Peters bedroom
- trigger:
- platform: time_pattern
- minutes: '/1'
- condition:
- condition: state
- entity_id: light.peter
- state: 'on'
- action:
- service: scene.turn_on
- data_template:
- entity_id: >
- {% if now().hour >= 8 and now().hour < 16 %}
- scene.peter_dagslys
- {% elif now().hour >= 16 and now().hour < 20 %}
- scene.peter_ettermiddagslys
- {% elif now().hour >= 20 and now().hour < 23 %}
- scene.peter_kveldslys
- {% else %}
- scene.peter_nattlyslys
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement