mirror of
https://github.com/CeeWeasel/fresh-home.git
synced 2026-08-09 18:40:14 -04:00
69 lines
2.1 KiB
YAML
69 lines
2.1 KiB
YAML
script:
|
|
light_cycle:
|
|
sequence:
|
|
- service: homeassistant.turn_on
|
|
entity_id: light.front_room_hue
|
|
data_template:
|
|
brightness: 250
|
|
color_name: >
|
|
{% set colors = ['red', 'yellow' , 'blue', 'green' , 'purple'] %}
|
|
{{ colors|random }}
|
|
transition: 1
|
|
# Wait until the loop_lights script has finished running
|
|
- delay: '00:00:02'
|
|
- wait_template: "{{ is_state('script.loop_lights', 'off') }}"
|
|
- service: script.loop_lights
|
|
|
|
loop_lights:
|
|
sequence:
|
|
- delay: '00:00:02'
|
|
# Wait until the light_cycle script has finished running
|
|
- wait_template: "{{ is_state('script.light_cycle', 'off') }}"
|
|
- service: script.light_cycle
|
|
|
|
automation:
|
|
- alias: Light Cycle Start
|
|
id: automation_light_cycle_start
|
|
trigger:
|
|
- platform: state
|
|
entity_id: input_boolean.front_room_light_cycle
|
|
to: 'on'
|
|
action:
|
|
- service: input_text.set_value
|
|
# Again, note the use of 'data_template:' rather than the normal 'data:' if you weren't using an input variable.
|
|
data_template:
|
|
entity_id: input_text.front_room_mode
|
|
value: "{{ states('input_select.front_room_mode') }}"
|
|
|
|
- service: input_select.select_option
|
|
data:
|
|
entity_id: input_select.front_room_mode
|
|
option: 'Off'
|
|
- service: script.light_cycle
|
|
|
|
- alias: Light Cycle Stop
|
|
id: automation_light_cycle_stop
|
|
trigger:
|
|
- platform: state
|
|
entity_id: input_boolean.front_room_light_cycle
|
|
to: 'off'
|
|
action:
|
|
- service: homeassistant.turn_off
|
|
entity_id:
|
|
- script.light_cycle
|
|
- script.loop_lights
|
|
|
|
- service: input_select.select_option
|
|
data_template:
|
|
entity_id: input_select.front_room_mode
|
|
option: "{{ states('input_text.front_room_mode') }}"
|
|
|
|
- service: input_boolean.toggle
|
|
data:
|
|
entity_id: input_boolean.front_room_occupied
|
|
|
|
- delay: '00:00:01'
|
|
|
|
- service: input_boolean.toggle
|
|
data:
|
|
entity_id: input_boolean.front_room_occupied |