[OBSOLETE] GoControl Door/Window Sensor, Motion Sensor, and Siren DTH

I have a couple of the Monoprice Z-Wave Plus Open/Close door sensors. They work fine with the SmartThings Z-Wave Plus Door/Window sensor. But they do not work with this DTH. With this code it always displays open. Is everyone else able to get this code to work with the Monoprice sensors?

Kevin,
Is there any way you’d be able to modify this handler to use as integrated smoke detector on a gocontrol door sensor?

There’s a handler for the smokes in this thread:

But it was written for a schlage door sensor. It works for a few hours and then fails due to it being for the wrong device type.

You’d be my new best friend. :slight_smile:
I’m fine with hacking hardware, but I couldn’t code my way out of a paper bag.

@krlaframboise, I am using the Door/Window Sensor code for a Monoprice Open/Close sensor. However I would like to modify the code for things like Power detector, Water detector, etc. To do so, I have to display different messages depending on whether the sensor (internal contacts) is open or closed. I am looking at this part of your code, and would like to display different messages based on open or closed:

private createContactEvents(val, contactType) {
def contactVal = (val == 0xFF) ? “open” : "closed"
def desc = “Contact is $contactVal”

def result = []	

result << createEvent(name: "contact", value: contactVal, isStateChange: true, descriptionText: desc)

How would I create unique messages based on open or closed? Example, “Power is normal” and “Power has failed”

This DTH was written for the Linear/GoControl door/window sensors so I’m not sure if it will work with Monoprice. I believe there are a few other DTHs floating around that were written specifically for that product.

The DTH should either work or not work so if it’s working for a while and stopping, it sounds like you have a bigger problem, but this is how you would make it work like a smoke detector.

To change this to a smoke detector DTH, replace the “capability Contact Sensor” line with “capability Smoke Detector”.

Then the lines that say createEvent or sendEvent, you should replace the word “contact” with “smoke”. Then the words “open” and “closed” with “detected” and “clear”.

@krlaframboise, I do have the Monoprice Open/Close sensor working with this DTH, However I would like to send different messages based on open or close . See my post #43 above. Can you tell me how to modify the code to display different messages?

All you have to do is replace line:

def desc = "Contact is $contactVal"

with something like:

def desc = (val == 0xFF) ? "New description for open contact" : "New description for closed contact"

any chance to “decode” this for the noobs. What means what?

If you have a specific question I’ll try to help you out, but for general information on how a device handler is structured, please review the Device Handler section of the SmartThings Documentation.

Kevin,
is there a way to have it reverse the color logic for open/closed?
I’d like a version B of this handler, as I have a door that has a sensor to tell me if it gets closed. It is supposed to remain open for my cats. So on the one sensor I’d want to show “open” as green.

Also, when using the internal contact on the door/window sensor, how do you see the status? I realize it’s only going to show the primary device status on the things screen, but within the device, will it show a secomd open/closed tile for the internal contact, and is this enabled simply by connecting the terminals, or something in the software?

Swap the colors #79b821 and #ffa81e on line 95 and 99.

The main tile shows the state of whichever one changed most recently.

If you’re using a SmartApp like CoRE, you can use the “internalContact” and “externalContact” attributes to get their state independently.

All you have to do is connect the terminals.

Is anyone else having an issue with cold temperatures? I have my motion sensor outside, and once the temperature drops below 32 F, it starts reporting in the -20s.

Kevin, I swapped the color codes in lines 95/99 and there was no change. Ideas?

I haven’t seen this before, but I’ll look into it and get back to you.

Did you publish your changes?

I have 1. Gave up using it for motion so I stuck it in the garage. I was using the temp. in the summer to turn on an exhaust fan. Noticed it was -21 a few days ago.

Brought it in side and back to normal. I just use for temp. as the motion is so slow. For now - it tells me when the cat gets in the cat pan (and out).

@krlaframboise

I’m new to the forum
 Just installed your DHL (GoControl Contact Sensor v1.6.1). From what I read, it has built in support for the Monoprice ZWave Plus Door/Window Sensors? PN: #15270 (Correct me please if I am wrong on that)


I’ve noticed on the rboy DHL’er I am using (For Schlage Lock), I can goto the settings/properties of the device under My Home -> Things -> (device) -> COG WHEEL. And it will show me the DHL it is connected through.

How can I verify my door/window sensor is connecting through your DHL?

[quote=“fireheadman, post:60, topic:50728”]
How can I verify my door/window sensor is connecting through your DHL?
[/quote] If you go into your SmartThings IDE, https://graph.api.smartthings.com, under MyDevices,

The first two columns, find your device by its name, then second column shows the Device Handler Type (I think that’s what you mean by DHL, DHT?).

Here’s a better example, as it went quite a bit below freezing this morning. Looks like as soon as it hits 31 degrees or lower, it’s off by 52 degrees. I assume the device is reporting the temperature in Celsius, so possibly a bug in the Celsius to fahrenheit conversion.

Here is what is says:
The first 2 devices are using RBoys DHL, they reflect his DHL label for type
The next 2 I am unsure if these are using @krlaframboise DHL.

Hoping he might chime
 it is possible he is using the generic name for type in his code???

DHLs: