Force Change status of mobile presence sensor?

From what I can tell, the default Mobile Presence DTH doesn’t run locally so I ended up modifying it so that I could force the presence when needed.

I’ve been using it for a little while and haven’t had any problems so I just posted it to GitHub.

2 Likes

nice :slight_smile: works great ! Thanks.

If you’re home and you force it to not present, after a little while it should correct itself and go back to “present”, but it’s useful for short term situations like the ones you mentioned.

so it will continue to work (change presence automatically) like the “stock” device type but your code has the force option?

Correct, I added code that raises the “present” and “not present” events when those buttons are pushed, but I didn’t modify any of the original code that handles determining presence.

How do I add this? I tried as a Smart App and it didnt like it.

You need to install it in the “My Device Handlers” section. Once you install and publish it, go to the “My Devices” screen, select the mobile device that you want to use it on, click the edit button, and then select the new device handler from the “Device Types” field.

Ahhh, dangit, I should know this by now, sorry.

Okay, appears to work, but you loose the battery status and the ability to make the sensor ‘beep’ so it can be found if lost.

It sounds like you’re trying to use it with the SmartSense Arrival Sensor, but this DTH is for Mobile Presence.

The presence on my Mobile Phone acts up frequently, but I’ve never had that problem with my arrival sensor.

I could easily add this functionality to the arrival sensor, but it would no longer run locally and I’m not sure if that would have any affect on it’s reliability or battery life. If you still think the ability to override the state is worth it, let me know and I’ll make the same changes to the arrival sensor DTH.

Well, crap! Forgive me yet again. I had just assumed that Presence Sensor and Arrival Sensor were one in the same. So that is on me and I apologize.

However, the reason I was trying it out is that the wife and I work near polar opposite hours, so it’s difficult to set up and test different rules and automations. I’m using the CoRE rules engine to do all this. So when I saw this post I thought wow, here is the perfect thing to test the automations based on presence whether we are here or not.

So, yeah, it has some practical applications, at least to me, in that respect. I had, in fact, already printed out the code for the Arrival Sensor and the code for this (Forced Status Change) trying to do a stare and compare to see if I could do something.

By the way, can you tell me what DTH stands for? I think I have also seen SMH as well but have not been able to glean what they mean from the usages I have seen here.

When you’re testing things, it’s often a lot easier to create a virtual device.

Go to the devices page in the IDE, click new device, leave the zigbee id field empty and enter whatever you want into the name, label and device network id fields. Choose a device like “Simulated Presence Sensor” from the “device type” field.

DTH: Device Type Handler
I think you mean SHM and that one means Smart Home Monitor.

Geeesh, I’m learning so much from this thread. Thank you for that input. I was not aware I could create virtual devices for such things and purposes. Off to the races I go then.

Thank you again so much for the input and help.

This code is very good for testing mobile presence based activities / routines. No more driving around in my car. I am surprised this wasn’t published before.

Big thanks to Kevin.

I got this working on my device and am able to change the status but it does not update itself. Any idea what the issue may be? I am away from home (23 miles away), I update the status to “Present” and it does not change back to “Away”. I am leaving it for 30 minutes but nothing changes.

Any idea?

It’s an issue with your phone not knowing you are back or that you left. My suggestion is to restart phone. If it continues , use IFTTT to trigger your presence rather than the smartthings.

This is awesome. Thanks for this!

Very cool, thanks for the DH. This should have been built into the official DT since it’s so unreliable. Ty

1 Like

This DH works great. I have on child with a cell phone that does not have Cell service on it. He only uses the phone on Wi Fi. If you takes his phone to his dads and finally connects to his wi fi, most of the time is will then say he is not at my house. But lately this has NOT been working. His bedroom is in the lower level of our house. I have a Thermostat for the level. The Thermostat is control by his Presence. If he is home, the Thermostat will raise Temp. If not home, Thermostat will decrease. This of course will only work if his Presence Sensor is working. He left for the weekend and Smartthings says he is still at home. Now with this DH, I can force his departure. LOVE IT… Thanks so much.

1 Like

Can IFTTT trigger a presence? I added a simulated presence device and authorized it in IFTTT. I can see it as a trigger (“this”), but I don’t see an option to change the presence in “that.”