[UPDATED] HTTP Presence Sensor

That’s the idea, yes

For combining this with another presence sensor for greater reliability, I have just uploaded this: https://community.hubitat.com/t/release-combined-presence/9186?u=jwetzel1492

1 Like

I am still learning to use your HTTP presence sensor. , How do I find the HTTP endpoint of a device?

It totally depends on what the device is. Sometimes there is documentation for it. If you don't know at all, a couple steps to try to figure out a good one:

  • the first thing is to find out what the IP Address of the device on your network is. The device may have an interface that tells you, or you may be able to find it in the admin pages of your router.
  • Then, try to talk to it with a web browser. For example, if the local IP is 192.168.1.100, then try to hit http://192.168.1.100 with a browser. You can also try https://192.168.1.100
  • Documentation for the device may give other clues. And devices may have multiple endpoints. What you want to find is something that returns some kind of data to a browser if the device is on, but if the device is off, the browser shows an error message.

Here's my example: I have a homebridge server. If it is running well, then the endpoint http://192.168.1.91:51829/accessories will return a bunch of data. But if it has stopped working, it won't return anything.

Thanks a lot. The only local IP I got response was Hubitat Hub so far, would pinging HE hub work? I just got a Raspberry Pi, I will set it up as a homebridge server and try then.

I am currently using this driver in my car to automatically open the garage. It detects the presence really fast but I noticed it then takes almost 4mins to become not present when the car is turned off. Is that configurable to say 1min or is this a HE limitation?

Use case here is that I would love it to close the garage door as well but I don't want to be 4mins down the road as someone could then access my garage without me knowing. Maybe the answer is an aggregated presence which I think someone has built but I haven't tried it.

1st thank you.

I purposely turned my server not present

, the driver worked perfectly but no notification know why?

My guess would be that the sensor was not offline long enough. You have it set for 1 minute and according to the log it was not present for less than a minute (missed it by a fraction of a second).

Was offline from 8:36 to 8:53

Try removing the "/login" from your endpoint URL and add the port number instead.

1 Like

Thx, that fixed it

IMPORTANT UPDATE FOR ANYONE USING THIS DRIVER:

I have posted a stability update here:

This is a critical update for anyone using this driver. It puts a timeout on the http requests the driver makes. (Timeout was not a part of the Hubitat http api at the time I initially wrote this driver.)

4 Likes

So if I understand this correctly, in a round about manner, I could use this as a trigger to tell me when my home WiFi has dropped out.

Rational:
I have a separate WiFi router that occasionally locks up and the WiFi dies. All wired devices are not affected. HE is not affected.
so.... If I use the "HTTP Presence Sensor" to constantly ping a SonOff device I have, then if it goes uncontactable it'd likely be because the WiFi is down and I could then power cycle the Zigbee power outlet that feeds power to the WiFi Router. Rebooted router = restored WiFi :slight_smile:

That should work, right ?

EDIT:
It does exactly what I thought it would and I've now got a "recoverable WiFi" setup.

Big thanks @jwetzel1492

1 Like

IMPORTANT UPDATE: HTTP Presence Sensor can now be installed from Hubitat Package Manager. This is the best way to make sure you keep up-to-date with bug fixes and new features.

3 Likes

In your code on line 63, your showing that wifi is checked every minute.
runEvery1Minute(refresh)
runIn(2, refresh)

I'm not a programmer, but I'd like it to run every 5 minutes. Can I just change it to
runEvery5Minute(refresh) and do I have to change
runIn(2, refresh)

Also, in the logs, is it showing when the Wi-Fi was pinged and if there wasn't a change you won't see (on) ?
Thanks
Tony

Yes there is a command for running every 5 minutes. Note there is an ‘s’ in minutes.

https://docs.smartthings.com/en/latest/smartapp-developers-guide/scheduling.html?highlight=runEvery1Minute#run-on-a-recurring-schedule

1 Like

For anyone using this HTTP Presence Sensor with my app Combined Presence, I have just release V2.0 of Combined Presence. The best way to get the update is to install via Hubitat Package Manager, but you can also install directly from GitHub.

It should be fully backwards compatible and not break any existing combiner instances.

The most important update is the new "Standard Combiner". This instance has the optimal logic for detecting presence of a person using multiple geofencing and wifi-based presence sensors. You don't have to think about the boolean operations involved. It just does it the best way based on the performance characteristics of the different sensor types.

https://community.hubitat.com/t/release-combined-presence

1 Like

Can i use this app in my android phone ? :wink:
if yes. How ?
thanks for help.

Try this driver instead:

Despite the name, it works for most android users as well.

The instructions for setup are in the first post (just like in this thread :wink:).

3 Likes

Is there an analogous driver for HTTPS?

Download the Hubitat app