Deal on Z-Wave leak detector

On clearance, they must be moving to a different packaging or different product. Two stores went out of stock in these around me today before I could grab one.

I noticed a similar behavior; Iā€™ve fixed it by customizing the Everspring Flood device type to remove the wakeUpNoMoreInformation() command on the handling of the wakeup notification when asking for battery levels. I have also changed the ā€œtime intervalā€ check, as I noticed some inconsistent timestamps returned by the default code:
ā€¦

	if( parsedZwEvent.CMD == "8407" ) {
		def nowTime = new Date().time
		def ageInMinutes = state.lastBatteryQuery ? (nowTime - state.lastBatteryQuery)/60000 : 600
		log.debug "Battery status was last checked ${ageInMinutes} minutes ago"
		if (ageInMinutes >= 600) {
			state.lastBatteryQuery = nowTime
			log.debug "Battery status is outdated, requesting battery report"
			result << new physicalgraph.device.HubAction(zwave.batteryV1.batteryGet().format())
		} else {
			result << new physicalgraph.device.HubAction(zwave.wakeUpV1.wakeUpNoMoreInformation().format())
		}
	}

ā€¦

Apparently the sensor doesnā€™t like the rapid sequence of ā€œget battery levelā€, ā€œgo back to sleepā€ commands.
Now I get regular battery updates every 10 hours.

Thanks Minollo, Iā€™m having trouble cutting and pasting your code on the device Iā€™m on right now, so do you mind reposting using the CODE button right above the text box for new posts? Thanks! Iā€™m getting an error with the 3rd line in your code and it may be an issue on my end.

Here you go; let me paste the whole function, it may be safer:

def parse(String description) {
	def parsedZwEvent = zwave.parse(description, [0x9C: 1, 0x71: 1, 0x84: 2, 0x30: 1])
	def zwEvent = zwaveEvent(parsedZwEvent)
	def result = []

	result << createEvent( zwEvent )
 
	if( parsedZwEvent.CMD == "8407" ) {
		def nowTime = new Date().time
		def ageInMinutes = state.lastBatteryQuery ? (nowTime - state.lastBatteryQuery)/60000 : 600
		log.debug "Battery status was last checked ${ageInMinutes} minutes ago"
		if (ageInMinutes >= 600) {
			state.lastBatteryQuery = nowTime
			log.debug "Battery status is outdated, requesting battery report"
			result << new physicalgraph.device.HubAction(zwave.batteryV1.batteryGet().format())
		} else {
			result << new physicalgraph.device.HubAction(zwave.wakeUpV1.wakeUpNoMoreInformation().format())
		}
	}

	log.debug "Parse returned ${result}"
	return result
}
1 Like

Wow that was fast,thanks!

I tried your change but it didnā€™t seem to make a difference. Any suggestion what I may have done wrong?

Tough to tell; do you see anything in your logs for the device name you are trying to use? Every hour you should see a message telling you at least when the battery was last checked; maybe change 600 into 60 to make sure the battery report is requested at every hourly wake up during your tests.
Do you see anything in the event list for the device? You should see at least a ā€œ<device name> woke upā€ event more or less every hour.

I donā€™t see any event.

I see debug statements in the log.

Maybe Iā€™m missing a capability. What ones should I have checked?

I have Battery, Configuration, (I also have Polling, but itā€™s quite useless for this device), and Water Sensor.
This is the whole code Iā€™m running (a little cleaned up from what I shared above):

