Synchronise two locks possible?

Hi,

I have a MyQ garage door which I can control from Vera using the MyQ app. This works well other than if the door is controlled by the original remote, it doesn’t update in Vera.

So I set about looking for a method that coil update. I found an App called Garage door which I’ve used on my other garage door and a gate and it works great, what it does is it uses a door / window sensor paired up with a relay to trigger the door to open or close. IF the sensor says it’s open and you tell vera to open the door, it will ignore the command because it knows it’s already open, the same for closed. So it works great. Also the status of the lock is automatically updated if the door / gate is opened / closed via a method other than Vera.

So I took to thinking if this could be used with my MyQ door. I got a tilt sensor from Vesternet and added it to the door, the sensor updates whenever the door is opened or closed. I then created another garage door via the app and added the sensor and the original MyQ lock as the sensor and relay for it. If I open the door manually with the remote, the lock updates in Vera which is exactly what I wanted. The downside is that if I click to open the lock it doesn’t tell the MyQ app to open / close the door.

So for example, the garage door app will show the door is locked, I click to unlock it, it shows that it’s sent a command and the lock temporarily shows that it’s unlocked, the command is send to the MyQ lock app but because it’s not a relay, it doe nothing, Moments later the Garage door app lock toggles it’s self back to showing locked again because that’s what the sensor is reading.

I hope everyone is still with me understanding what I’m talking about here.

So, what I want to do is one of the two following things.

  1. Some kind of code that automatically unlocks the MyQ lock when the garage door lock is unlocked. Sort if synchronising the two locks. This way, when I select the garage door and unlock it, the MyQ lock will automatically be unlocked too making it all work :slight_smile:

or

  1. Again have some kind of code that updates the MyQ lock stars based on the Door / window sensor, this way if the door is opened manually, the sensor would pick this up and the MyQ lock would be toggled to the appropriate status.

Being a completely newbie at Vera and home automation I have no idea how to do this or if it’s even possible!

I think and important feature to mention here is that if the garage door is open and the MyQ app is showing as locked, toggling the lock to unlocked does nothing, so we whodunit end up with a situation where door would get stuck in some weird loop where it kept opening and closing because eth sensor was telling the lock in the app to change state. It wood only change it to what the actual state is which would cause no harm.

Doe sony of the above make any sense what so ever to the people that know far more about Vera and Luup capabilities than I do?

I sure do hope so.

Thanks all and I look forward to your suggestions of how this can be achieved :slight_smile:

Look on these forums for the threads in which users have detailed their synchronization of lights. This would be no different, if I’m understanding correctly.

I’ll give that a go :slight_smile: thanks.

I managed to do this using the extremely useful Rules Engine plugin.
For those that haven’t seen it, it’s a bit like Pleg but has a really easy GUI to setup your rules. Really is a brilliant little plugin!

If the sensor has a “closed” and “open”, and you create a scene that uses sensor “open” as a trigger to send an “open” command to the MyQ door, that would A) allow you to open the door by “opening” the sensor and B) properly update the door status when the door is opened through the remote, a PIN pad, or even manually.

Hi Ember1205,

Thank of rtes reply, the reason I chose etch excellent (and simple) Rules Engine is that I tried a Scene and what happened was the MyQ door was getting a signal as soon as the sensor tripped, because it had just received a signal from the key fob or the button in the garage, it would get confused and stop. So I needed to delay updating the switch in Vera when the garage door opened, closing wasn’t an issue, only opening du not the fact that the sensor is at the top of the door, as soon as it reports to Vera that the door is shut, it is actually shut and the MyQ system has completed it’s motion. Where as with opening, the sensor is at the top of the door so the second it begins to open, Vera is updated at which point the door is still in the process of opening. So to combat the issue when opening I set a small delay in vera and this appeared to work fine.

Then later that day I accidentally pushed the open button on the key fob of rtes garage when I meant to open a gate, realised my mistake and immediately pressed close. Garage went up a short way then back down as you’d expect. I then went out. When I returned later, the garage was open. A little confused I then realised what had happened. The delay in the open setting of the switch had actually told vera to open the garage door, if its’ already open it has no effect, but if it’s shut as it would have been, it opens it.

The reason this happened is simple really, the door started to open so Vera was informed by the sensor and set it’s 30 second delay before changing the state of the lock in Vera, I immediately shut the door and that informed Vera causing it to set the lock as locked. A little while later the delayed setting of open caused the garage door to open!

Problem with scenes appears to be that once something is timed to happen, it happens no matter what!

In Rules engine, it’s different, a rule is set and it’s valid unless something changes, if something changes, the rule is cancelled and so is the delayed setting of the switch. So in my accidental pressing of the button, Rule sengien would have set a delay to set the Vera Lock as open, then I realised accident, close date door and the rule that cause the delayed setting of the switch would get cancelled.

I had something like this set for a sensor activated light, it kept getting switched off after 5 minutes because it was set to go off after 5 minutes with no activity but ignored that fact that there was activity AFTER the turn off had been set.

Rules engine works perfectly for me in my case.

