Monoprice Door/Window Sensor as Smoke Detector Help

For the last few years I’ve used a DH to make an Open/Closed sensor behave as a smoke detector with a relay connected to my detectors. In the classic app, it worked flawlessly. Once I migrated, it stopped reporting. Anyone able to help me figure out how to apply an updated DH that works with the open/closed sensor from rBoy apps?

Here is the code that the smartthings technical agent wrote for me a few years ago.

/**

  • Z-Wave Door/Window Sensor
  • Author: SmartThings
  • Date: 2013-11-3
    */

// for the UI
metadata {
// Automatically generated. Make future change here.
definition (name: “Monoprice Door/Window Sensor as Smoke Detector v2”, namespace: “trostc”, author: “trostc”) {
//capability “Contact Sensor”
capability “Smoke Detector”
capability “Sensor”
capability “Battery”
//0 0 0x2001 0 0 0 7 0x71 0x85 0x80 0x72 0x30 0x86 0x84
fingerprint deviceId: “0x2001”, inClusters: “0x71, 0x85, 0x80, 0x72, 0x30, 0x86, 0x84”
}

// simulator metadata
simulator {
// status messages
status “clear”: “command: 2001, payload: FF”
status “detected”: “command: 2001, payload: 00”
}

// UI tile definitions
tiles(scale: 2) {
multiAttributeTile(name:“smoke”, type: “lighting”, width: 6, height: 4){
tileAttribute (“device.smoke”, key: “PRIMARY_CONTROL”) {
attributeState “clear”, label:‘${name}’, icon:“st.alarm.smoke.clear”, backgroundColor:“#79b821
attributeState “detected”, label:‘${name}’, icon:“st.particulate.particulate.particulate”, backgroundColor:“#ff1f1f
}
}

  valueTile("battery", "device.battery", inactiveLabel: false, width: 2, height: 2) {
  	state "battery", label:'${currentValue}% battery', unit:""
  }

  standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
  	state "default", action:"refresh.refresh", icon:"st.secondary.refresh"
  }

  main "smoke"
  details(["smoke","battery","refresh"])

}

}

def parse(String description) {
log.debug “parse:${description}”
def result = null
if (description.startsWith(“Err”)) {
result = createEvent(descriptionText:description)
} else if (description == “updated”) {
if (!state.MSR) {
result = [
response(zwave.wakeUpV1.wakeUpIntervalSet(seconds:4*3600, nodeid:zwaveHubNodeId)),
response(zwave.manufacturerSpecificV2.manufacturerSpecificGet()),
]
}
} else {
def cmd = zwave.parse(description, [0x20: 1, 0x25: 1, 0x30: 1, 0x31: 5, 0x80: 1, 0x84: 1, 0x71: 3, 0x9C: 1])
log.debug “parse:cmd = ${cmd}”
if (cmd) {
result = zwaveEvent(cmd)
}
}
return result
}

def sensorValueEvent(value) {
log.debug “sensorValueEvent:value = ${value}”
def result = null
if (value) {
result = createEvent(name: “smoke”, value: “clear”, descriptionText: “$device.displayName smoke is clear”)
} else {
result = createEvent(name: “smoke”, value: “detected”, descriptionText: “$device.displayName detected smoke”)
}
return result
}

def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd)
{
sensorValueEvent(cmd.value)
}

def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd)
{
sensorValueEvent(cmd.value)
}

def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd)
{
sensorValueEvent(cmd.value)
}

def zwaveEvent(physicalgraph.zwave.commands.sensorbinaryv1.SensorBinaryReport cmd)
{
sensorValueEvent(cmd.sensorValue)
}

def zwaveEvent(physicalgraph.zwave.commands.sensoralarmv1.SensorAlarmReport cmd)
{
sensorValueEvent(cmd.sensorState)
}

