Less than 2 Hours + Less than $200.00 = 2 Garage Doors and 1 Gate Automated + plus one very happy family who can use Alexa to operate

I thought I would take a minute and share the results of my work yesterday. I spent less than 2 hours installing and configuring (the fine folks who support us on these forums really made this possible) my 2 garage doors and my homes front sliding driveway gate.

I embarked on this project for a couple of reasons:

1 – We (as a family) have had issues leaving the front gate and sometimes a garage door open after we have turned in for the evening)

2- We are constantly in and out and have friends over frequently who like to join us for swimming. The traffic in and out of the garages with full hands made a hands free option desirable.

Now, I probably spent a bit more than some might have from this community, but the desire to design and implement quickly drove my purchases. I wanted to limit the amount of additional scripting, and unfamiliar hardware so I could focus on the interaction with OH, and not worry about the equipment not firing or communicating because of my knowledge of the 3rd party code.

I can tell you that upon completion, my entire family is wondering how we got along without it. The WAF on the Alexa controlled gate and garage doors is quite high. I love the fact that now if the gate or garage door is left open, I’m alerted while I’m watching the evening news.

This project may not be rocket science, and definitely could be done for less $$$ but it was a great illustration on how to work with many different components of OH, and learn how they all can communicate to create automation not just remote control. I’ll be adding more complexity as I move along…I just thought by sharing this endeavor others who may be intimidated by the complexity may feel a bit more empowered to move forward and give it a try.

My current OH Setup:

  • Dedicated Windows Server 2012 Running OH 2.0
  • Aeon Gen 5 Z-Wave USB Stick
  • HUE Emulation Binding Installed
  •   EXPIRE Binding Installed
    
  • SONOS binding so that alerts can be made (TTS) in the house
  • Latest SNAPSHOT of the Z-WAVE binding in my Addons folder

Shopping List:

FS20Z-1 (32.75)

To trip the relays on the front gate and garage doors, I purchased 3 FS20Z-1 Z-Wave Isolated Contact Relays, with just 5 wires (hot, neutral ground, 2 x relay) they were a breeze to set up.

TILT-ZWAVE2-ECO (25.00)

These are the sensors that I used to report back whether the garage doors are open or closed. These sensors are battery driven and mount on the top panel of the garage door. They have a ball baring in a tube that at the first sign of tilt changes the status of the sensor. So far they are very reliable and can tell even when the garage door is open just a bit – this is why you mount them high up on the top door panel.

DWZWave2.5-ECO (30.00)

This is the sensor I used to monitor the status of my front gate. Like the garage door sensors it too is battery driven. This model is also Z-Wave plus which claims to offer better range than traditional Z-Wave devices – I choose this because of the distance between my front gate and the house.

All of these devices were added to OH before I began the installation - I’m making the assumption you know how to add a Z-Wave node (device) to OH. Inclusion needs to take place near the controller so I brought all of the devices to my server and hooked up temporary power and joined them to the system.

Miscellaneous Stuff

No project like this would be complete without a stop at one of the big box hardware stores for a few supplies – for me it was Home Depot.

I purchased the following items:

3 - Blue Single Gang Electrical Boxes (Deep Depth) to house the FS20Z-1 relays

1 - Non-Metallic Clear Cover for the blue box holding the FS20Z-1 on my front gate (it’s exposed)

1 - Extra bag of Butt-Splice Connectors (I was out)

The Install:

This was surprisingly easy and quick.

I tackled the gate first. I have a Chamberlin LiftMaster Slide Gate Operator. This operator is powered by 120v AC current and has a radio receiver connected to it to allow users to trigger the gate with your typical garage door type opener. When reviewing the manual I was easily able to determine where the radio receiver was connected to the operator and to use those same connection points for the 2 blue wires (relay) on the FS20Z-1. It is important to note that you should disconnect power to the gate operator while making these connections. If you happen to short (touch) the wires connected to the relay point while making your connections the gate will begin to open/close. Please be safe and remove power while installing.

I also traced in the electrical service as was able to connect and tie in the black, white, and green wires of the FS20Z-1 for power.

I mounted one of the blue boxes on the bottom of the operator and installed the FS20Z-1 there. The non-metallic cover was installed so that it would provide protection from the elements and so I could see the power indicator from afar. Please only use a non-metallic cover and box so that you do not interfere with the Z-Wave radio reception.

The sensor for the gate was attached to one of the gate posts, with the magnetic portion attached to the gate. I had a decent size gap between the sensor and the magnet and I needed to place a spacer to close up the gap behind the magnet.

