Editing simulated presence sensor

As many others have done, I have created virtual switches for presence sensors. Here’s mt DTH :

metadata {

definition (name: "Brewston Simulated Presence Sensor", namespace: "brewston", author: "brewston", ocfDeviceType: "x.com.st.d.sensor.presence") {
    capability "Switch"
    capability "Sensor"

simulator {
	status "open": "contact:open"
	status "closed": "contact:closed"

tiles {
    standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
        state "off", label: '${currentValue}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
        state "on", label: '${currentValue}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#00A0DC"
    main "switch"

def parse(description) {

 def on() {
 sendEvent(name: "switch", value: "on")
 sendEvent(name: "contact", value: "open")

 def off() {
 sendEvent(name: "switch", value: "off")
 sendEvent(name: "contact", value: "closed")

I have automations to turn the virtual switches on/off and it’s working really well but I really wanted the text to say ‘Home/Away’ - I’ve tried changing the values (from on/off) in the DTH but I don’t see them reflected in the new app. Is there a way to do this ? Thanks

1 Like

You should just add a simulated presence sensor, rather than a switch. It’s an existing simulated device - no DTH needed. The nice thing about the simulated presence sensor is that it does show up in the app as a presence device, and you can include it in automations.

Here’s a trivial way to link one to the real thing.

Thank you ! I’d tried creating the device as Simulated Presence Sensor but I couldn’t see a way to toggle it in an automation. That Smartapp does it just fine.

There are a few other way to toggle the presence, including using a webCoRE piston. I already had that SmartApp so it was the easiest tool to use.