[Release] - 'Switchable' Contact Sensor Driver

As a follow on from this thread:

I use a number of these modified contact sensors as switches.
So I've created a contact sensor driver which can also be used as a switch.
Although I made it for the Foxx Project contact I'm sure it can work with the Aeon contact sensor along with many other Z-Wave contact sensors

You have the ability within the driver settings to configure the switch to be on when the contact is open or closed.

You can find the driver here:

https://github.com/CobraVmax/Hubitat/tree/master/Drivers/Contact-Switch


Updated 21/08/2018
Added the ability to 'force' open or closed and open/closed is also now reversible


Andy

2 Likes

Awesome!!
I used a self-modified version of @krlaframboise contact sensor driver... but it had a bunch of states that I didn't need for my application (power detection). I didn't have the time to sort through this code and remove the unnecessary parts. This looks like exactly what I need. Many Thanks!

Works perfectly...but...it didn't report on/off until I manually hit the off button in the driver.
I've had this issue with one of my drivers in the past...I didn't have my logs open to verify this is the same issue but something tells me there was an error regarding a null value for the attribute until I manually set it.

You may need to add the configure capability that creates a default on off state. This can be called from the install/update methods if not already there...buy also let's the user manually call it by hitting configure.

Just a suggested "feature" for a great driver. Thanks again for this.

1 Like

Just uploaded version 1.3.0 to github

See 1st post for details

Andy

Just found this driver and it's just what I needed for use with the Aeotec Dry Contact Sensor since it reports what I consider to be reversed information in the standard driver. (ie ...it shows open if the circuit is shorted and closed if it is open) My question/issue is about the switch state reporting and may possibly have to do with what @stephack mentioned above. I noticed the switch state only changes if I hit the button in the driver. It never changes with the contact state. Am I missing something in how I'm thinking this feature is used?

The driver was originally modified to work with a Foxx Project door contact
Then I found out that the same driver is used for a number of Aeon devices.

However, it's not but on the configuration side.
I would install you device using the standard built-in driver.
Then save and click 'Configure'
This should send the correct commands to the device to configure itself.

After about a minute or so you can change the driver to mine and save

Now.. this is where it works or doesn't'
You need to click all the buttons (open/close/on/off etc) toggling them on/off with about 10 seconds between toggles. - Also toggle the reverse switches before saving again :slight_smile:
After that try using the open/close magnet on the device to see if it works (may take a couple of goes before it works.

If everything is ok, then at that point when the sensor is opened/closed it should change all the other attributes.
If not... then I'm afraid the driver will not work with your device .

Andy

1 Like

Got it! Thanks for the response. I don't actually need the switch functionality so it may yet work for me anyway. I will do as you suggest though and test that out.

Followed your instruction and it does work for me now. Thanks again!

@Cobra how easy would this be to convert it in to a presence device e.g.

Closed = Present
Open = Not present

All the best

Do you want a virtual driver that accepts on and off commands and sets present and not present? If so, that's simple.

However, if you have an existing physical contact sensor, and want to have it appear as a presence sensor, you have two options.

  1. If you have the source code for the driver, then we can easily modify it to send events for presence whenever the contact sensor status changes.

  2. Otherwise, you can easily use Rule Machine to set the status of a virtual presence sensor device whenever the physical contact sensor changes state,

If this driver works well with your device then it can easily be converted to show present/not present for open/closed.

Does this driver work with your device?

Andy

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.