homebridge-ping-hostsPing state sensor plugin for homebridge
homebridge-ping-hosts
A ping state sensor plugin for homebridge (https://github.com/nfarina/homebridge).
Installation
- Install homebridge using:
npm install -g homebridge
- Install this plugin:
npm install -g --unsafe-perm @vectronic/homebridge-ping-hosts
- Update your
config.json
configuration file
Configuration
Example config.json
entry:
"platforms": [
{
"platform": "PingHosts",
"hosts": [
{
"name": "Router",
"host": "192.168.0.1",
"interval": 60,
"timeout": 25,
"retries": 1
},
{
"name": "Internet",
"host": "1.1.1.1",
"interval": 60,
"timeout": 25,
"retries": 1,
"startup_as_failed": false,
"closed_on_success": false
}
]
}
]
Notes
- Hostnames are not currently supported, only IPv4 Addresses.
-
retries
defaults to 1 -
timeout
defaults to 25 -
interval
defaults to 60 - Works better if
timeout * (1 + retries) < interval
- On startup the sensor will default to a 'failed' ping state. This can be overridden by configuring
startup_as_failed: false
. - The sensor will have a "closed" state for successful pings and an "open" state for failed pings (or for any other issues). This can be overridden by configuring
closed_on_success: false
.
Permission Problem?
If you get an error which looks like:
Error: Operation not permitted
at new Socket (/usr/local/lib/node_modules/@vectronic/homebridge-ping-hosts/node_modules/raw-socket/index.js:47:14)
then you are probably running on a Linux based OS requiring the CAP_NET_RAW
capability to be added to the NodeJS executable.
Try something like this:
sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
评论