MQTT 2.5 Binding Strange Behavior: Item goes ON then immediately to UNDEF

Please check the github issue. I have already agreed not to push UNDEF. I still don’t think it’s wrong, but openHAB does this already anyway. A state channel can never have “no state” and the framework initializes with the UNDEF state. And it does so way earlier than the binding could do so, and therefore the restoreOnStartup hack works.

Only mqtt channels bound to retained topics, where the topic value is removed (set to an empty string) will be set to UNDEF.

If we want to follow the mqtt idea to the end, as argued by Rich, all channels bound to non retained topics would not return any value if the framework asks for the state.

Cheers, David

Out of curiosity, does that mean that if we subscribe to a retained topic but the broker does not (yet) have available info, a linked Item gets an UNDEF update? Or is that a nonsense idea, as the broker does not know that a topic is retained unless it does have old data?

No, not going to argue about that :crazy_face: just point out for future reference, the integrated broker (rebooting at the same time) has optional persistence.

Only messages are retained. Retained is not a property of the topics themselves. There would have to be a retained message there in the first place. This scenario could never apply because if there is not yet a message there is nothing there to indicate retained.