I do have persisted ON/OFF state on Item am working with.
How can I work with time of the value?
I’m using influx, date/time is there indeed, when I draw a graph Time is there so I guess OH knows about it .
Can I use that time to display it on UI somehow? or calculate duration etc.?
is it something like
as I said, I’m persisting ON/OFF state and I would like to count ON period during the day.
I probably can use a dummy item, but as this already have all needed informations I’m curious how to use them properly.
I probably don’t understand correctly… since Chart is able to draw exact point at exact time with data which is being persisted I thought that this can be extracted to a textual information as well.
basically, OH knows 1(on) from 8ish to 10ish then 0 (off) etc.
if OH knows that, I should able to access this information from something, am I?
Sure. Query every minute, one at a time, using historicState method. This will return the state at that historic moment.
If the last previous state recorded before that moment was ON, historicState will return ON because it hadn’t changed since, even if that was hours before.
If you are literally counting changes, it’s probably easier to implement that in a rule.
If you are integrating i.e. looking to find out ON-time compared to OFF-time, you could store on/off as 0 and 1 and run an average query.