Author Topic: Myq garage door status  (Read 436 times)

Offline roelofzo

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Myq garage door status
« on: January 11, 2017, 10:42:42 pm »
I'm trying my first Lua script and its failing miserably.
i want vera to notify me if both phones are away form the ping sensors and the garage door is still open.
Code: [Select]
local lul_tmp = luup.variable_get("urn:schemas-macrho-com:device:MyQGateway:1","Status", 25)
  if (lul_tmp==0) then
    return True
else
    return False
  end


i put this code in the scene luup. from the garage door.  but it keeps sending me notifications door open or closed.
the door is closed now and variable Status = 1.
what am i doing wrong?
thanks!

Offline jswim788

  • Sr. Member
  • ****
  • Posts: 385
  • Karma: +14/-2
Re: Myq garage door status
« Reply #1 on: January 12, 2017, 09:40:33 am »
One issue is that variable_get returns a string, not a number, so you want to change your comparison to: if (lul_tmp=="0") then

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 697
  • Karma: +15/-0
    • Worthington Engineering, Inc.
Re: Myq garage door status
« Reply #2 on: February 20, 2017, 09:53:43 am »
I am using PLEG for this kinda of notification. No matter what mode, I get a notification every 10 minutes the garage door is open. First notification is the door is opened, and the 10 minute notification the door is still open.
Vera 3, UI7 1.7.947, CT101 t-stat, Everspring motion detector, GE/Jasco switch, Leviton outlet, AeonLabs door sensor, Insteon garage control, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual & Multi Switch, Weather, Sys. Mon.

Offline BOFH

  • Sr. Hero Member
  • ******
  • Posts: 2339
  • Karma: +107/-136
Re: Myq garage door status
« Reply #3 on: February 20, 2017, 11:09:44 am »
Under Ui7 the easiest way is to under 'AWAY' mode set the garage door to close. If you leave it open by any chance, as soon as all phones have left the home geofence and Vera switches from HOME to AWAY mode, she will automatically close the garage door for you.
Vera3 UI5 UI7 Edge Plus
Trane TZEMT400AB32 | Schlage BE369 FE599 | GE 45601 45602 45603 45604 45606 45609 45631 | Intermatic HA01C HA03C HA05C HA07C CA600 CA3000 | Aeon DSC06106 | Telguard GDC1 | Foscam FI8910W FI8905W FI9821W | D-Link 930L | Wanscam JW0011 | ZModo ZPIBH13W

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 697
  • Karma: +15/-0
    • Worthington Engineering, Inc.
Re: Myq garage door status
« Reply #4 on: February 20, 2017, 11:23:15 am »
I have had overhead doors go back up by themselves after I leave (not in my current house). My wife is so paranoid now she always waits until it is down before pulling away.  Which is why I have the reminder because I will not wait.
Vera 3, UI7 1.7.947, CT101 t-stat, Everspring motion detector, GE/Jasco switch, Leviton outlet, AeonLabs door sensor, Insteon garage control, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual & Multi Switch, Weather, Sys. Mon.

Offline cybrmage

  • Hero Member
  • *****
  • Posts: 975
  • Karma: +94/-5
Re: Myq garage door status
« Reply #5 on: February 20, 2017, 11:44:53 am »
Your issue is twofold...

1) You are using the wrong service ID... You are using the DeviceID for the plugin control device, not the ServiceID for the garage door device.
2) You are checking a string value to see if it has a numerical value (as already mentioned)

You should use:
Code: [Select]
local GarageDoorID = 25
local ServiceID = "urn:micasaverde-com:serviceId:DoorLock1"
local lul_tmp = luup.variable_get(ServiceID,"Status", GarageDoorID)
if (tonumber(lul_tmp,10) == 0) then
  -- the door is open
  return True
else
  -- the door is closed, or changing state or faulted
  return False
end

EVL3Vista - Wink Connect - Caseta Connect - Venstar Colortouch - MyQGateway