Getting all OFFLINE devices

Is there way to show in the sitemap all offline devices as warning?
Sometimes I have some Hue bulbs who are offline or other things.

Now I want to query or get all offline devices and show this on the main sitemap or send an notification.
So I see which is offline and can check the problem.

One solution would be to have a rule for every thing I use and check if it is offline.
This is a lot of work so I ask if there is a inbuild way in openHab to get all offline devices.

If they’re wifi devices, this might help you out.

I’m not aware of any way to check any type of device.

1 Like

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.

1 Like

Thanks for the info. But I was searching for a function to get all offline devices.

Great idea with Telegram and the question dialog. Thanks.
So you are also writing a rule for EVERY device who can go offline?

There is no limit on the number of rules you can have and they are in config files so its just a copy paste.

Some things do different stuff when they go offline like when no internet is detected for 30 sec reboot the router. Cant send a teligram without internet

Yes of course I know.
But for my use case it does all the same :wink:

If a device is offline show it in the sitemap.
But I understand that there is no overall method/feature to get all offline devices.

I will now add every thing to a rule. Thanks.

Function? or sitemap? :wink:

Function means, you have to have a rule in place, which checks:

  1. all items are in a group (gMonitoring for example)
  2. regarding of the type of item, you could have to use some expire-items[1]
  3. the rule checks, if a item in this group changed to OFF
  4. you can then send you a push notification, an email, a telegram, … as a “warning”
  5. 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:


Switch	Synology	"Synology NAS"	<network>	(gMonitoring)	{ expire="5m,command=OFF",channel="network:pingdevice:Synology:online" }


rule "offline Netzwerk"
	Member of gMonitoring changed to UNDEF
	var String message = "the following item is offline: " + triggeringitem.label
	logInfo("monitoring rule", message)
	sendNotification("", message)		
1 Like

Yep that will work aswell just as good.

How do you link a thing status channel to an item?

I refer you kindly to the docs! :wink:


Thing network:pingdevice:Synology	[ hostname="",  retry=3, timeout=5000, refresh_interval=60000, allowSystemPings="true", allowDHCPlisten="true" ]

Thanks, but OFF is not offline or did I missunderstand something?

The thing goes to offline and not the item.
The item has only states like ON/OFF/UNDEF, but not offline.

And I can’t create a group of things as far as I know.

You don’t want a Group of things, but a Group of items:

Group:Switch:OR(ON, OFF)	gMonitoring	"monitoring items"

and yeah, I think I shortcutted something, it could be, the item above changes to “UNDEF” not to “OFF”… so it should read:

	Member of gMonitoring changed to UNDEF

changed it above.

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 :wink:

did you check with the docs?

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)

on a side note: OH3 bringt a whole new way of seeing things, items and stuff with the concept of a “model” openHAB 3.0 my getting started notes: Model and Pages

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.


Thanks for the info. Will have a look at it.

Why have you got to create another thing and item to check if the thing status is correct. I have many rules but have no figured out a way to do it all with one rule.

Its late so I will write a rule to do it tomorrow and post it here for you to see.

Do you still want it to show in sitemap or just a notification?



1 Like

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:

  • gMonitoring
    ** gZwave
    ** gNetwork

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.

Oh this looks promising. Will have a look.

Thanks will check if the Z-Wave item gets state “UNDEF” if the Z-Wave node thing is offline.

1 Like

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.

1 Like