Event created without apparent reason, should not happen


#1

Hello, I have this device type:

This is the relevant code snippet:

	if (cmd.notificationType == 0x06) {
		def dateTime = new Date()
		def sensorStateChangedDate = dateTime.format("yyyy-MM-dd HH:mm:ss", location.timeZone)

		if (cmd.event == 0x16) {
			log.debug "open"
			events << createEvent(name: "contact", value: "open", descriptionText: "$device.displayName is open.", translatable: true)
			events << createEvent(name: "sensorStateChangedDate", value: sensorStateChangedDate, descriptionText: "$device.displayName open/close state changed at $sensorStateChangedDate.", translatable: true)
		} else if (cmd.event == 0x17) {
			log.debug "close"
			events << createEvent(name: "contact", value: "closed", descriptionText: "$device.displayName is closed.", translatable: true)
			events << createEvent(name: "sensorStateChangedDate", value: sensorStateChangedDate, descriptionText: "$device.displayName open/close state changed at $sensorStateChangedDate.", translatable: true)
		} else {
			log.debug "Unknown contact event '${cmd.event}'."
		}
	}

sensorStateChangedDate event should only be created if there’s an open or close event
However, sometimes it is created from 0x17 (closed) branch without having open or close reported by device, there’s no close or open reported in recent activity only sensorStateChangedDate.

Unfortunately it happens at random times for me so I couldn’t yet capture a debug log because log times out in browser after a while and never happened yet when I’m logged in, I only got the recent activity in Android app.

Has anyone got any recommendations what to look at?


Mydlink™ Home Door/Window Sensor DCH-Z110