You mean, you want to know when one of a Group of Items last updated?
No, I didn’t need it as an Openhab Group.
I have things with multiple items / channels and would like a last update at the thing level.
Wildcard would be a second option, based on the example above:
It’s not about needing it, it’s about using it as a tool to achieve what you wanted, in a scalable and easily managed way
You can also choose if you want to record changes or updates.
Group mySensors // group for timestamp function
DateTime lastSensorUpdate "Update of any sensor"
Switch someSensor "blah" (mySensors) {channel="xx:yy:zz"}
Switch otherSensor "bleh" (mySensors) {channel="aa:bb:cc"}
rule "timestamping"
when
Member of mySensors received update
// Member of mySensors changed - alternative
then
lastSensorUpdate.postUpdate(new DateTimeType()) // defaults to now
end
The sensor only reports every 15-x minutes … Nevertheless, I have hundreds of log entries for some channels per second. No matter whether update or change.
I have the following problems - tested with avmfritz and the mihome binding:
The connected sensors / actuators only connect when necessary or less frequently if no data is changed.
2020-07-01 13:21:56.275 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from NULL to 2020-07-01T12:59:27.605+0000
2020-07-01 13:21:56.280 [.ItemChannelLinkAddedEvent] - Link 'Sensor_LastUpdate-a:b:c:d:temperature' has been added.
2020-07-01 13:23:05.511 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T12:59:27.605+0000 to 2020-07-01T13:23:05.507+0000
2020-07-01 13:23:05.511 [vent.ItemStateChangedEvent] - Sensor_Temperature changed from 25.47 to 25.5
2020-07-01 13:23:05.523 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:23:05.507+0000 to 2020-07-01T13:23:05.519+0000
Now I try to use more than one trigger for the LastUpdate:
Mihome Binding: With the first update, my log is bombarded with thousands of entries …
2020-07-01 13:30:55.015 [.ItemChannelLinkAddedEvent] - Link 'Sensor_LastUpdate-a:b:c:d:temperature' has been added.
2020-07-01 13:30:55.016 [.ItemChannelLinkAddedEvent] - Link 'Sensor_LastUpdate-a:b:c:d:humidity' has been added.
2020-07-01 13:30:55.018 [.ItemChannelLinkAddedEvent] - Link 'Sensor_LastUpdate-a:b:c:d:batteryLevel' has been added.
2020-07-01 13:31:00.528 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:29:02.969+0000 to 2020-07-01T13:31:00.506+0000
2020-07-01 13:31:00.572 [vent.ItemStateChangedEvent] - Sensor_Temperature changed from 25.5 to 25.48
2020-07-01 13:31:00.582 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.506+0000 to 2020-07-01T13:31:00.520+0000
2020-07-01 13:31:00.603 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.520+0000 to 2020-07-01T13:31:00.521+0000
2020-07-01 13:31:00.623 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.521+0000 to 2020-07-01T13:31:00.522+0000
2020-07-01 13:31:00.642 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.522+0000 to 2020-07-01T13:31:00.528+0000
2020-07-01 13:31:00.645 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.528+0000 to 2020-07-01T13:31:00.540+0000
2020-07-01 13:31:00.666 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.540+0000 to 2020-07-01T13:31:00.547+0000
2020-07-01 13:31:00.683 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.547+0000 to 2020-07-01T13:31:00.553+0000
2020-07-01 13:31:00.702 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.553+0000 to 2020-07-01T13:31:00.562+0000
2020-07-01 13:31:00.705 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.562+0000 to 2020-07-01T13:31:00.571+0000
2020-07-01 13:31:00.731 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.571+0000 to 2020-07-01T13:31:00.596+0000
2020-07-01 13:31:00.733 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.596+0000 to 2020-07-01T13:31:00.603+0000
2020-07-01 13:31:00.758 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.603+0000 to 2020-07-01T13:31:00.617+0000
2020-07-01 13:31:00.774 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.617+0000 to 2020-07-01T13:31:00.623+0000
2020-07-01 13:31:00.787 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.623+0000 to 2020-07-01T13:31:00.636+0000
2020-07-01 13:31:00.800 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.636+0000 to 2020-07-01T13:31:00.642+0000
2020-07-01 13:31:00.813 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.642+0000 to 2020-07-01T13:31:00.660+0000
2020-07-01 13:31:00.815 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.660+0000 to 2020-07-01T13:31:00.666+0000
2020-07-01 13:31:00.837 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.666+0000 to 2020-07-01T13:31:00.683+0000
2020-07-01 13:31:00.857 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.683+0000 to 2020-07-01T13:31:00.703+0000
2020-07-01 13:31:00.875 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.703+0000 to 2020-07-01T13:31:00.723+0000
2020-07-01 13:31:00.911 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.723+0000 to 2020-07-01T13:31:00.731+0000
2020-07-01 13:31:00.928 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.731+0000 to 2020-07-01T13:31:00.751+0000
2020-07-01 13:31:00.929 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.751+0000 to 2020-07-01T13:31:00.758+0000
2020-07-01 13:31:00.958 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.758+0000 to 2020-07-01T13:31:00.774+0000
2020-07-01 13:31:00.966 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.774+0000 to 2020-07-01T13:31:00.786+0000
2020-07-01 13:31:00.973 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.786+0000 to 2020-07-01T13:31:00.800+0000
2020-07-01 13:31:00.981 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.800+0000 to 2020-07-01T13:31:00.813+0000
2020-07-01 13:31:00.989 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.813+0000 to 2020-07-01T13:31:00.830+0000
2020-07-01 13:31:00.996 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.830+0000 to 2020-07-01T13:31:00.837+0000
2020-07-01 13:31:01.003 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.837+0000 to 2020-07-01T13:31:00.856+0000
2020-07-01 13:31:01.010 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:31:00.856+0000 to 2020-07-01T13:31:00.875+0000
AVMFritz! Binding: Here the flooding of the log file starts directly with the saving of the item configuration.
2020-07-01 13:51:08.166 [.ItemChannelLinkAddedEvent] - Link 'Sensor_LastUpdate-a:b:c:d:temperature' has been added.
2020-07-01 13:51:08.167 [.ItemChannelLinkAddedEvent] - Link 'Sensor_LastUpdate-a:b:c:d:radiator_mode' has been added.
2020-07-01 13:51:08.167 [.ItemChannelLinkAddedEvent] - Link 'Sensor_LastUpdate-a:b:c:d:battery_level' has been added.
2020-07-01 13:51:08.738 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T10:12:18.237+0000 to 2020-07-01T13:51:08.700+0000
2020-07-01 13:51:08.757 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:51:08.700+0000 to 2020-07-01T13:51:08.702+0000
2020-07-01 13:51:08.767 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:51:08.702+0000 to 2020-07-01T13:51:08.712+0000
2020-07-01 13:51:08.776 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:51:08.712+0000 to 2020-07-01T13:51:08.729+0000
2020-07-01 13:51:08.786 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:51:08.729+0000 to 2020-07-01T13:51:08.738+0000
2020-07-01 13:51:08.795 [vent.ItemStateChangedEvent] - Sensor_LastUpdate changed from 2020-07-01T13:51:08.738+0000 to 2020-07-01T13:51:08.748+0000
Did I chain the channels incorrectly? Or does the function not work?
Update or change makes no difference.
I’m using the official Openhab docker Version 2.5.6 (Build 1st July 2020).
It’s really unlikely, but not impossible, for the mystery binding to be issuing lots of updates. They don’t get logged normally, unless a change is caused.
You can check for unlogged updates with a rule -
rule "update diag"
when
Item Sensor_Humidity received update // should be linked same channel
then
logInfo("diag", "update for " + triggeringItem.name)
end
although it does sound like some curious feedback effect, let’s make sure what is going on.
Channels are bi-directional, the binding can listen for state updates of the Item. Most don’t (listening only for commands) but there are exceptions. Or the profile itself might react to state updates incorrectly.
EDIT - yep, profile is the culprit. More experimenting to do, but it appears the profile tries to force the Item state to what it wants continuously. i.e. if you postUpdate the Item, it will immediately set it back to last channel update.
With two channels/profiles, they begin an endless war …
I will create a bug report when I’ve found the simplest example.
timestamp profile is currently broken for multiple channel use.
As they’re not doing any further changes to openHAB core, expect no fix for OH2.x
Use rule based techniques for now.
I just implemented this for some battery sensors. I’m using the design pattern and tying it to one of the five things reported by the sensor (in the case; battery level). Then, I go into Paper UI and link the other four channels to the ‘[…]_lastUpdate’ item I created in the .items file. Now I have a master “last updated” which is tied to all the five things reported by the sensor.
My motion sensor reports to a contact item. Can I have the last OPEN state with this design pattern? I guess I cannot use timestamp-update, as the motion sensor sends it’s state in regular intervals, even without change.
You would notice that the item shows an ‘Err’ above and also does the same in Model. I dont understand this since in ‘Items’ it shows the correct date,