Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. - alias: Master Bathroom Lights
  2. initial_state: 'on'
  3. trigger:
  4. - platform: state
  5. entity_id: input_boolean.bathroom_motion
  6. to: 'on'
  7. condition:
  8. condition: or
  9. conditions:
  10. - condition: template
  11. value_template: >-
  12. {%- set weekday=states('sensor.weekend') -%}
  13. {%- set time=strptime(as_timestamp(now())|timestamp_custom("%H:%M"),'%H%M') -%}
  14. {%- if time >= strptime('06:00','%H%M') and time <= strptime('06:59','%H%M') and weekday == 'false' -%} true
  15. {% else %} false
  16. {% endif %}
  17. - condition: template
  18. value_template: >-
  19. {%- set weekday=states('sensor.weekend') -%}
  20. {%- set time=strptime(as_timestamp(now())|timestamp_custom("%H:%M"),'%H%M') -%}
  21. {%- if time >= strptime('07:00','%H%M') and time <= strptime('18:59','%H%M') and weekday == 'false' -%} true
  22. {% else %} false
  23. {% endif %}
  24. - condition: template
  25. value_template: >-
  26. {%- set weekday=states('sensor.weekend') -%}
  27. {%- set time=strptime(as_timestamp(now())|timestamp_custom("%H:%M"),'%H%M') -%}
  28. {%- if time >= strptime('19:00','%H%M') and time <= strptime('22:29','%H%M') and weekday == 'false' -%} true
  29. {% else %} false
  30. {% endif %}
  31. - condition: template
  32. value_template: >-
  33. {%- set weekday=states('sensor.weekend') -%}
  34. {%- set time=strptime(as_timestamp(now())|timestamp_custom("%H:%M"),'%H%M') -%}
  35. {%- if time >= strptime('08:00','%H%M') and time <= strptime('09:59','%H%M') and weekday == 'true' -%} true
  36. {% else %} false
  37. {% endif %}
  38. - condition: template
  39. value_template: >-
  40. {%- set weekday=states('sensor.weekend') -%}
  41. {%- set time=strptime(as_timestamp(now())|timestamp_custom("%H:%M"),'%H%M') -%}
  42. {%- if time >= strptime('10:00','%H%M') and time <= strptime('18:59','%H%M') and weekday == 'true' -%} true
  43. {% else %} false
  44. {% endif %}
  45. - condition: template
  46. value_template: >-
  47. {%- set weekday=states('sensor.weekend') -%}
  48. {%- set time=strptime(as_timestamp(now())|timestamp_custom("%H:%M"),'%H%M') -%}
  49. {%- if time >= strptime('19:00','%H%M') and time <= strptime('22:29','%H%M') and weekday == 'true' -%} true
  50. {% else %} false
  51. {% endif %}
  52. action:
  53. service: light.turn_on
  54. data_template:
  55. entity_id: group.vanity_lights
  56. brightness: >-
  57. {%- set weekday=states('sensor.weekend') -%}
  58. {%- set time=strptime(as_timestamp(now())|timestamp_custom("%H:%M"),'%H%M') -%}
  59. {%- if time >= strptime('06:00','%H%M') and time <= strptime('06:59','%H%M') and weekday == 'false' -%} 38
  60. {%- elif time >= strptime('07:00','%H%M') and time <= strptime('18:59','%H%M') and weekday == 'false' -%} 127
  61. {%- elif time >= strptime('19:00','%H%M') and time <= strptime('22:29','%H%M') and weekday == 'false' -%} 38
  62. {%- elif time >= strptime('08:00','%H%M') and time <= strptime('09:59','%H%M') and weekday == 'true' -%} 38
  63. {%- elif time >= strptime('10:00','%H%M') and time <= strptime('18:59','%H%M') and weekday == 'true' -%} 127
  64. {%- elif time >= strptime('19:00','%H%M') and time <= strptime('22:29','%H%M') and weekday == 'true' -%} 38
  65. {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement