Sensor Update Times

Hi,

I am new to Home automation and have been playing with OpenHAB, OpenHAB2 and also Domoticz.
I have to say that I find OpenHAB far more powerful and flexible with regard to the configuration of items and I plan therefore to stick with OpenHAB(2).

The one thing I really liked from Domoticz though is that you can see the time at which the sensor data was last received next to the sensor. Is this already possible in OpenHAB or could this be a requested feature in OPenHAB2?

I have to say OpenHAB (and OH2) are fantastic solutions - absolutely well done to the developers. :slight_smile:

Hi Colin,

Thanks for the kudos!
Information like time stamps is something that need to be persisted and thus such a feature is only possible when using a persistence service (whichever you choose). In that case, the “last update” value is technically available, but it currently isn’t easy to get it displayed in a UI (i.e. adding it to a sitemap).
We could now either retro-fit the existing sitemap concept and add this as an additional feature or we could consider it in the new sitemap concept that is drafted (see https://www.eclipse.org/forums/index.php/m/1720692/), but which will probably still take a while before it gets implemented.

Best regards,
Kai

Hi Kai,
Thanks for the response.

From my point of view, which ever would bring the quickest benefit to most users is the most interesting. Since both OH and OH2 are using the identical sitemap style currently, I guess retro-fitting gives the more immediate benefit to end users. But I have no concept of how much work is involved in implementing this and so this is very easy for me to say!

At the end, you guys work on this without financial benefit. So if it appears one day, I will be very happy. No pressure :slight_smile: - only a suggestion!

Cheers

I agree, retro-fitting can be the quicker solution for sure.

Right, but this is also the major draw-back for user requests: Such features tend to have a low priority unless some developer needs it for himself and hence implements it…

You are completely right of course, this is a draw-back. But then this is a free and extensive software solution and so… well we have to consider the pros and cons right. :slight_smile:

Whilst I have some experience of C (at a basic level) and of experience of LabVIEW at a high level, neither of these allow me to contribute to the OpenHAB development unfortunately. I know I would find this immensely interesting.

Given an Item called MyItem you could set up a second Item of type DateTime MyItem_Update and set the state through a rule:

import org.openhab.core.library.types.*
import org.openhab.model.script.actions.*
import org.openhab.core.types.Command
import java.util.Date
import java.util.Calendar

rule "Set Update Time"
when
    System started or
    Item MyItem received update
then
    var Calendar cal = Calendar::getInstance()
    cal.setTime(MyItem.lastUpdate("mysql")) //mysql is the persistence service
    MyItem_Update.postUpdate(new DateTimeType(cal))
end if

Hi Udo. Yes I did somethinget like his before and it works. The only downside is you have to create 2 items for each item. In the end I created one item per node and this is more realistic. I still believe it would be nicer as perhaps smaller text adjacent to the sensor value.