33 lines
868 B
YAML
33 lines
868 B
YAML
input_select:
|
|
pool_light_colour_select:
|
|
icon: mdi:swimming-pool
|
|
name: Pool Light Colour
|
|
initial: "Off"
|
|
options:
|
|
- "Off"
|
|
- "Dk Blue"
|
|
- "Red"
|
|
- "Green"
|
|
- "Lt Blue"
|
|
- "Disco"
|
|
- "9"
|
|
- "10"
|
|
- "11"
|
|
- "12"
|
|
- "13"
|
|
|
|
automation:
|
|
- id: set_the_pool_light_colour
|
|
alias: Set the Pool Light Colour
|
|
trigger:
|
|
entity_id: input_select.pool_light_colour_select
|
|
platform: state
|
|
action:
|
|
service: mqtt.publish
|
|
data:
|
|
topic: viewroad-commands/poolcontrols/poollightcolour
|
|
payload: '{% set mapping = { "Off":"0", "Dk Blue":"1",
|
|
"Red":"2", "Green":"3", "4":"4" ,"Lt Blue":"5", "6":"6", "7":"7", "Disco":"8", "9":"9", "10":"10", "11":"11", "12":"12", "13":"13" } %} {% set dta = trigger.to_state.state %}
|
|
{{ mapping[dta] }}
|
|
'
|