I did purchase a Zigbee occupancy sensor (not a motion sensor), and it added the device to the hub. However, I see no occupancy sensor drivers available, and I was wondering if I could create one. I did look at some of the custom driver codes, and I'm lost. I do have the API guide. However, I'm unsure how to debug what is coming from the clusters. I tried to parse using the following code.
def parse(description) {
log.debug "description is $description"
def event = ZigBee.getEvent(description)
if (event) {
log.debug event
} else {
log.debug "didn't get an event."
}
}
However, I don't see anything in the logs panel. Can someone please guide me to the correct path?
Hmm, I do have a question on logging, I just need to see what the device is doing and then find out how to code for the clusters. I cannot see anything in the Past Logs if I just use parse
Do you have a preference (or other variable) named logEnable, and is it set to true? If not, the log.debug line won't execute. You can remove that if, or you can add such a preference (or field, etc.) and set its value accordingly. If you're using a stock Hubitat driver example as your starting point, this corresponds to the "Enable debug logging?" preference and also automatically disables itself after 30 minutes, by the way.
If that's all correct, then your device just isn't reporting anything to the hub. For Zigbee, you will normally need to configure reporting on the desired clusters, and that's probably why. (The other possibility is that your device isn't paired or doesn't have a route to the hub, etc.) That is not my area of expertise, but it will require knowledge of either standard Zigbee clusters or whatever that manufacturer happens to use (which may not be those).
Nothing will show up in Past Logs if it wasn't there in Current Logs at some point (whether you were there to see it or not), but there shouldn't be any delay with Past Logs aside from the fact that, unlike Current Logs, it is not dynamically refreshed and just shows the contents at the times you loaded the page.
I'm not sure how familiar you are with Zigbee (I'm not much...), but the device will not send any reports to the hub unless it's configured to. This could be why you don't see what you're expecting in parse(). This is generally done in the configure() method in your driver, which is automatically called on pairing but can be manually run any time from the device detail page (e.g., if you modified this method and the relevant code wasn't in your driver originally). Improper configuration is my guess.
I'm running debug evey where. I'm not familiar with Zigbee coding. Your point on configuring the device is what I'm now looking at. I'll let you know. Thank you for pointing me in the right direction.