I’m using an MQTT JSON Light with a state and a set topic. The MQTT broker is mosquitto. The retain flag is set to true.
This is my configuration:
light regal:
- platform: mqtt_json
name: "Regal"
command_topic: "regal/set"
state_topic: "regal/state"
rgb: true
retain: true
All is working well but I am encountering a problem when doing the following steps in the HA gui:
- Switch light on
- Set light to a color
- Switch light off
- Switch light on
After these steps the retained message in the topic “regal/set” is
{"state": "ON"}
Due to this, when I restart my light it is switched on, but to white and not the previously set color as I want it to.
Is there a way to always send the color when toggling the state?