SHARE
TWEET

lys

a guest May 25th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - alias: If there is motion in bedroom, turn the lights on
  2.   trigger:
  3.     platform: state
  4.     entity_id: binary_sensor.motion_sensor_158d0002006c77_peter
  5.     from: 'off'
  6.     to: 'on'
  7.   condition:
  8.     condition: time
  9.     after: '08:30:00'
  10.     before: '22:00:00'
  11.   action:
  12.     service: scene.turn_on
  13.     data_template:
  14.       entity_id: >
  15.        {% if now().hour >= 8 and now().hour < 16 %}
  16.         scene.peter_dagslys
  17.         {% elif now().hour >= 16 and now().hour < 20 %}
  18.         scene.peter_ettermiddagslys
  19.         {% elif now().hour >= 20 and now().hour < 23 %}
  20.         scene.peter_kveldslys
  21.         {% else %}
  22.         scene.peter_nattlyslys
  23.         {% endif %}
  24.  
  25. - alias: Change scene in Peters bedroom
  26.   trigger:
  27.     platform: time_pattern
  28.     minutes: '/1'
  29.   condition:
  30.     condition: state
  31.     entity_id: light.peter
  32.     state: 'on'
  33.   action:
  34.     service: scene.turn_on
  35.     data_template:
  36.       entity_id: >
  37.        {% if now().hour >= 8 and now().hour < 16 %}
  38.         scene.peter_dagslys
  39.         {% elif now().hour >= 16 and now().hour < 20 %}
  40.         scene.peter_ettermiddagslys
  41.         {% elif now().hour >= 20 and now().hour < 23 %}
  42.         scene.peter_kveldslys
  43.         {% else %}
  44.         scene.peter_nattlyslys
  45.         {% endif %}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top