I have an input selector that changes the color of my pool light via MQTT message to my Raspberry Pi Pool Controller. Because the controller can also get inputs from other sources (Alexa), I set the default value via a MQTT status message.
Everything works great if I use HA, but when I use Alexa, the status message that resets the dropdown to a new value, triggers a new command, so the turn is called twice.
Is there a way to change my code so the status change of the selected value doesn’t trigger a new command?
Sorry about the formatting. Is there a way to enter code?
configuration.yaml:
input_select:
pool_light_color:
name: Pool Light Color
options:
- off
- cycle
- party
- romance
- caribbean
- american
- sunset
- royal
- blue
- green
- red
- white
- magenta
- hold
- recall
initial: off
icon: mdi:pool
automations.yaml:
-
alias: ‘Set Pool Light Color’
trigger:
platform: state
entity_id: input_select.pool_light_color
action:
service: mqtt.publish
data:
topic: “pool/pool_light”
payload_template: “{{ states(‘input_select.pool_light_color’) }}” -
alias: ‘Get Pool Light Color’
trigger:
platform: mqtt
topic: “pool/pool_light/status”
#payload: “Color”
action:
service: input_select.select_option
data_template:
entity_id: input_select.pool_light_color
option: “{{ trigger.payload }}”