Working with a timestamp

I am transmitting a Unix epoch timestamp in GMT format to a temperature sensor with which i am working:

1502145961

how may I use that time with PLEG such that I can validate its current-ness?

pseudo condition:

HomeMode AND (CurrentExteriorTemperature > 95) AND (CurrentExteriorTemperatureTimeStamp; NOW < 60:00)

All Unix timestamps are supposed to be GMT since they do not carry a timezone.

You can’t convert it to a timestamp in PLEG, So PLEG will only see this as a number.
But you can covert PLEG timestamps to a number, and then compare the numbers.

TimeStampNumber #OnTimeStampForSomeInputOrConditionName

or
TimeStampNumber !#OffTimeStampForSomeInputOrConditionName

PLEG timestamps are in ms, … I believe the number you have is seconds.
After appropriate scaling, you can just compare the numbers and check for the amount of time between the two values.

thanks Richard, I re-read Rex’s document for a refresher!

So I now have this Condition:

 ExtTempValid

that I set like this:

(#NOW < #ExteriorTemperatureTime + (45 * 60 * 1000))

the # is the last update timestamp for the ExteriorTemperatureTime or is it the “tonumber()” of the string value itself?

As usual, I appreciate your kind assistance.

This is the time the variable was updated. so remove the # from befire your variavle name.

Sent from my SAMSUNG-SM-G935A using Tapatalk

I see. So, really I don’t need this timestamp… I realized. I merely need to poll the temperature and compare the last update time.

Oh well, I (re)learned something!