I have a number of binary sensors that work via mqtt with off or on states, every time I update HA or restart it my sensors are in a state of unknown due to not having published a state message and I have to set them to off using the dev tools.
Is there a simple way to have them always off on restart or has anyone got an automation that can be run to reset them all ?
If these messages are published with the retain flag set, the binary sensor will receive an instant state update after subscription and Home Assistant will display the correct state on startup. Otherwise, the initial state displayed in Home Assistant will be unknown.
the sensors pass data via rf to a tasmotised rf bridge.
on the bridge console I did the following command SensorRetain 1 but still have the same issue.
Here is an example mqtt item for a sensor, I assume as the bridge is publishing it needed the retain.