Hi, i have a guest network configured. My openHAB can ping in that network with the Network binding.
And now i got an easy question: is it possible to ping a complete IP-range with only one item/thing?
I want my system to know if guests are in my wifi network. If so. some functionalities should be restricted, so they dont play too much with my smarthome. But my guests mobile phones get different IPs in my 20-VLAN. So i am not able to add 100 items or more to know if one guest is at my house. Is that possible?
You would need something like a broadcast ping:
ping -b 255.255.255.255
But I don’t think the network binding can work with that!?
But why don’t you just restrict guests from accessing your OH VLAN?
I agree that a more normal approach to this problem would be to only allow known devices to access your home automation in the first place.
But if you can get something to work from the command line using a script, (e.g. @DrRSatzteil’s suggestion though I just ran a quick test and my phone didn’t respond to the broadcast ping so you might need to use nmap or some API built into your gateway or the like) you can use the Exec binding or executeCommandLine to do the ping and parse the results.
In general though, network monitoring is not OH’s strong point. Some other tool or approach might be a better choice.
I wondered this too, but never found a way. My guest network is only restricted to 20 IPs, so I’ve got individual Things and Items for each. (I’ve got text file configurations, so it’s a very quick copy-paste-edit). And then a Group Item which is a parent of all the individual Items, and it’s this Group Item that’s used for triggering automations when guests are around (I don’t care who the guests are; just that they exist in the house).
My thinking is that I’m unlikely to have more than 20 guest devices in my house at any one time. Neither 20 individual guests with devices, nor 10 guests with two devices each, or any other combination. It’s worked well so far, but maybe I’m just not that popular…