The issue I am trying to solve is that i want to be able to display a number of state changes of a particurlar item, say I have a door contact sensor and the information about the status change is stored in mysql.
So I can get the current and n-1 value and update time using
But is there a way to extract, for example, the last 10 records from mysql peristence?
I have come across the same question being raised back in 2017 here
That suggested using the extra variables for keeping the changed state of an item, but it seems like a rather useful option to have, so maybe it i already implemented and I am simply mising something obvious here.
thanks, I have the visual representation via Grafana and Discrete pluging already configured.
But for some of the windows/doors that are not opened so frequently, I find it rather inconvinient trying to find the interval during which it was last opened. The table structure showing the last no.of state change would work nicely here.
There is another possibility of using Grafana and the Table plugin and insert it via webview, but I was hoping that an inbuilt mechanism would exists allowing access to historical data.
I was playing this morning with a rule updating a set of variables, but for every item i want to keep track of, I need 20 extra variables (state+timeofupdate) if i want to keep track of last 10 statechanges. Thus it become pretty unmanageable for a large number of sensors
So done all those sensors statuses in grafana table and thats how it looks.
Then each individual table can be inserted into the OH via Webview where needed.