I’ve been learning about PLEG and wanted to share my garage automation which I now have working. I originally had a lot of questions and things took a while to understand so thought that sharing my experiences would help out others.
I have a garage and a connected shop, each with a connected dimmer module and motion sensor. I also have a contactor connected to the garage door button and a tilt type garage door sensor.
There are several objectives:
- Close garage door if left open and if the garage is not occupied for more than a certain period.
- Automatically turn on garage light when I enter the garage, and then turn on the shop light if I go to the shop.
- Be able to turn off the lights manually at any time.
- Automatically turn off lights if left on and garage is unoccupied for more than a certain period.
- Utilize the garage door plugin which greatly simplifies the door operation.
Inputs
GarageDoorIsOpen = true if garage door plugin is unlocked
NoGarageMotion = sensor is not tripped
NoShopMotion = sensor is not tripped
GarageMotion = sensor is tripped
ShopMotion = sensor is tripped
ShopLightOn = light is turned on
ShopLightOff = light is turned off
GarageLightOn = light is turned on
GarageLightOff = light is turned off
Conditions
GarageIsUnoccupied = NoGarageMotion and NoShopMotion and (NoGarageMotion;NOW>5:00) and (NoShopMotion;NOW>5:00)
CloseGarageDoor = GarageDoorIsOpen and (GarageDoorIsOpen;NOW>5:00) and GarageIsUnoccupied
GarageReady = GarageMotion;NoGarageMotion
ShopReady = ShopMotion;NoShopMotion
TurnGarageOn = GarageLightOff and GarageMotion and GarageReady
TurnShopOn = ShopLightOff and ShopMotion and ShopReady
Actions
GarageIsUnoccupied = turn off both lights
CloseGarageDoor = lock garage door plugin to activate door close procedure
TurnGarageOn = turn on garage light
TurnShopOn = turn on shop light
Basically, everything seems to work as expected… Other things I am thinking about but could use input on:
Retry two times at 10 minute intervals and then notify me if door is still open.
Some notable things I learned in this automation:
- Simply stating the sequence NoXMotion;NOW>M:SS is insufficient to extend the time if occupied. My sensor stays triggered for 4 minutes and then needs to be triggered again. The above would be true M minutes after the reset turning the light of while the room may still be occupied. Therefore, “and NoXMotion” is needed to make the expression failsafe.
- I needed to add an expression that indicates that the garage door should have been open for more than 5 minutes. Otherwise it may close immediately after opening when a car arrives. (Wife comes home.)
- Needed to include the “ready” logic to only allow a light to turn on automatically after the motion detector resets it’s state. Otherwise the light would turn back on immediately after I tried to turn off manually.
- the garage door plugin rocks!
- PLEG is awesome once you figure out the behavior.
Interested in any expert feedback on better ways of implementation and other ideas people have done or would recommend or like to see me try.
Cheers!
PD