A rule to monitor and compare thing uptime?

hi all
i have a problem with one device wich i cant fix so i am trying to go around it or to simple be notified if it freezes. i dont know the reason it crashes but its there and its gonna stay there for a while.
it has a uptime value and i could make it a thing but i have no idea how to make a rule that will compare that value with a value from a minute or two ago so i can send my self a message if its the same or zero witch would mean a crash.

theres also mysql db of how long since any of wifi devices responded last time so i was thinking i might use that but apparently openhab doesnt read things from mysql db that way or maybe there is but i didnt find out how. anyway, first option looks easier i guess…
any help with this? thanks for any info!

It helps to remember and think about OH as an event driven system. What you are looking for is something to happen if you don’t hear from a device after a certain amount of time. That’s much easier to approach than trying to approach it the way you describe messing with stored timestamps and such.

You can do the following:

  1. Link the Channel to an Item
  2. Set Expire on the Item to set it to NULL or UNDEF when it doesn’t receive an update for a given amount of time. The rule-of-thumb is to be at least twice the typical update period so if it updates every 30 seconds, set the expire to a minute.
  3. Create a rule that triggers when that Item changes to NULL/UNDEF to send your alert.

The rule will trigger when there has been no update from the device for too long of a period.

There are other approaches too. See Design Patterns: Generic Is Alive for more.

i have never done what you described before so i am gonna go look into it and how to do it but sounds reasonable enough, thank you!

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.