mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-02-22 09:01:22 +00:00
38 lines
1.4 KiB
YAML
Executable File
38 lines
1.4 KiB
YAML
Executable File
- alias: detect_light_between 8pm and 5am
|
|
trigger:
|
|
- platform: event
|
|
event_type: state_changed
|
|
condition:
|
|
condition: and
|
|
conditions:
|
|
- condition: or
|
|
conditions:
|
|
- condition: time
|
|
after: '20:00:00'
|
|
- condition: time
|
|
before: '12:00:00'
|
|
- condition: state
|
|
entity_id: sun.sun
|
|
state: 'below_horizon'
|
|
- condition: state
|
|
entity_id: group.family
|
|
state: home
|
|
- condition: template
|
|
value_template: "{{ trigger.event.data.entity_id.split('.')[0] == 'light' }}"
|
|
- condition: template
|
|
value_template: "{{ trigger.event.data.entity_id.split('_')[0] != 'light.tv' }}"
|
|
- condition: template
|
|
value_template: "{{ trigger.event.data.entity_id.split('_')[0] != 'light.couch' }}"
|
|
- condition: template
|
|
value_template: "{{ trigger.event.data.entity_id.split('_')[0] != 'light.outdoor' }}"
|
|
- condition: template
|
|
value_template: "{{ trigger.event.data.new_state.state == 'on' }}"
|
|
- condition: template
|
|
value_template: "{{ trigger.event.data.old_state.state == 'off' }}"
|
|
# - condition: template
|
|
# value_template: "{{ trigger.event.data.new_state.attributes.brightness|default(0)|int > 20 }}"
|
|
action:
|
|
- service: light.turn_on
|
|
data_template:
|
|
entity_id: "{{ trigger.event.data.entity_id }}"
|
|
brightness: 20 |