Help with DTH Code - Smartsense Open/Close Sensor Reporting Intervals


(Dean Smith) #1

Hi all,

I am trying to modify the standard code so it doesn’t report as often and saves me some battery life. I want to be sure I am doing it correctly! Here’s the code in question:

def configure() {
// Device-Watch allows 2 check-in misses from device + ping (plus 1 min lag time)
// enrolls with default periodic reporting until newer 5 min interval is confirmed
sendEvent(name: “checkInterval”, value: 2 * 60 * 60 + 1 * 60, displayed: false, data: [protocol: “zigbee”, hubHardwareId: device.hub.hardwareID, offlinePingable: “1”])

log.debug "Configuring Reporting, IAS CIE, and Bindings."
def cmds = refresh() + zigbee.iasZoneConfig(30, 60 * 5) + zigbee.batteryConfig() + zigbee.temperatureConfig(30, 60 * 30)
if(getDataValue("manufacturer") == "Ecolink") {
	cmds += configureEcolink()
}
// temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity
// battery minReport 30 seconds, maxReportTime 6 hrs by default
return cmds

I am completely confused by the commas and asterisks! What I want to do is try and have the battery report at it’s maximum, 6 hours and temperature at 5 min. Trying to save some battery life and cut down on the transmissions.

Thank you in advance for your help and insight!


(Nate Schwartz) #2

@Dean_Smith You can probably find some good information in this thread:

As far as I can tell, the way those methods work, the zigbee.temperatureConfig for example is they take two comma separated values, the min and max report intervals. Those values are in seconds which is why you see that weird notation 60 * 5 is 300s or 5 minutes. They just use that because it is easier to figure out how much time you are referring to, but you could just put 300 in there as well.

In your case I think the batteryConfig by default is at 6 hours max already, but you could change it to (30, 60 * 60 * 6) just to be sure. The temp appears to be set to 30 minutes max which according to that comment below is beyond the maxReportTime and therefore may not be valid.

Lastly, it looks like the device handler automatically checks in with the device every 121 minutes. I don’t have the rest of the DTH code, but I am pretty sure that is what the checkInterval value is. You could make that longer as well and see what happens.

EDIT: So looking more at that other thread, I think you can change the temp reporting to much longer than 5 minutes, that is likely just a default. I wasn’t sure at first because your code shows 30 minutes. So for example one hour temp reporting would be (30, 1 * 60 * 60).


(Dean Smith) #3

Thanks! I read that thread too and really became confused and decided to post a new thread! I got the same idea - I THINK it is this way but I am not sure!!