Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - alias: Master Bathroom Lights
- initial_state: 'on'
- trigger:
- - platform: state
- entity_id: input_boolean.bathroom_motion
- to: 'on'
- condition:
- condition: or
- conditions:
- - condition: template
- value_template: >-
- {%- set weekday=states('sensor.weekend') -%}
- {%- set time=strptime(as_timestamp(now())|timestamp_custom("%H:%M"),'%H%M') -%}
- {%- if time >= strptime('06:00','%H%M') and time <= strptime('06:59','%H%M') and weekday == 'false' -%} true
- {% else %} false
- {% endif %}
- - condition: template
- value_template: >-
- {%- set weekday=states('sensor.weekend') -%}
- {%- set time=strptime(as_timestamp(now())|timestamp_custom("%H:%M"),'%H%M') -%}
- {%- if time >= strptime('07:00','%H%M') and time <= strptime('18:59','%H%M') and weekday == 'false' -%} true
- {% else %} false
- {% endif %}
- - condition: template
- value_template: >-
- {%- set weekday=states('sensor.weekend') -%}
- {%- set time=strptime(as_timestamp(now())|timestamp_custom("%H:%M"),'%H%M') -%}
- {%- if time >= strptime('19:00','%H%M') and time <= strptime('22:29','%H%M') and weekday == 'false' -%} true
- {% else %} false
- {% endif %}
- - condition: template
- value_template: >-
- {%- set weekday=states('sensor.weekend') -%}
- {%- set time=strptime(as_timestamp(now())|timestamp_custom("%H:%M"),'%H%M') -%}
- {%- if time >= strptime('08:00','%H%M') and time <= strptime('09:59','%H%M') and weekday == 'true' -%} true
- {% else %} false
- {% endif %}
- - condition: template
- value_template: >-
- {%- set weekday=states('sensor.weekend') -%}
- {%- set time=strptime(as_timestamp(now())|timestamp_custom("%H:%M"),'%H%M') -%}
- {%- if time >= strptime('10:00','%H%M') and time <= strptime('18:59','%H%M') and weekday == 'true' -%} true
- {% else %} false
- {% endif %}
- - condition: template
- value_template: >-
- {%- set weekday=states('sensor.weekend') -%}
- {%- set time=strptime(as_timestamp(now())|timestamp_custom("%H:%M"),'%H%M') -%}
- {%- if time >= strptime('19:00','%H%M') and time <= strptime('22:29','%H%M') and weekday == 'true' -%} true
- {% else %} false
- {% endif %}
- action:
- service: light.turn_on
- data_template:
- entity_id: group.vanity_lights
- brightness: >-
- {%- set weekday=states('sensor.weekend') -%}
- {%- set time=strptime(as_timestamp(now())|timestamp_custom("%H:%M"),'%H%M') -%}
- {%- if time >= strptime('06:00','%H%M') and time <= strptime('06:59','%H%M') and weekday == 'false' -%} 38
- {%- elif time >= strptime('07:00','%H%M') and time <= strptime('18:59','%H%M') and weekday == 'false' -%} 127
- {%- elif time >= strptime('19:00','%H%M') and time <= strptime('22:29','%H%M') and weekday == 'false' -%} 38
- {%- elif time >= strptime('08:00','%H%M') and time <= strptime('09:59','%H%M') and weekday == 'true' -%} 38
- {%- elif time >= strptime('10:00','%H%M') and time <= strptime('18:59','%H%M') and weekday == 'true' -%} 127
- {%- elif time >= strptime('19:00','%H%M') and time <= strptime('22:29','%H%M') and weekday == 'true' -%} 38
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement