Posted by
ads' corner
on
Thursday, 2021-01-28 Posted in [Openhab]
If openHAB has a Persistence service configured, the time of the last Item update (and a couple other times) is available in Rules. This makes it quite handy to check if a certain item hasn’t been updated in a long time. As example I have the Tankerkoenig Binding installed, and this data is persisted in InfluxDB. This way I can see historic gas prices in Grafana.
When the Telegram Bot answers the /tanken question, it appends the timestamp of the last gas prices update.
In this case I might have different update timestamps from different stations, because the result returns the top N prices. I just pick the last price here.
This defines a DateTime variable. While looping through the results, the lastUpdate timestamp from the influxdb persistance service is stored. And later when the result string is created, the formatted timestamp is appened.
Keep in mind that openHAB can have multiple Persistance services configured. The one you want to use (influxdb) is specified here.