I send with my esp8266’s and the MQTT protocol every x seconds temperature data’s and display the values to my sitemaps. It works
Now I would like to change my program flow and send with openhab2 and the MQTT protocol every x seconds (inclusive a timeout verification) a request to each esp8266’s to send data’s and not sending data’s automatically. In addition, I would like add on my sitemap for example a text item that show the status of each esp8266 (connected / not connected) and the timestamp of the last successfully data transmission. So, I know that each esp8266’s in the network work.
@Felix_Raetz:
Thank you for your quick and detailed answer.
I will look at it in peace and try to understand. And than I will try to realize it with your help.
Note that the example given is for the obsolete version 1 of MQTT binding. The principle is fine.
Note also that polling for data, instead of waiting for unsolicited reports, naturally doubles your network traffic.
The expire binding is purpose made to detect a failure to update an Item within a time window. This can be used for polled or autonomous data, if you know the expected maximum time between updates.
@rossko57:
Thank you for your input and your helpfulness.
So you would not do an ESP8266 data query but only read out the received data?
How would you check the status (connected / not connected) of the ESP8266 and display the value on the sitemap?
I have seen that the expire binding is “only” available for V1.
Someone have an example of the new mqtt binding or can me explain the syntax?
I’ m a beginner and so I have difficult to anderstand it with this and this. And in me book of openhab2 I found nothing to this topic.
Where can I find more infos to this topic?
It’s entirely up to you. What is the objective here - to detect a failed remote sensor?
So long as you know how often to expect unsolicited messages, you can detect a missing one. If you prefer, you can poll for a message and detect a failure to respond. Neither method has any particular advantage for this purpose.
The expire binding is a version 1 binding, and openHAB version 2 supports running legacy v1.x bindings quite happily. There is currently no v2 substitute because the v1.x version works fine.
There is an alternative rules-based solution for a similar function if you must avoid 1.x bindings.
There are docs … this part explains the principles and setting up for your broker, then follow the link for the Things & Channels.