mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-02-21 16:44:46 +00:00
Look at the time and adjust the brightness of the lights when turning on.
This commit is contained in:
parent
b90ad0e42c
commit
38cd217210
33
automation/time_5am_8am.yaml
Executable file
33
automation/time_5am_8am.yaml
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
- alias: detect_light_between 5am and 8am
|
||||||
|
trigger:
|
||||||
|
- platform: event
|
||||||
|
event_type: state_changed
|
||||||
|
condition:
|
||||||
|
- condition: state
|
||||||
|
entity_id: group.family
|
||||||
|
state: home
|
||||||
|
- condition: time
|
||||||
|
after: '05:00:00'
|
||||||
|
- condition: time
|
||||||
|
before: '7:59:00'
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data is not none }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.entity_id is not none }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.entity_id.split('.')[0] == 'light' }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.new_state is not none }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.new_state.state is not none }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.new_state.state == 'on' }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.new_state.attributes is not none }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.new_state.attributes.brightness|default(0)|int > 50 }}"
|
||||||
|
action:
|
||||||
|
- service: light.turn_on
|
||||||
|
data_template:
|
||||||
|
entity_id: "{{ trigger.event.data.entity_id }}"
|
||||||
|
brightness: 50
|
33
automation/time_8am_8pm.yaml
Executable file
33
automation/time_8am_8pm.yaml
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
- alias: detect_light_between 8am and 12pm
|
||||||
|
trigger:
|
||||||
|
- platform: event
|
||||||
|
event_type: state_changed
|
||||||
|
condition:
|
||||||
|
- condition: state
|
||||||
|
entity_id: group.family
|
||||||
|
state: home
|
||||||
|
- condition: time
|
||||||
|
after: '08:00:00'
|
||||||
|
- condition: time
|
||||||
|
before: '20:00:00'
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data is not none }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.entity_id is not none }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.entity_id.split('.')[0] == 'light' }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.new_state is not none }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.new_state.state is not none }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.new_state.state == 'on' }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.new_state.attributes is not none }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.new_state.attributes.brightness|default(0)|int > 254 }}"
|
||||||
|
action:
|
||||||
|
- service: light.turn_on
|
||||||
|
data_template:
|
||||||
|
entity_id: "{{ trigger.event.data.entity_id }}"
|
||||||
|
brightness: 255
|
37
automation/time_8pm_5am.yaml
Executable file
37
automation/time_8pm_5am.yaml
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
- 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: group.family
|
||||||
|
state: home
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data is not none }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.entity_id is not none }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.entity_id.split('.')[0] == 'light' }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.new_state is not none }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.new_state.state is not none }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.new_state.state == 'on' }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.new_state.attributes is not none }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ trigger.event.data.new_state.attributes.brightness|default(0)|int > 254 }}"
|
||||||
|
action:
|
||||||
|
- service: light.turn_on
|
||||||
|
data_template:
|
||||||
|
entity_id: "{{ trigger.event.data.entity_id }}"
|
||||||
|
brightness: 255
|
Loading…
x
Reference in New Issue
Block a user