My guess is you have retain: true
specified for your MQTT Lights in configuration.yaml
. Ensure it is set to retain: false
(which happens to be the default).
Ideally, you only want state topics to be retained, not command topics. Generally speaking, that means your MQTT lights in Home Assistant ought to be configured retain: false
and the physical lights (using Tasmota, ESPurna, ESPEasy, etc) configured retain: true
.
Why? Because if a command topic is retained, you’re telling the MQTT broker to supply the topic’s message to every subscriber upon connection. That’s rarely desirable.
For example, let’s say home/garage_door_opener/command
is retained.
- You command the door to open (command topic’s message is
on
). - Then someone closes the door manually (command topic’s message is still
on
). - The MQTT broker reboots and informs its subscribers of all its retained topics.
- The garage door opener receives the command
on
. - Uh-oh, probably not the behavior you want!
Basically, all you retain are state topics. After the broker reboots (or a subscriber like Home Assistant reconnects) it reports to subscribers what’s currently on/off, opened/closed, etc (state topic) as opposed to instructing subscribers to turn on/off, open/close, etc (command topic).