I would like to have an item in my sitemap that displays the last action that was performed. This could be for instance “Turned on light kitchen (8:04pm)” or "Scene turn off the lights (11:00pm).
Is it possible to somehow get such an information displayed on a sitemap? In the logs they usually show up as “LIGHT_kitchen changed from ON to OFF” with a prepended date and time, so I thought it should be possible to get this somehow done. However, I haven’t yet managed with reasonable effort.
Anybody an idea / a hint how to get this accomplished?
Create a String Item and populate it from individual Rules. This is tedious, but you get to choose which events are of interest and what detail to include depending on event. You might for instance want to log “Motion detector activated” but not “Motion detector idle”
thank you for your reply. That was not what I was looking for, as there is several issues with it and first and foremost: doesn’t that mean a rule for every single item? Or is there something easier than
rule "Change Detect"
Item a changed or
Item b changed or
Item c changed
logInfo(“FILE”, “Item " + … + " changed”)
How can I tell, which of those items changed?
Since I realized, the more rules I have, the slower OpenHAB gets on the Raspberry Pi, I wouldn’t want tens of rules declaring each item separately. I already thought of a changedItemGroup but unfortunately groups are no solution, as an “OR” only triggers for the first member and also they don’t seem to help when having mixed items like switches, door contacts and roller shutters.
Essentially, yes. It’s the method I use (although I am not constrained by Pi performance). But go back a step and think about what you want - do you really want ‘every single Item’? Or every single change? Say you are polling a temperature sensor or suchlike, that will almost always be the last thing to have changed.
I have very few rules that just update the “log” Item though - the stuff I am interested in is usually being dealt with in some rule already - doors being opened, switches switched etc. So the line to update the log just fits into an existing rule, and I have it say something meaningful rather than just note a change.
I’m logging events of interest, not temp change from 17.1 to 17.2
This is quite a common request, a typical solution here
That does have limitations and will not work well here I think (multiple triggers).
If you really want a global last item changed, It should I think be possible to write an external script that parses out the last line of openhab.log, examines it see if it was an Item change, and returns it. I do not know how to go about that.