Skip to content
View in the app

A better way to browse. Learn more.

Universal Devices Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Compare last device update to variable timestamp

Featured Replies

OK, I was trying to figure out how to tell if the last device update for a certain device was older than a certain amount of time. I know I could accomplish something like that by having each event start a program that waited some amount of time but I got to thinking, why can't I just check the device last update and compare it to either the system time or for example a variable unix timestamp.

I don't think this works even though you can create an if statement in a program that looks like it should work:

LastUpdate - [ID 00AF][Parent 0010]

If

'YoLink / Motion Crossroad' Last device update < '$On_Minutes Unix Timestamp'

Any ideas? I want for example to run a program at 8 am that will tell me if a device has not had an update in the last 24 hours.

Edited by Andy P

Solved by Panda88

UD Mobile has where you can see the history of devices so you could look in there but I don't know if it is available to use in programs yet. I hope it will be coming to eisy ui eventually and that might open thigs up more in the future.

If it is Yolink specific - the devices have a last update time (that gets updated when yolink send new data - it is updated even if the value does not change) - you can compare that to the system unix time (under system parameters) - both represents seconds after jan 1st 1980 e.g.

if system unix time - last update > xxxx seconds

you may need to create a variable first (containing the difference) and then run a program that tests for the difference, but I am sure it can be done multiple ways

Edited by Panda88

  • 4 weeks later...
  • Author

OK, so I was able to store the system unit time into an integer variable, but no matter what YOLINK device I select, it does not store a value for the last update into the variable - always zero.

image.png

image.png

Is that a bug or am I doing something wrong..

Edited by Andy P

  • Solution

It seems there is a bug in the eisy-ui interface - I have specified time with 2 possible value types - 1 being the actual time (unix time) and 2 if there is no time a text string showing that (indx, uom25) - This also shown when you pick the variable - it shows index, unixtime - I guess it picks the index (0 or 99) - not the unix time - although it programmed to be unixtime when the value is updated

I can remove the index, but in my mind it is a bug in the system -

Note, if you use the AC, you can pick unix time and it works there - this is why I have not had issues so far

image.png

  • Author

Ah yes, I see. Apparently there are two possible values but the eisy-ui does not allow you to choose the second one and defaults to the first

image.png

So, I was able to use the AC to create the program:

This one runs every hour. It doesn't really need to use the intermediate variables, but I used them to make sure it was working right.:

Elapsed Time Check - [ID 00AB][Parent 00AA]

If

- No Conditions - (To add one, press 'Schedule' or 'Condition')

Then

$System_Unix_Time = [Unix Date/Time (seconds)]

$Last_Update_Time = 'YoLink / Motion Crossroad' Last device update Unix Timestamp

$Last_Update_State = $System_Unix_Time

$Last_Update_State -= $Last_Update_Time

And I have another program that triggers when the $Last_Update_State is > the timeout value. I will be fixing the logic so it doesn't trigger on the first assignment.

Thanks!

Edited by Andy P

Yes - I use something similar

Jari has promised to fix this in a future release of eISY-UI (simply dropping the non-numeric type)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.