vectronic / homebridge-ping-hosts

Ping state sensor plugin for homebridge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enhancement Request: support MAC address

mbierman opened this issue · comments

I am wondering if you would consider supporting MAC addresses as well as IP?

I’m not sure this is possible. Do you mean to firstly do an ARP lookup to find the IP for a given MAC address? What is your use case?

So your solution only works with reserved IPs.

Yes, using something like ARP lookup user could provide mac instead, that would give the current (DHCP) IP and monitoring could work. Not sure this would work between subnets, but for the same subnet is doable I think. See https://github.com/alexgustafsson/homebridge-wol#readme

I will try to look into this when I get a chance in the next couple of weeks. I have found a library which should suffice:

https://www.npmjs.com/package/@network-utils/arp-lookup

Sort of. the mac address is what I was looking for but it uses a motion sensor which for what I want isn't my first choice. If ping is successful, it shows motion and then goes off. I get the metpahpor... the ping is motion and until the next ping you don't really know if the device is online.

But most of the time, the device didn't go offline. Most of the time, I prefer a contact or light sensor to a motion sensor. Given that, I prefer your plugin.

Most of the time I want to know the current state of the device not the "heartbeat" of the ping result.

A few of my devices use fixed or reserved IPs but it would be nice to have the flexibility of a MAC address so that isn't necessary just for this plugin.

Updated here https://github.com/vectronic/homebridge-ping-hosts

I won't be able to test until the weekend and will then publish a release...

Awesome! I'll keep my eyes open for it and happy to do some testing.

The published version 3.1.4 seems to do this correctly - kind of....

NOTE: This will only resolve an IP address if there is already an entry in the ARP table on the machine running Homebridge.

The problem is that it looks like any solution to populating that table relies on some OS specific native commands... OR... I need to perform a ping to every IP on a configured subnet.... https://superuser.com/questions/29640/inverse-arp-lookup

Yeah, I expected there could be an issue for subnets. Maybe have the user specify any subnets they want to scan (CIDR range?) and default to just the subnet that Homebridge is running on?

So tried the new build. Thanks! Very cool. Here's some feedback.

  1. A device that is using IP (not mac) is incorrectly showing online. I think this was because, in motion sensor, default to failed I had off but now it makes more sense for that to be on (I'm using the Light sensor) Maybe changing the text here or making it conditional on the sensor type? I know, you do cover this in the doc but putting it in the user interface would be nice.
  2. There's no default sensor type filled in. I see you default to Motion which makes sense to ease upgrades. Might be nice to populate the interface with the default.
  3. Sensor types would be better as a drop down so people don't make typos or try sensor types that aren't supported if the homebridge GUI allows this.
  4. Might be nice to show an error (if possible) in the UI if user enters more than one of: IPv4, IPv6, mac for a device. Maybe just make it one text field that says enter one of them?
  5. Possible typo in the example, in the docs:
    "type": "MotionSensor>" should be
    "type": "MotionSensor"

created a pull request for that.

I've changed the config for items 2 and 3 above.

I don't quite understand item 1 and don't really have the time to do item 4 at the moment.

Will close this issue now, but feel free to open another if needed.