To test the connection of your newly installed FS20Z-1, restore power to the gate operator and FS20Z-1, and push the small white button in the middle – the gate should begin to move. One thing you will notice is that the green light will go out – this indicates that the switch is “ON” you will need for the light to be on when you program OH, so press the button again so that the green light turns back on, meaning the switch is off. We will need to use a special binding in OH to account for this…I’ll talk about that in the switch (item) section.

Next it was on to the Garage Doors.

Here, I mounted the sensors first. To begin, I uncoupled the garage doors from the opener and watched how they traveled when opened. What I was looking for was the first position I could notice a tilt at – this was at the top of the first panel of my garage door. I marked the position and then attached the sensor, if I listened closely I could hear the small baring roll as I moved the door up. This allows to get notification if the door is just an inch or so off the ground. Since my garage doors are behind a gate I could live with this inch or so gap – if this doesn’t work for your scenario you might want to look at a magnetic sensor that will alert you the moment the garage door opens.

To install the FS20Z-1 I mounted one of the blue boxes to the support poles of the opener by drilling 2 holes through the blue box. I then inserted a zip tie and was able to latch the box to the support with the tie. For power I utilized the open outlet next to where my garage door motor was plugged into on the ceiling. To power the FS20Z-1 I found an old computer power cable and cut off the end that plugs into the computer. I then cut it to length and inserted the cut end into one of the knock out holes in the back of the blue box. Here it became simple connect the colors – black to black, white to white, and green to green. I used butt-connectors to perform the splices.

To tie in the relay I again went to the manuals, I own Marantec M4500 openers (German made – imagine that :grinning:) Here it was easy to determine that the terminals to connect the relays to (the same used for a wall switch) were numbers 3 and 4. I fished two small wires into the motor head and connected them. I then brought those two wired up and into the blue box through the same knock out hole and connected them to the two blue wires on the FS20Z-1. It does not matter which wire connects to which terminal.

It is important to note that you should disconnect power to the garage door opener while making these connections. If you happen to short (touch) the wires connected to the relay point while making your connections the door will begin to open/close. Please be safe and remove power while installing.

To test the connection of your newly installed FS20Z-1, restore power to the garage door opener, plug in the FS20Z-1 to power and push the small white button in the middle – the door should begin to move. One thing you will notice is that the green light will go out – this indicates that the switch is “ON” you will need for the light to be on when you program OH, so press the button again so that the green light turns back on, meaning the switch is off. We will need to use a special binding in OH to account for this…I’ll talk about that in the switch (item) section.

I then repeated this install on the other garage door.

Now it’s on to connecting everything up in OH…

First the ITEMS….

I used CONTACT items for the sensors, I used SWITCH items for the relay
A couple of items to note:

  1. I need the switch on the relay to act as a momentary switch (turn on then turn back off) to accomplish this I utilized the expire binding which was set to issue an OFF command 1 second (1s) after turning on.
  2. To accomplish this momentary switch in the sitemap I needed a button – that is why you see the autoupdate=”false” to prevent the switch from updating it’s status.
  3. I wanted to add Alexa control to the items, which is why you see [ “Switchable” ] in the item. This allows Alexa to discover this device as long as you have activated the HUE Emulation.

For the Gate, I had two – the relay and the sensor:

Contact GateStatus "The Gate Is: [%s]" { channel="zwave:device:xxxxxx:node5:sensor_door" }
Switch FGate "Front Gate" [ "Switchable" ] { channel="zwave:device:xxxxxx:node4:switch_binary",expire="1s,command=OFF",autoupdate="false" }

For the Garage Doors, I had four – two relays and two sensors:

Contact LtGarageDrSensor "Left Garage Door Is: [%s]" { channel="zwave:device: xxxxxx:node9:sensor_door" }
Contact RtGarageDrSensor "Right Garage Door Is: [%s]" { channel="zwave:device: xxxxxx:node8:sensor_door" }
Switch RtGarageDr "Right Garage Door" [ "Switchable" ] { channel="zwave:device: xxxxxx:node6:switch_binary",expire="1s,command=OFF",autoupdate="false" }
Switch LtGarageDr "Left Garage Door" [ "Switchable" ] { channel="zwave:device: xxxxxx:node7:switch_binary",expire="1s,command=OFF",autoupdate="false" }

Now for the SITEMAP.

To give myself the push button control, I added the mappings=[ON=“OPEN/CLOSE”] to the relays – this along with the autoupdate=”false” provides that UI element.