def zwaveEvent(physicalgraph.zwave.commands.notificationv3.NotificationReport cmd)
{
def result =
if (cmd.notificationType == 0x06 && cmd.event == 0x16) {
result << sensorValueEvent(1)
} else if (cmd.notificationType == 0x06 && cmd.event == 0x17) {
result << sensorValueEvent(0)
} else if (cmd.notificationType == 0x07) {
if (cmd.v1AlarmType == 0x07) { // special case for nonstandard messages from Monoprice door/window sensors
result << sensorValueEvent(cmd.v1AlarmLevel)
} else if (cmd.event == 0x01 || cmd.event == 0x02) {
result << sensorValueEvent(1)
} else if (cmd.event == 0x03) {
result << createEvent(descriptionText: “$device.displayName covering was removed”, isStateChange: true)
result << response(zwave.wakeUpV1.wakeUpIntervalSet(seconds:4*3600, nodeid:zwaveHubNodeId))
if(!state.MSR) result << response(zwave.manufacturerSpecificV2.manufacturerSpecificGet())
} else if (cmd.event == 0x05 || cmd.event == 0x06) {
result << createEvent(descriptionText: “$device.displayName detected glass breakage”, isStateChange: true)
} else if (cmd.event == 0x07) {
if(!state.MSR) result << response(zwave.manufacturerSpecificV2.manufacturerSpecificGet())
result << createEvent(name: “motion”, value: “active”, descriptionText:“$device.displayName detected motion”)
}
} else if (cmd.notificationType) {
def text = “Notification $cmd.notificationType: event ${([cmd.event] + cmd.eventParameter).join(”, “)}”
result << createEvent(name: “notification$cmd.notificationType”, value: “$cmd.event”, descriptionText: text, displayed: false)
} else {
def value = cmd.v1AlarmLevel == 255 ? “active” : cmd.v1AlarmLevel ?: “inactive”
result << createEvent(name: “alarm $cmd.v1AlarmType”, value: value, displayed: false)
}
result
}

def zwaveEvent(physicalgraph.zwave.commands.wakeupv1.WakeUpNotification cmd)
{
def result = [createEvent(descriptionText: “${device.displayName} woke up”, isStateChange: false)]
if (!state.lastbat || (new Date().time) - state.lastbat > 5360601000) {
result << response(zwave.batteryV1.batteryGet())
result << response(“delay 1200”)
}
if (!state.MSR) {
result << response(zwave.wakeUpV1.wakeUpIntervalSet(seconds:4
3600, nodeid:zwaveHubNodeId))
result << response(zwave.manufacturerSpecificV2.manufacturerSpecificGet())
result << response(“delay 1200”)
}
result << response(zwave.wakeUpV1.wakeUpNoMoreInformation())
result
}

def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
def map = [ name: “battery”, unit: “%” ]
if (cmd.batteryLevel == 0xFF) {
map.value = 1
map.descriptionText = “${device.displayName} has a low battery”
map.isStateChange = true
} else {
map.value = cmd.batteryLevel
}
state.lastbat = new Date().time
[createEvent(map), response(zwave.wakeUpV1.wakeUpNoMoreInformation())]
}

def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd) {
def result =

def msr = String.format(“%04X-%04X-%04X”, cmd.manufacturerId, cmd.productTypeId, cmd.productId)
log.debug “msr: $msr”
updateDataValue(“MSR”, msr)

retypeBasedOnMSR()

result << createEvent(descriptionText: “$device.displayName MSR: $msr”, isStateChange: false)

if (msr == “011A-0601-0901”) { // Enerwave motion doesn’t always get the associationSet that the hub sends on join
result << response(zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:zwaveHubNodeId))
} else if (!device.currentState(“battery”)) {
result << response(zwave.batteryV1.batteryGet())
}

result

}

def zwaveEvent(physicalgraph.zwave.Command cmd) {
createEvent(descriptionText: “$device.displayName: $cmd”, displayed: false)
}

