General Issues With Presence Sensor And Pistons


#1

What’s shakin’ all?
Is anyone else seeing issues with the WebCoRE presence sensor and pistons?

The issue I’m seeing with the presence sensor is that it is randomly failing to update. When it does fail I have to open the webCoRE app and that forces an update. This had been working very consistently but has recently started the failing behavior.

The issues I’m seeing with my pistons seem to be centered on any pistons where I have a “wait” command in them. One waits 10 minutes and sends additional commands to my Nest thermostat. It will execute the first part of the piston but it won’t fire the second part. I have another that waits a period of time and then calls a second piston. Again, it will execute the first part but not the second. I can’t post any logs as I didn’t have them turned on. I do now though so I can see if I can spot the issue.

If anyone has any insight or things to try I’d be very grateful for any info.

Thanks in advance!
SS


#2

I’ve also seen some issues over the past couple weeks. Most recent issue was a few days ago, my WC presence sensor was showing away even though I was home. Opened up the webcore app on my iPhone which caused a refresh and presence updated immediately.


#3

Not sure if this will work or not, but you can ping your presence Device from webcore. One would think that would keep it “alive”. Maybe every 5 minutes ping device?


#4

I’ll give the presence ping a try… I set up a piston to ping each presence sensor every 30 minutes.
Will try and report back to this thread after a couple weeks of testing


#5

Did this work for you?

Wondering what the effect on battery is if you ping each device every x mins?

Thanks!


#6

I have worked around any possible battery drain by pinging my router instead of my phone. I simply loaded my router settings in my web browser, and looked for the page that shows which devices are connected. That is the page I use webCoRE to do a GET request, and if my phone is shown on that page, then webCoRE flips a virtual switch (which I am using as a presence sensor). It works like a champ, and I have not had a false reading for months now.

Obviously, this won’t work as a “At Work” sensor, but for an “At Home” sensor, it is rock solid.


Weird Presence Issue
Any way to control WebCoRE presence sensor with Alexa?
How to handle simultaneous conflicting events
#7

I am very interested in trying this out myself, since I’ve had my phone presence getting stuck at “arriving” at my house. I can follow what you’re doing all the way to

… and if my phone is shown on that page, then webCoRE flips a virtual switch…

What parameters are you using in the webCoRE GET request to “look for” your phone on the router’s devices connected page?


#8

When you are at home, use a PC browser to log into your router, and poke around the pages until you find a page showing what devices are connected to the router. Ideally, the page will list the MAC address of your phone. (so there is no false alarms) If you can find a specific page devoted entirely to your phone’s connection, even better! Pay extra attention to the keywords found on that page when your phone is found. Then turn off your phone and refresh the page to see what keyword has changed. You will need this info for the piston. (it is also a good way to make sure you have selected the right device from the list)

Once you found a webpage that works, and it updates correctly when you turn your phone off, copy that exact webpage, and paste it into your webCoRE piston something like:

Make a GET request to http://192.168.x.x/fullAddressHere with type FORM;
Set variable {deviceFound} = {contains($response,NameOrMacOrKeywordHere)};
IF {deviceFound} is true
THEN turn on simulated switch 'AtHome'
ELSE turn off simulated switch 'AtHome'

That is the basic concept. A few key points to keep in mind:

  • Replace ‘NameOrMacOrKeywordHere’ with the exact wording that can only be found on the webpage when your phone is connected to the router
  • My router only updates that page every 2-3 minutes when a signal is lost, but YMMV
  • My piston runs every 3 minutes. (it is reliable, but not instant)
  • I had to tell Android to not put WiFi to sleep (or the router will think I have left)
  • If you reboot your phone, there may be one trigger when the router can’t see it

To solve this last (minor) issue, I have made my piston a bit more complex. Now it has to have two ‘false’ reads in a row for it to trigger I have left.

To be honest, the hardest part of this process was finding the right webpage. My router has over 40 main pages, but about 150 more sub pages. It was on a tiny sub-page that I ended up going with. For me, it was:
Settings > LAN > Status > Active Devices > Find my phone in the list > Device Details
(but every router is different)


#9

I can’t wait to try this. I know exactly where this page is on my router; it lists MAC addresses as well. Will let you know if it works.


#10

Ugh. I have what I think is the right address. However I am getting this error (from the logs)

<head>
+120ms ║<meta http-equiv=‘Content-Type’ content=‘text/html; charset=utf-8’>
+120ms ║<title>401 Unauthorized</title></head>
+121ms ║<body onload=“document.aForm.submit()”><h1>401 Unauthorized</h1>
+121ms ║<p>Access to this resource is denied, your client has not supplied the correct authentication.</p><form method=“post” action=“unauth.cgi?id=2d2de042061be948b5460486fe6ee5d05ceb9cf3fa7e868ee7ac3762f7fb” name=“aForm”></form></body>
+121ms ║</html>

I think I need a way to add the login info into the post/ put request

Als if it’s suppose to be a get request, I can’t seem to find a way to do that as a form?

Advice?


#11

I just re-examined my piston, and the FORM is not visible any more.
(maybe removed in an update?)

This is the GET request that works for me:

temp

(that URL is extremely long)

One small observation, I am making the request to the default modem issued by my ISP, not my fancy router. I do not remember having any authentication errors when I set mine up. I assumed it was because my ST hub is already connected to the modem. (it already has access to it)

Also, I did not choose the page that listed all my devices. I found a page buried that listed only one device (based on IP or MAC address). I also set my phone’s IP to static in the modems settings, so the piston would not need editing in the future.


Immediately after my GET request, I dump the response into a string variable.
This helped me to pick thru what is visible to webCoRE.

temp