Hello Community,
yesterday I build my first of some NODEMCU SensorNodes, connected it to mosquitto and was enjoyed be looking at the values it send every minutes - works as designed.
I added an MQTT-Binding for the values, it looks good at all, but the values went back to “undefinded” after some seconds.
After some search I found, that keep-alive parameter and set ip to 300 seconds - seems to work, until I changed something on the Item file.
Isn’t there no way to keep MQTTvalues valid for some time?
Hi @Dennis_Wunsch,
The behavior you see is normal. It has nothing to do with the mqtt binding itself. When changing the items file all items go to default state e.g. uninitialised as openhab reloads.
I use the mqtt binding myself and never experienced that data became invalid after some time.
Br Marc
The MQTT item binding posts updates to items with in bindings for state, but the binding is not responsible for keeping those states in place on those items. The states can later change if (1) you restart the openHAB server, (2) you change your item file(s), or some code posts an update. Possible code that could post an update are (3) the MQTT item binding itself, in case something publishes to the MQTT topic the item is listening to, (4) another binding that is bound to the same item, (5) rules, or (6) possibly the REST API.
(1) can be changed by using persistence. (2) can be changed by your no longer needing to edit your items file(s). (3) can be changed by suppressing the source of further MQTT publish messages. (4) and (5) can be changed by correcting your items file(s) and rules, and (6) can be fixed by correcting the external system that is using the REST API.