PeteLawrence/homebridge-people

Request: Firewalled vs. Unreachable

Opened this issue · 1 comments

I'd like to trigger a light based on whether a particular laptop is active on my network. It is firewalled, so it will not ever respond to pings, but when it is off/gone it gets removed from the ARP table and therefore its being unreachable or not is an accurate way of determining its presence. How hard would it be for you to add a 'firewalled=yes' type option to change the presence criteria a little:

Firewalled machine away:

me@raspberry:~ $ ping mylaptop -w 3
PING mylaptop (10.0.0.111) 56(84) bytes of data.
From raspberry (10.0.0.2) icmp_seq=1 Destination Host Unreachable
From raspberry (10.0.0.2) icmp_seq=2 Destination Host Unreachable
From raspberry (10.0.0.2) icmp_seq=3 Destination Host Unreachable

--- mylaptop ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2012ms

Firewalled machine present:

pi@raspberrypi:~ $ ping mylaptop -w 3
PING mylaptop (10.0.0.111) 56(84) bytes of data.

--- mylaptop ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2037ms

I may have got this, however I couldn't get the ping to respond as yours does.
Could you try this please?
npm install -g git+https://github.com/OverByThere/homebridge-people.git

Then on the firewalled host, add "firewalled": true,.

Instead, for firewalled devices it does a DNS lookup first. If that fails then they're not on the ARP table.
It will then (if they are on ARP) do a normal ping and check for "Destination Host Unreachable" in the output.

It should also log when it becomes reachable.