HTTP Presence Sensor for Hubitat
A virtual presence sensor for Hubitat that determines its state by trying to access an HTTP endpoint. If it gets good responses, it reports present. If it gets a few bad responses in a row, it reports not present.
- Pinging a device (that has an HTTP endpoint) to see if it is on the house's wifi network. If that device is present, then it means someone is home.
- When running HomeBridge on a Raspberry Pi, sometimes the homebridge process stops responding to HomeKit and Hubitat. Use this virtual device to regularly check and see if HomeBridge is still up and running. If it isn't, you can use Rule Machine rules to cycle the power on the Raspberry Pi. (I have my RPi plugged into a z-wave outlet for this reason.)
- Open your Hubitat web page
- Go to the "Drivers Code" page
- Click "+ New Driver"
- Paste in the contents of httpPresenceSensor.groovy
- Click "Save"
- Go to the "Devices" page
- Click "+ Add Virtual Device"
- Set "Device Name" and "Device Network Id" to anything you like. Set "Type" to "HTTP Presence Sensor".
- Click "Save Device"
- On the device list, click the name of your new sensor
- Set "Endpoint URL" to the url that you want the sensor to regularly ping. Example: On my HomeBridge setup, the hubitat plugin exposes an endpoint at "http://192.168.1.37:8005/". This is what I enter for the Endpoint URL.
- Click "Save Preferences"