I help that explains why I went down the Rules engine root

A) Using a time delay on detecting the “open” or sending the open command before sending Open to the door controller would eliminate the issue with it getting conflicting open commands. You might need to use a 30 second delay (see below) to ensure it worked properly.

B) You could write LUUP code that would start a delay loop and the cancel that delay loop if the sensor reported back that it was back to the Closed position.

The alternative is to just shorten the refresh window for the MyQ plugin to be able to detect the change in door status. Or, you could use a combination of the two. For example… I have LED shop lights in the garage that provide excellent lighting (the petty little bulbs in the opener are pretty poor). At night, when I open the garage door, I want the LED shop lights to come on. And, I want to set a timer to turn those lights off five minutes after the garage door is closed. Instead of relying on the state of the actual door for this, I could use a tilt sensor to trigger the scene. Shortening up the refresh window for the MyQ plugin would allow me to follow the state of the door properly, but I wouldn’t have a delay before the lights came on.

I hadn’t really thought about shortening the delay on the checks that the plugin does for door status. That may have worked. I have the door tilt sensor doing the same as you too, it turns the lights on when the door is open and turns them off again a few minutes after the door is closed again.

I’m completely new to all this so Luup is something I know nothing about currently. Hence using the Rules Engine plugin. I looked into Pleg but it looked overly complicated for what I wanted. I’m sure plug is extremely capable but for simple things like I wanted it was a little over the top. Rules Engine was simple, capable and had a nice simple GUI to visualise what I needed.

I’m sure I’ll start playing with LUUP as I add more devices and start creating more actions and triggers :slight_smile:

Thanks for the tips!

I have a scene called “Garage Door Open”. The trigger event for it currently is the actual door being “unlocked” (open). When that occurs, it runs this LUUP code:

local dID = 6 local allow = false local status = luup.variable_get("urn:rts-services-com:serviceId:DayTime","Status",dID) return ((status == "1") == allow)

That code works in conjunction with the Day/Night plugin to understand whether the sun is up or down. If it’s past sundown and the door goes up, it turns the lights on in the garage. Otherwise, it doesn’t bother because it’s daylight.

As a reference, the “local dID = 6” refers to the deviceID in my system of the Day/Night plugin. I also use this plugin as a trigger for other scenes to turn on the front lights, the light over the kitchen sink, etc. And, I reverse it to turn lights off once the sun comes up (a certain someone in my house has a tendency to leave the halogen floods on in the back yard when she takes the dogs out early in the morning in the winter and the sun isn’t up yet).

Since I don’t want to be polling the MyQ online account every 15 seconds to get door status updates (seems a bit ridiculous), I’m going to add a tilt sensor to my door and see how that goes. Once I do, I will likely write some LUUP code using variables to create the proper notifications and such.

A thought just occurred to me, too… It may be smart to simply poll the MyQ device when the tilt sensor is triggered instead of attempting to send open/close commands to the opener.

luup.call_action("urn:micasaverde-com:serviceId:HaDevice1","Poll",{},21) 

Sounds promising

Yeah, except I can’t get it to work right for me. :slight_smile:

I’d also wonder if the polling took a bit longer than setting it directly with the sensor?

Giving this scenario more thought now that I have a tilt sensor on my door.

I have a tilt sensor that I installed at the top of the second panel down on my door. I specifically did this because I wanted to avoid any “false” triggers from heavy winds and such (and wanted to provide a delay before the Vera would be notified of upward movement), and the second panel down will move far less than the top edge of the top panel would. My door is made up of four sections, so it’s a little more than 25% of the way down. It turns out that this position ALSO provides a delay between Vera being notified that the door is down and when the GDC actually finishes closing the door - key for my scenes.

Anyhow…

Since it takes a few seconds from button press until the tilt sensor detects that its orientation has changed (it has to travel straight up about 18" and then start to tilt), and since it will be back to vertical a second or two before the door is fully closed (especially since my opener “slows down” for the last four inches of movement), I could use an “immediate” action in the scene to trigger the corresponding action on the part of the regular GDC.

I now have four scenes that handle the opening and closing of the garage door as follows:

  • GDC Open-Tilt: This scene is triggered by the tilt sensor is horizontal and immediately sends the “open” command to the GDC.
  • GDC Close-Tilt: This scene detects that the tilt sensor is back to vertical and immediately sends the “close” command to the GDC.
  • Garage Door Open: This scene detects that the GDC is “unlocked” and triggers turning on the LED lights. LUUP code controls whether the lights actually turn on or not based on time of day (they’re allowed after sunset).
  • Garage Door Close: This scene detects that the GDC is “locked” and starts a five minute timer. After the timer expires, it turns the lights off.

I’ve tested the triggering and notifications, and it works EXACTLY the way that -I- want it to. If this sounds like the sort of setup you’re looking for, move your tilt sensor to the same area where mine is in order to have the door’s movement provide the built-in delays you would otherwise need from code programming.

My MyQ plugin is set to poll for authentication validation every 30 minutes (that’s a refresh value of 1800).