metadata {
	simulator {
		status &quot;dry&quot;: &quot;command: 9C02, payload: 00 05 00 00 00&quot;
		status &quot;wet&quot;: &quot;command: 9C02, payload: 00 05 FF 00 00&quot;
		for (int i = 0; i &lt;= 100; i += 20) {
			status &quot;battery ${i}%&quot;: new physicalgraph.zwave.Zwave().batteryV1.batteryReport(batteryLevel: i).incomingMessage()
		}
	}
	tiles {
		standardTile(&quot;water&quot;, &quot;device.water&quot;, width: 2, height: 2) {
			state &quot;dry&quot;, icon:&quot;st.alarm.water.dry&quot;, backgroundColor:&quot;#ffffff&quot;
			state &quot;wet&quot;, icon:&quot;st.alarm.water.wet&quot;, backgroundColor:&quot;#53a7c0&quot;
		}
		valueTile(&quot;battery&quot;, &quot;device.battery&quot;, decoration: &quot;flat&quot;, inactiveLabel: false) {
			state &quot;battery&quot;, label:&#039;${currentValue}% battery&#039;, unit:&quot;&quot;/*, backgroundColors:[
				[value: 5, color: &quot;#BC2323&quot;],
				[value: 10, color: &quot;#D04E00&quot;],
				[value: 15, color: &quot;#F1D801&quot;],
				[value: 16, color: &quot;#FFFFFF&quot;]
			]*/
		}
		standardTile(&quot;configure&quot;, &quot;device.configure&quot;, inactiveLabel: false, decoration: &quot;flat&quot;) {
			state &quot;configure&quot;, label:&#039;&#039;, action:&quot;configuration.configure&quot;, icon:&quot;st.secondary.configure&quot;
		}
		main &quot;water&quot;
		details([&quot;water&quot;, &quot;battery&quot;, &quot;configure&quot;])
	}
}

def parse(String description) {
	log.debug &quot;parse&quot;

	def parsedZwEvent = zwave.parse(description, [0x9C: 1, 0x71: 1, 0x84: 2, 0x30: 1])
	def zwEvent = zwaveEvent(parsedZwEvent)
	def result = []

	result &lt;&lt; createEvent( zwEvent )
 
	if( parsedZwEvent.CMD == &quot;8407&quot; ) {
		def nowTime = new Date().time
		def ageInMinutes = state.lastBatteryQuery ? (nowTime - state.lastBatteryQuery)/60000 : 600
		log.debug &quot;Battery status was last checked ${ageInMinutes} minutes ago&quot;
		if (ageInMinutes &gt;= 600) {
			log.debug &quot;Battery status is outdated, requesting battery report&quot;
			result &lt;&lt; new physicalgraph.device.HubAction(zwave.batteryV1.batteryGet().format())
		} else {
				result &lt;&lt; new physicalgraph.device.HubAction(zwave.wakeUpV1.wakeUpNoMoreInformation().format())
		}
	}

	log.debug &quot;Parse returned ${result}&quot;
	return result
}

def zwaveEvent(physicalgraph.zwave.commands.wakeupv2.WakeUpNotification cmd)
{
	log.debug &quot;WakeUpNotification&quot;
	[descriptionText: &quot;${device.displayName} woke up&quot;, isStateChange:  false]
}

def zwaveEvent(physicalgraph.zwave.commands.sensoralarmv1.SensorAlarmReport cmd)
{
	log.debug &quot;SensorAlarmReport&quot;
	def map = [:]
	if (cmd.sensorType == 0x05) {
		map.name = &quot;water&quot;
		map.value = cmd.sensorState ? &quot;wet&quot; : &quot;dry&quot;
		map.descriptionText = &quot;${device.displayName} is ${map.value}&quot;
	}
	map
}

def zwaveEvent(physicalgraph.zwave.commands.sensorbinaryv1.SensorBinaryReport cmd)
{
	log.debug &quot;SensorBinaryReport&quot;
	def map = [:]
	map.name = &quot;water&quot;
	map.value = cmd.sensorValue ? &quot;wet&quot; : &quot;dry&quot;
	map.descriptionText = &quot;${device.displayName} is ${map.value}&quot;
	map
}

def zwaveEvent(physicalgraph.zwave.commands.alarmv1.AlarmReport cmd)
{
	log.debug &quot;AlarmReport&quot;
	def map = [:]
	if (cmd.alarmType == 1 &amp;&amp; cmd.alarmLevel == 0xFF) {
		map.descriptionText = &quot;${device.displayName} has a low battery&quot;
		map.displayed = true
		map
	} else if (cmd.alarmType == 2 &amp;&amp; cmd.alarmLevel == 1) {
		map.descriptionText = &quot;${device.displayName} powered up&quot;
		map.displayed = false
		map
	} else {
		log.debug cmd
	}
}

def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
	log.debug &quot;BatteryReport&quot;
	def nowTime = new Date().time
	state.lastBatteryQuery = nowTime
	def map = [:]
	if (cmd.batteryLevel == 0xFF) {
		map.name = &quot;battery&quot;
		map.value = 1
		map.descriptionText = &quot;${device.displayName} has a low battery&quot;
		map.displayed = true
	} else {
		map.name = &quot;battery&quot;
		map.value = cmd.batteryLevel &gt; 0 ? cmd.batteryLevel.toString() : 1
		map.unit = &quot;%&quot;
		map.displayed = false
	}
	map
}

def zwaveEvent(physicalgraph.zwave.Command cmd)
{
	log.debug &quot;COMMAND CLASS: $cmd&quot;
}

def configure()
{
	zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:[1]).format()  // TODO: this nodeId is the hub&#039;s node id which isn&#039;t necessarily 1
}

def poll() {
	log.debug &quot;Polling - no op&quot;
}

Mine just reported the battery todayā€¦ Strange

I re-paired mine several times. 4th time or so, the battery level appeared as soon as I paired it.

Iā€™ve tried adding mine, and it definitely detects and reports water in the Activity Feed, but none of the built in SmartThings actions actually work (iOS Push Notification never comes; SMS never gets sent, Damage & Danger always reads ā€œEverything is OKā€).

The device itself actually beeps, and my IFTTT recipes trigger, so it seems like the iOS app/hub arenā€™t holding up their part of the deal. Ideally, itā€™d also trigger my Utilitech Alarm, but that thing hasnā€™t made one peep since I got it. I replaced the batteries in the water sensor, but not yet in the alarm.

Any ideas?