96 lines
2.9 KiB
YAML
96 lines
2.9 KiB
YAML
# packages/pool_light_boost_switch.yaml
|
|
|
|
homeassistant:
|
|
customize:
|
|
input_boolean.poollights_mode_switch:
|
|
icon: mdi:light-flood-up
|
|
|
|
input_boolean:
|
|
poollights_mode_switch:
|
|
name: "Pool Light Operation"
|
|
initial: false
|
|
|
|
timer_light_midnight_pending:
|
|
name: "Send TIMER at Midnight"
|
|
initial: false
|
|
|
|
automation:
|
|
- alias: "Pool Lights → send BOOST when user turns UI switch ON"
|
|
trigger:
|
|
platform: state
|
|
entity_id: input_boolean.poollights_mode_switch
|
|
to: "on"
|
|
condition:
|
|
condition: state
|
|
entity_id: switch.esp_poollightspower_power_output
|
|
state: "off"
|
|
action:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "viewroad-commands/poollights-timer/operation"
|
|
payload: "BOOST"
|
|
|
|
- alias: "Pool Lights → send OFF & schedule TIMER when user turns UI switch OFF"
|
|
trigger:
|
|
platform: state
|
|
entity_id: input_boolean.poollights_mode_switch
|
|
to: "off"
|
|
condition:
|
|
condition: state
|
|
entity_id: switch.esp_poollightspower_power_output
|
|
state: "on"
|
|
action:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "viewroad-commands/poollights-timer/operation"
|
|
payload: "OFF"
|
|
- service: input_boolean.turn_on
|
|
data:
|
|
entity_id: input_boolean.timer_light_midnight_pending
|
|
|
|
- alias: "Pool Lights → send TIMER at midnight"
|
|
trigger:
|
|
platform: time
|
|
at: "00:00:00"
|
|
condition:
|
|
condition: state
|
|
entity_id: input_boolean.timer_light_midnight_pending
|
|
state: "on"
|
|
action:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "viewroad-commands/poollights-timer/operation"
|
|
payload: "TIMER"
|
|
- service: input_boolean.turn_off
|
|
data:
|
|
entity_id: input_boolean.timer_light_midnight_pending
|
|
|
|
- alias: "Pool Lights → sync UI switch with real output (no MQTT)"
|
|
trigger:
|
|
platform: state
|
|
entity_id: switch.esp_poollightspower_power_output
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: switch.esp_poollightspower_power_output
|
|
state: "on"
|
|
sequence:
|
|
- service: input_boolean.turn_on
|
|
data:
|
|
entity_id: input_boolean.poollights_mode_switch
|
|
- service: input_boolean.turn_off
|
|
data:
|
|
entity_id: input_boolean.timer_light_midnight_pending
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: switch.esp_poollightspower_power_output
|
|
state: "off"
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
data:
|
|
entity_id: input_boolean.poollights_mode_switch
|
|
- service: input_boolean.turn_on
|
|
data:
|
|
entity_id: input_boolean.timer_light_midnight_pending
|