def retypeBasedOnMSR() {
switch (state.MSR) {
case “0086-0002-002D”:
log.debug(“Changing device type to Z-Wave Water Sensor”)
setDeviceType(“Z-Wave Water Sensor”)
break
case “011F-0001-0001”: // Schlage motion
case “014A-0001-0001”: // Ecolink motion
case “0060-0001-0002”: // Everspring SP814
case “0060-0001-0003”: // Everspring HSP02
case “011A-0601-0901”: // Enerwave ZWN-BPC
log.debug(“Changing device type to Z-Wave Motion Sensor”)
setDeviceType(“Z-Wave Motion Sensor”)
break

}

}"

@vseven recently updated the ST DTH for smoke detector:

Maybe give that try?
https://github.com/vseven/SmartThings_VSeven/blob/master/devicetypes/vseven/modified-zwave-door-window-sensor-for-smoke-2.src/modified-zwave-door-window-sensor-for-smoke-2.groovy

I just added this new DTH and replaced the adjusted my device to use this new one and this one now works properly in the new app. Mine is an Ecolink Door/Window Sensor so didn’t have the tamper feature thus I had to use the ‘original’ for it to work. I did a test right after the change and it did work with the original app and SHM however I did notice that the status didn’t reset to clear. Not sure if that is a transient issue or not so I will monitor and retest. I haven’t converted to the new app yet so can’t speak to that functionality but the device is now actually working in the new app which is wasn’t before.

Thank you VSeven.

Thanks, Allen. DTH worked great. I can’t tell you how much I appreciate your work and really the work of the whole community to make my home automation dreams a reality. You all are awesome.

Hi - like several of you, I’ve been using Allen vseven great code for my two ecolink door sensors that I’ve connected to the Kidde smoke and CO detectors to give me smoke alarm functionality in SmartThings. Worked perfectly in the old app. I’ve migrated to the new app and realize it’s not working. I updated to the latest (August) version of the code - still not working

My Ecolink smoke and Ecolink CO door sensors both show up as connected, both show ‘clear’ and if I take off and on their plastic covers the tamper message gets to ST hub. But when I trigger the smoke or CO alarm they don’t report it in ST. It continues to show ‘clear’.
If I switch them back to the standard z-wave plus door sensor then it shows correctly as ‘open’ or ‘closed’ when I trigger the smoke alarm. So it seems to be something in the code or my setup

Anyone else having issues? Irritatingly in the new ST it appears to be working perfectly (shows as online, clear etc) - it just doesn’t trigger!

I had that issue and had to switch over to the tamper version of his DTH.

Thanks. What’s a tamper version / where do I find it? The GitHub repository only has one version for CO and one for Smoke

When this all started, there were two versions of the DTH that were published to https://github.com/vseven/SmartThings_VSeven. ‘smoke’ and ‘smoke 2’. the first ‘smoke’ didn’t work for me but the second one did.

Anyway - I just did a compare of the DTH that I have currently installed [smoke 2]and the ’ Update modified-zwave-door-window-sensor-for-smoke.groovy’ DTH that is currently posted at his github above and they are identical so that is the working version.

Thanks ThomasTrain. That was exactly my experience earlier in the summer - I moved over to the version 2 and they all worked fine back in August. But strangely they no longer work - they look like they work, but they stay in the ‘clear state’ even when triggered. I have three separate door sensors linked up, one for smoke, one for fire, and one that’s on a temp sensor using the same code as a trigger. All three have stopped working.
I’ll play around some more and see what I can find…

I just triggered mine and it is still working so I know the DTH still works.

Try manually shorting the contacts of your door sensor and see if it shows closed then, and triggers the smoke alert. If it does then your wires to the relay may have come loose or it’s always possible the relay itself has an issue.

If it doesn’t trigger when you manually short the contact then perhaps the contact sensor itself is faulty or maybe it just needs to be removed and reinstalled into the mesh.