I do this because who wants to goto sitemap to check if things are offline.
rule "Wled State"
Thing 'wled:wled:Anabel_NL' changed from ONLINE to OFFLINE
val telegramAction = getActions("telegram","telegram:telegramBot:Telegram_Bot")
logInfo("Wled State", "Lamp is OFFLINE!")
telegramAction.sendTelegram("Anabel Lamp Offline")
With telegram you can also ask a question and do something with the response like.
Function means, you have to have a rule in place, which checks:
all items are in a group (gMonitoring for example)
regarding of the type of item, you could have to use some expire-items
the rule checks, if a item in this group changed to OFF
you can then send you a push notification, an email, a telegram, … as a “warning”
you can place all gMonitoring devices on a sitemap and check their statuses
if you’re using network binding to ping devices regularly, sometimes you get a device as OFFline, which isn’t really - so you’re working with a proxy-item ( Design Pattern: Proxy Item ) to make sure, it stays online unless it is offline for let’s say more than a couple minutes.
But let’s assume, everything works as intended, you won’t need a proxy, but can with that:
rule "offline Netzwerk"
Member of gMonitoring changed to UNDEF
var String message = "the following item is offline: " + triggeringitem.label
logInfo("monitoring rule", message)
I understand so if an thing goes offline the items below are getting all UNDEF?
And if this is really the case I get sometimes false warnings because the items can get UNDEF because of any other event/case.
Because of this it would be great to define a group of things and I can check the state for the group
it is depending on the device difficult to get a constant ping - that’s why sometimes you have to work with proxy items and get them some more expire-time. It reduces the false negative - but of course heightens the risk of getting to know offline-items at a later time…
if you use the gMonitoring “item”-group, you can of course check the group - no need to check it with things (which from the OH-concept don’t make sense to put in a group)
Tanks you are talking about network bindings, but I am talking about every binding.
For example a Z-Wave binding. The thing can go offline if it is loosing the connection to the Z-Wave stick or the HUE-Binding and so on.
But you are right that I can check this with item if I use a network binding.
So for example to check if a PC is online I can do this.
ah! now we’re talking! but having a Z-Wave device losing connection is nothing more than not having a ping on a network device?
In my example - and if zwave behaves differently as network does - I would cascade:
meaning, gZwave as a Group has all Z-Wave devices and gNetwork all network ones (you can also make more branches as needed) - the state of gZwave / gNetwork is the determining the state of gMonitoring. That way you get at least two “OFFLINE”-Groups: the one, the item is in and gMonitoring also.
you can achieve the same thing on the Thing configuration itself. You can specify:
how often to ping
how long to wait for a reply
how many times a ping will time out before making it as offline
So you can check every 15 seconds, wait one second for a reply, and have the ping timeout 4 times in a row before it’s marked offline. There is no need to use a proxy item and rule.
The online/offline status of a Thing is whether the binding is working or not. To see if a device is online/offline you need to look at the Item linked to the status channel. It’s perfectly normal for The Thing to be ONLINE and the device be offline. The binding is working.
Unless you set an Item to UNDEF yourself in a rule, Items will only go to UNDEF if a binding determines it cannot connect to the device or something else like that has gone wrong. So you can rely on the UNDEF state to indicate a device has gone offline. Assuming the binding supports that.