Time of last temperature poll?

I have a temp/humidity sensor. Is there a way to show the time of the last temperature poll/reading?

The user interface is partly dependent on the plugin, and partly dependent on Vera UI5. For the sensor devices I’ve seen, the only place you might find the information you want to see is on the device’s Advanced tab, under the LastUpdate variable. There is a number-of-seconds-since-1/1/70 value there, which ought to be at least very close to the last sensor reading. The problem is how unreadable that value is. You could paste it into a web site like http://www.epochconverter.com/ to see a human-readable version. Getting the plugin author, if there is one, to change the plugin to present a human-readable version is an alternative, albeit unlikely.

Also, mobile apps might do a better job of formatting timestamps readably. Sorry I don’t have better advice.

watou

Unfortenately the LastUpdate field is always empty. :-\

Cool, never heard of this before.

I had the same question some time ago , glad there is an answer now.
I just tried this and the tab shows : 1387208867 which is: GMT: Mon, 16 Dec 2013 15:47:47 GMT

Doesn’t make sense to me , since the device is updating , I mean , I see the temperature and humity changing during the day.

How is this possible?

@AndreasE: You did try it on the parent device?

Thanks,
Cor

[quote=“Cor, post:4, topic:179069”]Cool, never heard of this before.

I had the same question some time ago , glad there is an answer now.
I just tried this and the tab shows : 1387208867 which is: GMT: Mon, 16 Dec 2013 15:47:47 GMT

Doesn’t make sense to me , since the device is updating , I mean , I see the temperature and humity changing during the day.

How is this possible?

@AndreasE: You did try it on the parent device?

Thanks,
Cor[/quote]

The value in the Advanced tab only gets updated when you refresh the browser page. You could access the variable from scene Lua using luup.variable_get(…) and write it to a VariableContainer for display.

Sorry to hear that. What is in that field is completely up to the implementation. The two thermostat plugins I wrote both support temp and humidity, and report LastUpdate very close to when the sensors were last read (but that doesn’t help you unless you have unlimited cash to buy fancy thermostats to use as simple sensors and a 24VAC transformer).

@Cor - unfortunately the specs on precisely what go in these device variables are not complete, and some implementers could choose to put a value in that variable that isn’t helpful to you.

Thank you, there it is. However, the value does not change if I press the “Poll now” button. How come?
And how do I get this value to a readable one displayed together with the temperature?

@ Andreas: I guess the poll now function does not work with battery operated devices?

But according the time I get from that website the last update was from somehwere december , I logged on cp.mios.com this morning…
Or do you mean something else?

Cor

Or do you mean something else?
Well I meant that the displayed value of [u]any[/u] variable in the [b]Advanced[/b] tab is only updated when the browser page is refreshed.

Device variables are only useful when they are correctly updated by the devices and plugins that use them. LastUpdate does not appear to be consistently supported so may not be much help in practice.

I would be more inclined to use the timestamp of the last change to CurrentTemperature. This is maintained by Vera so should be more reliable. The following code will convert that timestamp to a date/time string:

local dID = 55 local temp,time = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature",dID) local dtstring = os.date("%c",time)

[quote=“RexBeckett, post:9, topic:179069”]I would be more inclined to use the timestamp of the last change to CurrentTemperature. This is maintained by Vera so should be more reliable. The following code will convert that timestamp to a date/time string:

local dID = 55 local temp,time = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature",dID) local dtstring = os.date("%c",time)[/quote]

Sorry, but I’m a newbie. How should I use this code snippet?

Sorry, but I'm a newbie. How should I use this code snippet?
As you say, it's a snippet, so it would need to be used within other Lua code.

We may be able to give you a more complete solution if you explain how you want the information presented.

It would be nice to have a “time device” with the temp/humidity device as parent, so that the time is always presented together with the temperature and humidity. As of now, in my android app Home buddy I’m only getting time and humidity, but I don’t even know if these values are from now or yesterday. Also, I don’t even know how often the temperature and humidity are polled. That is very strange. In fact, I find it very odd that time and date aren’t an inherent part of every device.

It would be nice to have a "time device" with the temp/humidity device as parent, so that the time is always presented together with the temperature and humidity.
That would require you to develop a virtual-device plugin. There is an initiative proposed by @RichardTSchaefer to make a parent virtual plugin that would make this an easier task. See [url=http://forum.micasaverde.com/index.php/topic,22672.0.html]this thread.[/url]
I don't even know if these values are from now or yesterday.
Perhaps you should try [url=http://forum.micasaverde.com/index.php/topic,16984.0.html]EventWatcher[/url] so you can see how often the device variables are being updated.

[quote=“RexBeckett, post:13, topic:179069”]

I don’t even know if these values are from now or yesterday.

Perhaps you should try EventWatcher so you can see how often the device variables are being updated.[/quote]

When the values of variables are updated is not the same as when the most recent sensor readings are taken. For example, humidity can stay the same value for hours at a time, but the most recent sample might have just been taken minutes ago.

Installed EventWatcher, but doing a request like

http://192.168.0.13:3480/data_request?id=lr_EventWatcher&rep=log

just gives me one item in the log: the restart time of my Vera, nothing else, though temperature and humidity are updated in my UI5.

If I do a request like

http://192.168.0.13:3480/data_request?id=lr_EventWatcher&rep=environment

time and date aren’t even presented, just temperature and humidity, both already in my UI5.

Actually, this is very hard for me to understand. Almost every thing in the world contains a time/date stamp: your newspaper, your bank account transaction list, your contract, the milk package, your butter, your ticket for the bus, your mails and so on. So how can’t this feature be a default one i Vera?!

Installed EventWatcher, but doing a request like

http://192.168.0.13:3480/data_request?id=lr_EventWatcher&rep=log

just gives me one item in the log: the restart time of my Vera, nothing else, though temperature and humidity are updated in my UI5.


Did you add TemperatureSensors (T) and HumiditySensors (H) to EventWatcher’s WatchCategories?

@AndreasE

Are you referring to the Everspring ST814 Temp/Humidity Sensor ?

@ Rex.

Correct me if I’m wrong, but couldn’t the missing last update value not be addressed by updating it directly by using the luup.variable_watch command, (added to Lua start up) so that when the temp or humidity changes Vera writes the unix date/time to the variable .

@ Rex.

Correct me if I’m wrong, but couldn’t the missing last update value not be addressed by updating it directly by using the luup.variable_watch command, (added to Lua start up) so that when the temp or humidity changes Vera writes the unix date/time to the variable .


Yes you could do that, Chris. It would still need some mechanism to display it though. Also, as @watou pointed out, the OP really wanted to know when it was polled rather than when the value changed.

No, but now I have. For safety, I added OG too, but the log still contains only one event.

[quote=“parkerc, post:17, topic:179069”]@AndreasE

Are you referring to the Everspring ST814 Temp/Humidity Sensor ?[/quote]

Yes.