Initial State of items is undefined, is there a way?

Hi there,

when I start up my OH the knx.items and MQTT Items (TASMOTA) are in undefined state.
Is there a way to fetch the states from KNX and MQTT initially?

As long as they are not persistet, or if they don´t get persisted I don´t see the state. After I triggered something (e.g TASMOTA) the state is there.

Thanks and greetings,

Julian

I can’t speak to KNX. Often sending a REFRESH command to an Item will cause the binding to go out and get the current state of the device, assuming that that is supported by the technology. I can’t say if KNX supports that or not. I suspect not since most bindings that support querying a device for its current state will do so as part of starting up the binding in the first place.

For MQTT, there are two cases. If the message is not sent to the broker with the retained flag set, if openHAB was not connected when that message was sent, it will never get that message. If the retained flag was set, then openHAB will receive that message as soon as it connects. There is no such thing as “go fetch the current state” for MQTT.

The retained flag is set by the publisher of the message. You’d have to configure that on Tasmota.

Since KLX likely doesn’t support querying the device and MQTT definitely does not support this, your choices are to either deal with your Items being NULL until something happens to tell OH what it’s state is, or use persistence with restoreOnStartup.