Virtual Presence Device - Control from SmartPhone

So, I have the virtual presence sensor setup as a widget w/ Sharptools, but the problem is, i need a seperate widget for present and away, is there anyway to code this as a toggle instead of like with light switch on/off function?

Yes see the code in the first post, that what it does, toogle presence with a switch like functionality.

Yeah, it works like that within the app, but for some reason, not with Sharptools. Maybe @joshua_lyon can help. :slightly_smiling:

@nomisr you could create a custom Device Type Handler (DTH) with a custom toggle() command, then change your existing simulated presence device to use the new DTH:

https://raw.githubusercontent.com/iamcanadian2222/SmartThingsPublic/master/devicetypes/smartthings/testing/simulated-presence-sensor.src/simulated-presence-sensor.groovy

Edit: Updated the method definition to togglePresence()
 for some reason toggle() would work in the simulator, but not from other SmartApps.

Awesome! It works now! Thanks!

@joshua_lyon curious, I noticed you’ve defined arrived and departed - are these ST required interfaces or custom interfaces?

Anyone noticed that the Simulated Presence Sensor code is no longer available in the sample codes or GitHub.
@jody.albritton do you have any insight into why it was pulled?

I’m sorry to “hijack” the thread, but I created a device type That allows you to control presence with a switch. It works with SharpTools.

I can no longer manually toggle my simulated presence devices in the mobile app
 I can still do it via SharpTools.

1 Like