[UPDATED] iPhone WiFi Presence Sensor

What would you need to change the code to for option 2?

if (enableDevice) {
runEvery1Minute(refresh) // Option 1: test it every minute. Have a 10 second timeout on the requests.
//state.triesPerMinute = 1

//schedule("*/15 * * * * ? *", refresh)    // Option 2: run every 15 seconds, but now we have a 10 second timeout on the requests.
    state.triesPerMinute = 4
}

Does that look correct?

Not quite...

I think this is what the author intended

def updated () {
	log.info "${device.displayName}.updated()"
    
    state.tryCount = 0
    
	unschedule()
    
    if (enableDevice) {
        //runEvery1Minute(refresh)		// Option 1: test it every minute.  Have a 10 second timeout on the requests.
        //state.triesPerMinute = 1

	    schedule("*/15 * * * * ? *", refresh)    // Option 2: run every 15 seconds, but now we have a 10 second timeout on the requests.
        state.triesPerMinute = 4
    }
    
    runIn(2, refresh)				// But test it once, right after we install or update it too.
}

That is correct. And I purposely made it a code change, rather than an option in the UI, because even every 15 seconds could cause problems. You really need to try it out on your own network/wifi/router and see if there is any impact on either the performance of the HE hub, or the overall performance of your network.

3 Likes

Set your phone to static and lower refresh time.
Worked on my galaxy S8

I noticed that for some reason, It does not work on LAN devices. I cant see the code of the driver where I can change it . Also if I change the name on the app, will it affect future changes.
Or does this driver not self update.
Sorry, still a newbie to the platform.

What do you mean by LAN devices? When connected to WiFi, your phone is on your LAN.

Custom apps and drivers written by community members do not update on their own.

However you might be interested in the hubitat package manager, which substantially simplifies the process of keeping some apps and drivers up to date:

1 Like

No. This is the closest thing to an IP ping that I use to check if wired and wireless devices on my network are on. Based on their state I have certain redundancy measures in place to either reboot them or change modes..
Smartthings had host pinger.
But I find it interesting that all lan devices cannot be picked up

You need to search for the other driver for that there are 2 I think the other is called HTTP presence sensor.

1 Like

Not sure what you mean? Your phone is definitely on your LAN when it’s connected to WiFi...

I believe this driver relies on a response to an http get. It’s not an ICMP ping, so it won’t necessarily work with all devices on your LAN.

2 Likes

It really depends on what ports the device has open, and what response it returns to a GET on that port. This driver is optimized for the ways smartphones usually behave.

5 Likes

Thanks for your reply.
I'm trying to study the code but how is that so Specific to wireless devices. My devices on Ethernet do not show as present. Anyway to add or omit the code to be so specific.
I thought it looks for IP addresses and returns results based on the network?

Would this line of code be the culprit?
Not enough experience sorry

This depends on how something responds to a specific network command. It works for iPhones. If it also works for other network devices, (for example, some Android phones), that makes it more useful. If your device doesn't work, it's because it wasn't designed to work with your device.

Thats the thing. I tested on all my wifi devices so it has nothing to do with just Iphone.
I tested it on sonos, google home even my Onkyo on wireless, yet when I switch the Receiver to Ethernet, it shows not present.
If anyone could write a code or alter this to help with this, I would really appreciate it.
It is such A usefull app for redundancy. If something is offline, restart plug. If a few things are off, Start a different mode.
Is there nothing else one can recommend to get similar outcomes for devices on the network.
Ethernet devices are alot more reliable hence I am persisting on those.

I believe this driver actually attempts to connect to a web server on the device. It will either get a timeout (i.e. 'not present') or some sort of response from the device's built in web server (i.e. 'present').

If your network device is not running any app of port 80, it will probably just timeout and always produce a 'not present' result.

Is it only the Onkyo device that 'misbehaves' in this way? Any chance you're running multiple networks within your home?

Nop only one.
And all ethernet devices display the same "Not Present".

I just tested the latest version of this driver as shown below. It had no problem detecting my Windows 10 desktop PC which is hardwired Ethernet.

Any chance you're running with VLANs? Maybe multiple routers causing a double NAT situation?

This driver is for phones, why don't you try the one that is designed for other devices. It's called HTTP presence sensor or something. I use that for a ethernet device and it works perfectly.

Thank-you. I actually tried this and it worked for my onkyo yet now I see my PC like yours detects with iPhone presence.
Weird.
I will check my vlan but see it is actually only onkyo that is the problem.
Also I forgot about the 3 minute timer.
Is reducing it going to affect the hub by straining it?
Thank you guys for helping ME.

Download the Hubitat app