Heifei81
(Heiko Feisel)
September 7, 2020, 11:02am
1
Platform information:
Hardware: RaspberryPi 3
OS: OpanHabian
openHAB version:2.5.7-1
I want to display when a sensor sends its last update and configured this item:
DateTime DeviceLastUpdate "Last update [%1$tH:%1$tM %1$td/%1$tm/%1$ty]" <time> (Schlafzimmer,Temp) {channel="mqtt:topic:broker:TEMPSLEEP:humidity" [profile="timestamp-update"]}
But the value of “DeviceLastUpdate” ist alwasy NULL.
My item to get the humidity is:
Number Humidity_Temp_Schlafzimmer "Luftfeuchte [%d %%]" <humidity> (Schlafzimmer,Temp) {channel="mqtt:topic:broker:TEMPSLEEP:humidity"}
So, where is my mistake?
At first glance it looks OK (though I can’t verify the date formatting you’re using at the moment). Have you waited long enough to get your first update since saving the Items file?
Do the logs show any complaints?
Heifei81
(Heiko Feisel)
September 7, 2020, 11:18am
3
I wait since yesterday!
I´ve forced the sensor to update a severall time.
There is no error or warning or somting like this in the log.
Hmmm, yes, looks like long enough!!
To rule out the date formatting: can you temporarily change the label to that from this tutorial?
Please see Design Pattern: What is a Design Pattern and How Do I Use Them for a description of what Design Patterns are and how to use them.
Problem Statement
Sometimes you want to know the latest time when an item has been updated. For example, when was the last time the front door was opened, or when was the last temperature reading from your fridge. It’s very useful for battery powered devices to check that they still are alive.
Concept
By using the new profile functionality for items (in …
Heifei81
(Heiko Feisel)
September 7, 2020, 11:36am
5
You mean, that I have to change the format to [%1$tF %1$tR] ?
I did so but still negativ.
If I force the sensor to send data I can see the new vaules in the log but nothing about the DateTime-item.
Mysterious. The only thing I can suggest (until someone more knowledgeable turns up) is to restart openHAB.
Heifei81
(Heiko Feisel)
September 7, 2020, 11:56am
7
Restart of openHaAB and reboot of the Server takes no effekt.
rossko57
(Rossko57)
September 7, 2020, 2:50pm
8
It’s going to be something silly, like a typo.
Have you defined only one Item with that name? (including PaperUI created Items)
Is your xxx.items file fully loading? (see your openhab.log)
What does REST API say about your Items properties?
May we see your events.log showing “real” Item change?
What does REST API show about the links for your real and timestamp Items?
1 Like
Heifei81
(Heiko Feisel)
September 8, 2020, 11:28am
9
Hi rossko57,
I´m an newbie in openHab so a silly mistake is possible
This item is unique and the hole .items file is working but ignors this item.
curl http://localhost:8080/rest/items/DeviceLastUpdate/state
NULL[13:20:20]
My log after I change .items file and force the sensor to update:
2020-09-08 13:22:37.322 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model `'aqara_tempsens.items'`
` ==> /var/log/openhab2/events.log <==`
2020-09-08 13:23:27.505 [vent.ItemStateChangedEvent] - Temperature_Temp_Schlafzimmer changed from 21.19 to 25.06
2020-09-08 13:23:27.531 [vent.ItemStateChangedEvent] - Humidity_Temp_Schlafzimmer changed from 61.99 to 95.01
2020-09-08 13:23:37.798 [vent.ItemStateChangedEvent] - Temperature_Temp_Schlafzimmer changed from 25.06 to 24.35
2020-09-08 13:23:37.828 [vent.ItemStateChangedEvent] - Humidity_Temp_Schlafzimmer changed from 95.01 to 95.21
How can I use REST API to show the link?
rossko57
(Rossko57)
September 8, 2020, 11:55am
10
Install the the add-on option misleadingly named “REST docs”
It actually gives an interactive tool. You can inspect the Item properties the system thinks it has, in JSON form.
And find and inspect the links.
Could you show the full contents of aqara_tempsens.items
? I wonder if there’s something strange around where you have defined DeviceLastUpdate
which prevents openHAB from loading it.
When you change and save aqara_tempsens.items
, what do the logs (openhab and events) say?
Heifei81
(Heiko Feisel)
September 8, 2020, 12:44pm
12
Here is the aqara_tempsens.iems - File:
//Büro
Number Temperature_Temp_Office "Temperatur [%.1f °C]" <temperature> (Office,Temp) {channel="mqtt:topic:broker:TEMPOFFICE:temperature"}
Number Humidity_Temp_Office "Luftfeuchte [%d %%]" <humidity> (Office,Temp) {channel="mqtt:topic:broker:TEMPOFFICE:humidity"}
Number Battery_Temp_Office "Batteriezustand [%.1f %%]" <battery> (Office,Temp) {channel="mqtt:topic:broker:TEMPOFFICE:battery"}
//Schlafzimmer
Number Temperature_Temp_Schlafzimmer "Temperatur [%.1f °C]" <temperature> (Schlafzimmer,Temp) {channel="mqtt:topic:broker:TEMPSLEEP:temperature"}
Number Humidity_Temp_Schlafzimmer "Luftfeuchte [%d %%]" <humidity> (Schlafzimmer,Temp) {channel="mqtt:topic:broker:TEMPSLEEP:humidity"}
Number Battery_Temp_Schlafzimmer "Batteriezustand [%.1f %%]" <battery> (Schlafzimmer,Temp) {channel="mqtt:topic:broker:TEMPSLEEP:battery"}
DateTime DeviceLastUpdate "Last update [%1$tF %1$tR]" <time> (Schlafzimmer,Temp) {channel="mqtt:topic:broker:TEMPSLEEP:humidity" [profile="timestamp-update"]}
//Flur
Number Temperature_Temp_Flur "Temperatur [%.1f °C]" <temperature> (Flur,Temp) {channel="mqtt:topic:broker:TEMPFLUR:temperature"}
Number Humidity_Temp_Flur "Luftfeuchte [%d %%]" <humidity> (Flur,Temp) {channel="mqtt:topic:broker:TEMPFLUR:humidity"}
Number Battery_Temp_Flur "Batteriezustand [%.1f %%]" <battery> (Flur,Temp) {channel="mqtt:topic:broker:TEMPFLUR:battery"}
//Bad
Number Temperature_Temp_Bad "Temperatur [%.1f °C]" <temperature> (Bad,Temp) {channel="mqtt:topic:broker:TEMPBAD:temperature"}
Number Humidity_Temp_Bad "Luftfeuchte [%d %%]" <humidity> (Bad,Temp) {channel="mqtt:topic:broker:TEMPBAD:humidity"}
Number Battery_Temp_Bad "Batteriezustand [%.1f %%]" <battery> (Bad,Temp) {channel="mqtt:topic:broker:TEMPBAD:battery"}
After an update the logs just says:
020-09-08 14:43:07.159 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'aqara_tempsens.items'
Heifei81
(Heiko Feisel)
September 8, 2020, 4:35pm
13
Hi folks,
I´ve found the solution it was a mistake in my brain…
Simple and easy - I forgot to link the item in Paper UI.
After I do so, it work´s perfect.
Thanks to rossko57 because he gived me the hint with links.
rossko57
(Rossko57)
September 8, 2020, 4:57pm
14
But… but… the channel=“blah:bleh” you give in your Item definition creates the link. You should not need to do anything else in PaperUI.
I’m going to guess that the channel UIDs you gave in xxx.items file are rubbish, and you have now linked real UIDs in PaperUI. At the least you should clear those up, broken links can give you odd effects later.
Heifei81
(Heiko Feisel)
September 9, 2020, 1:01pm
15
Mh, that´s strange, because I had to linked every item to a thing, manualy.
Is this an option in the openHab-System?
rossko57
(Rossko57)
September 9, 2020, 1:43pm
16
No option. The {channel=“xx:yy:zz”} entry in your Items files creates a link. Either the file did not load or the channel ID was wrong. Look closely at the channels you did link n PaperUI and compare IDs.