38 lines
969 B
YAML
38 lines
969 B
YAML
---
|
|
- alias: '[Bathroom Master] Lights Auto On'
|
|
initial_state: 'true'
|
|
trigger:
|
|
platform: state
|
|
entity_id:
|
|
- binary_sensor.presence_03_presence
|
|
from: 'off'
|
|
to: 'on'
|
|
action:
|
|
- service: light.turn_on
|
|
data_template:
|
|
entity_id: light.bathroom_master_wall_01
|
|
brightness_pct: >
|
|
{% set hour = now().hour | int %}
|
|
{%- if hour >= 8 and hour < 19 -%}
|
|
100.0
|
|
{%- elif hour >= 19 and hour < 23 -%}
|
|
75.0
|
|
{%- elif hour >= 6 and hour < 8 -%}
|
|
50.0
|
|
{%- elif ( hour >= 23 and hour < 24 ) and ( hour >= 0 and hour < 6 ) -%}
|
|
15.0
|
|
{%- endif -%}
|
|
|
|
- alias: '[Bathroom Master] Lights Auto Off'
|
|
initial_state: 'true'
|
|
trigger:
|
|
platform: state
|
|
entity_id:
|
|
- binary_sensor.presence_03_presence
|
|
from: 'on'
|
|
to: 'off'
|
|
action:
|
|
- service: light.turn_off
|
|
entity_id:
|
|
- light.bathroom_master_wall_01
|