Virtual glass break sensor with switch

hi, i have some glass break sensors in abode which is connected to homkit which is connected to hubitat :-).

i want to create a virtual glass break sensor in hubitat and push it to homekit. i will mirror abode sensor in homekit and then it will show up in hubitat. i think the virtual device must also have a switch function to correctly function.

Does someone know where i can get a virtual glass break sensor with switch?

Looks like the built-in is defined as a Shock Sensor so try this:

Virtual ShockSensor
metadata {
	definition (name: "Virtual Shocksensor with Switch", namespace: "thebearmay", author: "Jean P. May, Jr.") {
		capability "Sensor"
		capability "ShockSensor"
        capability "Switch"
      }   
}

def on() {
    sendEvent(name: "switch", value: "on")
    sendEvent(name: "shock", value: "detected")
}

def off() {
    sendEvent(name: "switch", value: "off")
    sendEvent(name: "shock", value: "clear")
}

def installed() {
}
1 Like

Your great let me work with it. i think it will work.

1 Like