Detecting PCs?

I’ve got OpenHAB2 installed and running, and it’s auto-detected most of the devices on my network (NAS’s, phones, printers, tablets) but it’s not detecting my laptop & desktop that are running Win10.

The desktop can be manually pinged from the NAS where OpenHAB2 is installed, but the laptop can’t, if (?) that’s of any relevance.

Is there a way to detect these?

Thanks.

Please check whether java has the permission to use raw and packet sockets.

Thomas

thanks, tho that topic talks about the ‘NetworkHealth’ binding - which isn’t listed as a binding in my install.

Also, I’m far from keen to play around with the java install on my (synology) NAS, if for no other reason than a system update is likely to revert it back to the standard config.

Is there another way?

I don’t know of any other way to solve this. The referenced post is not limited to the network health binding. It is about granting a specific permission to the java binary used by openHAB. So I would assume that openHAB will never be able to detect your Win10 boxes without this permission.

Thanks.

Sorry if I’m being dumb, but … doesn’t java use the same detection method for other network devices, and if it detects other devices it must already have that permission?

I’ve just turned off the firewall of one of those win10 PCs, and the network binding is then able to detect - so it doesn’t appear to be anything about java permissions.

So I guess I now need to find out what exactly the firewall needs to be allowing.

and having googled and tried a few things, I can’t find what it is I need to allow (it doesn’t appear to be the file & printer sharing options in advanced settings). Does anyone know which settings need changing in the firewall?

Try to change the firewall to allow ICMP pings.

yep, that much I’ve googled. However there’s nothing explicitly labelled as ICMP, and the actions I took (suggested from googling) on the file & printer sharing settings didn’t have the desired effect.

It’s definitely in there somewhere (as turning off the firewall proves) but I’d rather not do it by trial & error.

java ping is different:

I tried to solve the problem on PC side but didn’t find a working firewall solution, which is awkward because I tried quiet a few settings that came to mind. In the end I disabled the firewall. This may not be acceptable for you. I will try the solution linked by @Penrose later, thanks!

@DSTM if you are not able to change the permissions on your NAS, I see three options:

  1. Disable firewall on PC
  2. Find a firewall setting that allows java pings
  3. the new OH2 network binding features the port parameter. You could launch a small webserver on your laptop to allow a connection on Port 80 or wherever you want. This was not tested by me and I’m not sure if it would work(!)

I’ve tried a rule that opens all TCP ports without success.

Of those, the 2nd is the only realistic option.

If I figure it out, I’ll post it back here.

I can confirm that setting java permissions is a valid solution:

sudo setcap cap_net_bind_service=+ep /path/to/java
# Find the path automatically:
sudo setcap cap_net_bind_service=+ep `whereis java | grep -oE "[^ ]+$"`

Afterwards you’ll have to set use_system_ping to true in your network thing configuration. http://docs.openhab.org/addons/bindings/network/readme.html#thing-configuration

As for 1. and 2. @DSTM I also tried that without success.

As for 3.: I installed a small webserver and it serves at port 8888, setting the port parameter in the thing configuration seems to be completely ignored. I’ll have to create a bug report for that.

in which case your issue is something different to mine, and your valid solution is unlikely to be the solution for my different issue.

1 and 2 as in “Option 1: Disable firewall on PC, Option2: find a firewall setting that allows java pings”. That’s the same for all use cases involving a Windows 10 PC. It would be great to have a solution which doesn’t involve weakening the server setup.

A solution on server side is probably a bit different for you, yes. Did you try to execute setcap on your synology NAS?

Nope.

At this moment in time I’ve no specific need to detect the win10 machines, tho it would be nice to have them for completeness. If my need to detect them ever becomes becomes greater than my wish to not mess about unnecessarily with NAS setup I’ll get round to trying it.

To solve this question, also for others:
I have completely updated the documentation on the Network Binding, mentioning needed permissions and on how to use the port parameter (which will solve your problem @DSTM). The changes will soon be available at http://docs.openhab.org/addons/bindings/network/readme.html

(Till then, please have a look at this pull request)

thanks - tho it doesn’t seem to do what the docs say, unless I’ve done something wrong?

if I do:-
sudo nmap -Pn -sT -p- 192.168.1.73

I get:-
Host is up (0.0029s latency).
Not shown: 65519 filtered ports
PORT STATE SERVICE
135/tcp open msrpc
139/tcp open netbios-ssn
443/tcp open https
445/tcp open microsoft-ds
554/tcp open rtsp
1801/tcp open msmq
2103/tcp open zephyr-clt
2105/tcp open eklogin
2107/tcp open msmq-mgmt
2869/tcp open icslap
5357/tcp open unknown
8000/tcp open http-alt
10243/tcp open unknown
39951/tcp open unknown
49666/tcp open unknown
49679/tcp open unknown

and yet if use port 554 it doesn’t work (if I turn off the win10 firewall with the same netwoirk binding config it does work).

My things file has:-
network:device:192_168_1_73 [ hostname=“192.168.1.73”, port=“554”, retry=“1”, timeout=“5000”, refresh_interval=“60000”, use_system_ping=“false”, dhcplisten=“false” ]

And my items file has:-
Switch Network_Desktop_Neil_Win10 “Desktop Win10” (FF_Office, Network) { channel=“network:device:192_168_1_73:online” )

Can anyone give me a clue for how to make it work, please?

:-/ This is strange.

Ok just to clarify: Your openHAB on your NAS is not able to reach port 554 of your Windows PC if Windows Firewall is enabled?
I’m unsure what’s going on. Could you please try once again with port 8000?

hi Thom, thanks for taking the time to look at this - and my apologies, it does work, on both ports.

I had 2 network devices for the same IP address, which it didn’t like (I’d previously created one, which I needed to delete before doing it as you’ve documented).

So thank you, I appreciate you getting me sorted out. :smile:

1 Like

I am running my OpenHab2 Server on a Raspberry Pi and had the same problem with windows 10. I could solve this by setting use System Ping to ON in the PaperUI

There are more than one way to solve this http://docs.openhab.org/addons/bindings/network/readme.html#reachability-meassures