Hey @user5800 Are you able to see a virtual motion sensor in home kit? (I don't have home kit so no way for me to check this) if you can try using the below app code (copy and replace the existing app code) I added motion sensors, they seem to work (at least they sync the motion status)
Virtual Device Sync App Code
/**
*/
// Modified to add Motion Sensors By Michael G
public static String version() { return "0.0.1MSG" }
definition(
name: "Virtual Device Sync",
parent: "ahmedl-HubbaHubba:Virtual Device Sync Manager",
namespace: "ahmedl-HubbaHubba",
author: "Ahmed L",
description: "Updates Virtual Device to same state as Physical Device",
category: "Convenience",
iconUrl: "",
iconX2Url: ""
)
//https://docs2.hubitat.com/developer/driver/capability-list
//https://docs2.hubitat.com/developer/app/building-a-simple-app
//https://docs2.hubitat.com/developer/app/overview
preferences {
page(name: "mainPage", title: "Virtual Device Sync", install: true, uninstall: true) {
section("Contact Sensor") {
paragraph "Virtual Device Sync v${version()}"
input name: "physicalSensor", type: "capability.contactSensor", title: "When open/close is detected on...", submitOnChange: true, required: false, multiple: false
input name: "virtualSensor", type: "capability.contactSensor", title: "Then update state on this sensor ...", submitOnChange: true, required: false, multiple: false
}
section("Motion Sensor") {
paragraph "Virtual Device Sync v${version()}"
input name: "physicalmotionSensor", type: "capability.motionSensor", title: "When motion is detected on...", submitOnChange: true, required: false, multiple: false
input name: "virtualmotionSensor", type: "capability.motionSensor", title: "Then update state on this sensor ...", submitOnChange: true, required: false, multiple: false
}
}
}
def installed() {
log.info "installed()"
log.debug "installed()"
updated()
}
def updated() {
log.info "updated()"
unsubscribe()
app.updateLabel("${physicalSensor?.displayName} --> ${virtualSensor?.displayName} ")
app.updateLabel("${physicalmotionSensor?.displayName} --> ${virtualmotionSensor?.displayName} ")
subscribe(physicalSensor, "contact", contactHandler)
subscribe(physicalmotionSensor, "motion", motionHandler)
}
def uninstalled() {
log.info "uninstalled()"
unsubscribe()
}
def contactHandler(evt) {
log.info "contactHandler() called: ${evt.descriptionText} ${evt.device?.name}"
log.debug "contactHandler() called: ${evt.name} ${evt.value}"
if(evt.value == "open"){
log.info "Sending open() to ${virtualSensor.name}"
virtualSensor.open()
}
else {
log.info "Sending close() to ${virtualSensor.name}"
virtualSensor.close()
}
}
def motionHandler(evt) {
log.info "motionHandler() called: ${evt.descriptionText} ${evt.device?.name}"
log.debug "motionHandler() called: ${evt.name} ${evt.value}"
if(evt.value == "active"){
log.info "Sending active() to ${virtualmotionSensor.name}"
virtualmotionSensor.active()
}
else {
log.info "Sending inactive() to ${virtualmotionSensor.name}"
virtualmotionSensor.inactive()
}
}