I have written a few Apps for devices and haven't had this much trouble! I bought a Zooz ZSE11 and just want my subscribe for motion to use the callback handler():
#include thebearmay.localFileMethods
definition(
name: "Zooz3",
namespace: "Example",
author: "Hubi",
description: "Logs Sensor States",
category: "Convenience",
iconUrl: "",
iconX2Url: "")preferences {
section("MySensors") {
input name: "motionSensor", type: "capability.motionSensor", title: "motion", required: true
}
}def installed() {
log.debug "installed()"
}def updated() {
if (logEnable) log.debug "updated()"
unsubscribe()
subscribe(motion, "motion", handler)
subscribe(motion, "motionSensor", handler)
subscribe(motionSensor, "motion", handler)
subscribe(motionSensor, "motionSensor", handler)
subscribe(Motion, "Motion", handler)
subscribe(Motion, "MotionSensor", handler)
subscribe(motionSensor, "Motion", handler)
subscribe(motionSensor, "MotionSensor", handler)
}def handler(evt) {
log.debug "Entered handler" log.debug "getCurrentStates = " + evt.device.getCurrentStates()
}
def uninstalled() {
log.debug "uninstalled()"
}
I put several subscribes in to quickly find out which one would work (I got frustrated changing the single line for my subscribe). I then ran this and noticed when I moved my hand above the sensor the Live logs view of that Device show ACTIVE (about 30 seconds later it reported INACTIVE). I then went to the tab for this App and all it showed was "2024-01-03 04:45:17.461 PM debug installed()". I used an App titled "Get Attribute App" written by "csteele-PD". It produced the following:
What technique of debugging would you suggest to figure out how to get the subscribe to function properly?
Thanks