sitemap default label="House Control" {
    
    Frame label="Front Gate Control"{
    	Text item=GateStatus icon="gate2"
		Switch item=FGate icon="gate2" mappings=[ON="OPEN/CLOSE"]
		    }
	Frame label="Garage Control" {
			Text item=LtGarageDrSensor icon="garage"
			Text item=RtGarageDrSensor icon="garage"
            Switch item=LtGarageDr icon="garage" mappings=[ON="OPEN/CLOSE"]
			Switch item=RtGarageDr icon="garage" mappings=[ON="OPEN/CLOSE"]
			 }

RULES

For the rules, I used the following to alert us if the garage doors or gate were left open past a certain time. I also plan on adding additional rules as we see what else we may need to implement. I had a though of closing the doors and gate automatically at a preset time but abandoned that thought due to safety concerns. I just don’t want the possibility of having the gate hit a car or a person…I’m sure there are additional sensors I could deploy to monitor this but I do not feel this is necessary.

Garage.Rules

// Garage Rules

rule "close left reminder"
when
   Time cron "0 0 22 1/1 * ? *"
then
   if (LtGarageDrSensor.state.toString == "OPEN") {
      say ("The left garage door has been left open")
   }
end

rule "close right reminder"
when
   Time cron "0 1 22 1/1 * ? *"
then
   if (RtGarageDrSensor.state.toString == "OPEN") {
      say ("The right garage door has been left open")
   }
End

Gate.Rules

I have two rules for the gate because leaving the gate open is much more of a concern than the garage doors. There probably is a smarter way to implement this with just a single rule – but I am still working my way through the rule language.

rule "gate left open1"
when
   Time cron "0 05 22 1/1 * ? *"
then
   if (GateStatus.state.toString == "OPEN") {
      say ("The front gate has been left open")
   }
End

rule "gate left open2"
when
   Time cron "0 35 22 1/1 * ? *"
then
   if (GateStatus.state.toString == "OPEN") {
      say ("The front gate has been left open")
   }
End

With all of this in place in under two hours I feel like I have made great use of a Saturday morning and my path to home automation has moved forward and provided a playground from which I can continue to improve. I’m aware that true automation is having tasks happen without human interaction – I’m getting there, but I also see automation as convenience and this is sure is pretty darn convenient.

I’m sure I have left something out here…and I may not have done everything the correct way (please suggest corrections) and also feel free to ask any questions.

I have received so much from those who participate here in the community, I wanted to try and give a little bit back.

Squid

16 Likes

This is great! I’m just setting up OH today on a Pi, and Garage door alerts/operation is high on my list. Thanks for the great write up!!!

Nice, btw I have a similar rule to remind me if the garage door has been open too long. Instead of a cron job, it schedules a reminder for 60 mins after the door opens. If the door closes, the timer is reset.

var Timer garageTimer

rule "Garage open too long"
when 
	Item GarageDoorContact changed to OPEN or
	Item GarageDoorContact changed to CLOSED
then
	if(garageTimer != null) {
		garageTimer.cancel
        garageTimer = null
    }
    
    if(GarageDoorContact.state == OPEN){
		garageTimer =  createTimer(now.plusMinutes(60)) [|
			sendNotification(email,"WARNING Garage Door has been open for an hour")
	      ]
      }
      
end
5 Likes

First, thank you for doing this. It is a great intro into Openhab and gave me the confidence to go mainly with the command line. I am using Raspberry Pi and Openhab2.

I am trying out this project and currently only have the switch. The sensor is on its way but couldnt wait to get started. I setup the Zwave usb stick and paired the switch (all items were the exact models that you included in your tutorial). I added the switch as a thing in the PaperUI but used the command line to add the Sitemap and items.

The problem I have is that I dont think the off command is working. If the switch is off (green light off on switch) I can successfully use the button to open/close the door. However the green light stays on. If I manually change the switch to off it works again.

Below is my default items and sitemap. On my actual system the xxxxxx has the appropriate value.

Any advice where I messed up?

default.items
Switch GarageDr “Garage Door” [ “Switchable” ] { channel=“zwave:device:xxxxxxx:node2:switch_binary”,expire=“3s,command=OFF”,autoupdate=“false” }

default.sitemap
sitemap default label=“home” {

    Frame label="Garage Control"{
                    Switch item=GarageDr icon="garage" mappings=[ON="OPEN/CLOSE"]
                     }

}

Did you install the EXPIRE binding? You didn’t mention it so that’s what first caught my attention. The EXPIRE binding is what turns the switch back off after the x seconds.

Go to PaperUI / Addons / Bindings and make sure you have the EXPIRE binding installed

I also would set your expire time to 1s instead of the 3s you have in your item…the EXPIRE command is making the momentary on/off switch behave the way you want it to.

Squid

1 Like

Works perfectly now. I didnt know what the expire binding was for but I do now. :slight_smile:

Thanks for your help.

Just got the sensor. I paired the sensor with my zwave controller and loaded into openhab. The problem I am getting is that it is showing up as an unknown device.

Any trick to getting it working?

It’s a battery powered device you need to toggle the button a few times so it will wake up and send the configuration information.

Woohoo I am nearly there, it took quite a few tilts to get it recognized. It shows up in the paper UI. One thing I noticed is that it does not show up as sensor door but:

zwave:device:xxxxxx:node5:sensor_binary

I also have alarm_power, alarm_access, alarm_burglar and battery-level

The device is listed as TILT-ZWAVE2.5-ECO Z-wave Plus Gold Plated Reliability Garage Door Tilt Sensor

When I go into the Paper UI I get a blank next to “Garage Door is”

Also very wierdly when I have the device attached my garage door and try to close the door it stops mid way during closing. If I remove the sensor everything works perfectly.

My items reads
Switch GarageDr “Garage Door” [ “Switchable” ] { channel=“zwave:device:xxxxxxx:node2:switch_binary”,expire=“1s,command=OFF”,autoupdate=“false” }

Contact GarageDrSensor “Garage Door Is: [%s]” { channel=“zwave:device:xxxxx:node5:sensor_binary” }

My Sitemap reads
Frame label=“Garage Control” {
Text item=GarageDrSensor icon="garage"
Switch item=GarageDr icon=“garage” mappings=[ON=“OPEN/CLOSE”]
}

I have not setup any rules.

Your sitemap and item codes look just like mine…the one thing I notices and this may be due to the fact you did not use code fences when you pasted your code is that the quotes are smart quotes and not code quotes (smart quotes turn in and out)

You said it is blank in PaperUI what about in other UI’s? Sometimes you need to open or close the door for it to report.

This is how I look in PaperUI

image

Frame label="Garage Control" {
                        Text item=GarageDrSensor icon="garage"
            Switch item=GarageDr icon="garage" mappings=[ON="OPEN/CLOSE"]
                         }

Switch GarageDr "Garage Door" [ "Switchable" ] { channel="zwave:device:xxxxxx:node2:switch_binary",expire="1s,command=OFF",autoupdate="false" }

Contact GarageDrSensor "Garage Door Is: [%s]" { channel="zwave:device:xxxxxx:node5:sensor_binary" }

My unit shows up as TILT-ZWAVE2.5-ECO Z-wave Plus Gold Plated Reliability Garage Door Tilt Sensor

Z-wave Plus Gold Plated Reliability Garage Door Tilt Sensor

The only time I am seeing anything in the logs is when I open and close the sensor box

2018-02-19 19:36:52.083 [me.event.ThingUpdatedEvent] - Thing ‘zwave:device:xxxxxx:node5’ has been updated.

When I tilt the sensor nothing seems to happen on openhab. I hear the ball moving and the light flash but nothing else

Edit: Ok, I pulled the battery and put it back in and now I am getting it show up in paper UI. It shows the door as triggered and untriggered. I can set rules up from here to make it more obvious on what is open and what is closed. (Open = triggered, closed = untriggered)

Trying to dissect what is happening here. In my HabPanel I can see the state of the garage door. Wierdly in paperui it shows as Triggered/Untriggered and HabPanel as On/Off.

Trying to create rules but what I am missing is the tilt sensor status showing up in the openhab logs. I dont know how it is possible for me to get the item status in HabPanel but not hit the log.

You’re checking the event log, correct?

Yes. The event log that is automatically installed with openhab

tail -F /var/log/openhab2/openhab.log /var/log/openhab2/events.log

Very wierd the only thing I am getting from the tilt sensor in the logs is the 4h update

2018-02-21 13:00:48.015 [me.event.ThingUpdatedEvent] - Thing ‘zwave:device:xxxxx:node5’ has been updated.

The tilt sensor is the only battery operated device I have. All of the others are powered and the events show up in the log

2018-02-21 07:49:16.353 [vent.ItemStateChangedEvent] - HadrianBed changed from ON to OFF

Is it possible for the device to work in HabPanel and not show an event?

I’m going to go open my garage door and see what I get in the logs…brb

@JWilson2835

I can confirm I do see events in the log when the door changes from closed to open and again from open to closed.

2018-02-21 20:26:17.661 [vent.ItemStateChangedEvent] - RtGarageDrSensor changed from CLOSED to OPEN
2018-02-21 20:26:52.751 [vent.ItemStateChangedEvent] - RtGarageDrSensor changed from OPEN to CLOSED

Are you sure the device is fully discovered?

Squid

This is how it looks in paperUI

Mine is a bit different…

We may want to ask the Zwave guru @chris if this could be why the sensor is not reporting back the way we are expecting it.

If by “this” you mean that the generic class is different, then no, this will make no difference. The node class types are not really used by the binding. The important thing is the command classes as these specify how to communicate with the device.