When I bought my new home, I was very excited to finally be able to automate my garage cover. It always annoyed me when I had to push a button to open and close the garage cover, so I considered purchasing the Tesla Automatic Garage Opener for $325. But I simply couldn’t justify the cost for something that should have been a standard feature for the car. Moreover, this would have only worked on 1 car and if I get another car, I’ll have to figure out a different solution anyway. So I decided to purchase a smart garage control device instead, which lets me keep my opener unit but provides smart control via a mobile app. Luckily, I was able to grab one from myQ for free on Amazon Prime Day. This device is also compatible with Amazon Key in-garage delivery, so I can have Amazon deliver my packages to my garage securely.
Alexa, Homekit, Home Assistant
Although myQ doesn’t have official support for Amazon Alexa or Homekit, I was able to integrate it with Homekit through the open-source Homebridge plugin. It also has full support for MQTT, which is how I integrated myQ into Home Assistant instead of Home Assistant’s custom component so that there is only one integration that polls the myQ APIs. From Home Assistant I exposed the garage cover entity for Alexa, so I can also control the garage door with Alexa from the echo dot in my garage. (This obviously requires a passcode verification). With this setup, I can now use voice commands with Alexa and Siri, as well as write some sophisticated automations through Home Assistant.
Automations
Check out my post on getting started with Home Assistant, so you can have a better understanding of my setup and replicate it easily.
For some of the automations, I rely on the data provided by Teslamate. If you don’t want to set it up, you can use the Home Assistant component for Tesla for location instead.
In addition, I also have a proximity sensor configured in configurations.yaml
proximity:
home_tesla:
zone: home
devices:
- device_tracker.tesla_location
tolerance: 10
unit_of_measurement: mi
Open Garage Cover when coming Home
False Positives
This automation uses Tesla location as the trigger and only continues if the cover is not open, the direction of travel is not unknown, and when the tesla shift state is ‘D’ (Drive). This helps with eliminating false positives and doesn’t open the garage cover unexpectedly. An additional check also makes sure it wasn’t closed within the last 1 minute, which happens because if you are leaving the house, but since the zone is circular, you might be leaving and entering before finally leaving the zone. The automation that triggers the closing of the garage cover would have triggered within the last 1 minute if you were leaving the house, making this a false positive if you are trying to re-open the garage cover.
- id: '1629248639702'
alias: Arriving Home - Open Garage Cover
description: 'Open Garage Cover when coming home'
trigger:
- platform: state
entity_id: device_tracker.tesla_location
from: not_home
to: home
condition:
- condition: not
conditions:
- condition: state
entity_id: cover.garage_cover
state: open
- condition: not
conditions:
- condition: state
entity_id: proximity.home_tesla
attribute: dir_of_travel
state: unknown
- condition: state
entity_id: sensor.tesla_shift_state
state: D
- condition: or
conditions:
- condition: state
entity_id: proximity.home_tesla
attribute: dir_of_travel
state: towards
- condition: state
entity_id: proximity.home_tesla
attribute: dir_of_travel
state: arrived
- condition: template
value_template: "{%- if trigger.from_state.last_changed -%}\n {{ (as_timestamp(now())\
\ - as_timestamp(trigger.from_state.last_changed)) > 60 }}\n {%- else\
\ -%}\n true\n {%- endif -%}\n"
action:
- service: cover.open_cover
data: {}
entity_id: cover.garage_cover
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.tesla_is_user_present
to: 'off'
timeout: 00:10:00
- condition: device
device_id: 6aab8620e595ce209825683470e9ee0b
domain: cover
entity_id: cover.garage_cover
type: is_open
- device_id: 6aab8620e595ce209825683470e9ee0b
domain: cover
entity_id: cover.garage_cover
type: close
mode: single
Open Garage Cover when Leaving Home
This automation opens the Garage cover when the car is in garage and changes in to Reverse shift state indicating you want to back out of the garage. This requires Teslamat and won’t work with just the Home Assistant component. It also automatically closes the garage cover in 5 minutes or when the car changes into the Drive mode (Shifter state changes to ‘D’).
- id: '1629312819739'
alias: Leaving Home - Open Garage cover (Teslamate)
description: 'Open garage cover when you want to leave home and car is in garage'
trigger:
- platform: state
entity_id: sensor.tesla_shift_state
to: R
condition:
- condition: state
entity_id: device_tracker.tesla_location
state: home
action:
- wait_for_trigger:
- platform: state
entity_id: sensor.tesla_shift_state
to: D
for:
hours: 0
minutes: 0
seconds: 0
timeout: 00:05:00
- condition: device
device_id: 6aab8620e595ce209825683470e9ee0b
domain: cover
entity_id: cover.garage_cover
type: is_open
- service: cover.close_cover
target:
entity_id: cover.garage_cover
data: {}
mode: restart
Close Garage Cover when Leaving Home
This automation triggers every time someone leaves home, or an action was fired from iOS mobile notification.
- id: '1604392289616'
alias: Leaving Home - Close the Garage Cover
description: ''
trigger:
- platform: zone
entity_id: person.harshit
zone: zone.home
event: leave
- platform: zone
entity_id: person.heta
zone: zone.home
event: leave
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: CLOSE_GARAGE_COVER
condition:
- condition: device
device_id: 6aab8620e595ce209825683470e9ee0b
domain: cover
entity_id: cover.garage_cover
type: is_open
action:
- service: cover.close_cover
data: {}
entity_id: cover.garage_cover
mode: single
Forgot to close Garage Cover
This automation sends a mobile notification with action prompt to close the garage cover if it was left open for more than 5 minutes.
- id: '1606623107897'
alias: Alert - Garage cover left open
description: ''
trigger:
- platform: state
entity_id: cover.garage_cover
to: open
for: 00:05:00
condition: []
action:
- data_template:
data:
attachment:
content-type: jpeg
entity_id: camera.garage_snapshot
push:
category: camera4
message: It was left unlocked for 5 minutes
title: Forgot to close the garage cover?
service: notify.ios_family
- service: script.text_to_speech_notification
data_template:
media_player_entity: media_player.living_room
speech_message: Garage Cover is left open for 5 minutes.
mode: single
Alert when Garage Cover opens
This automation calls a script for text to speech notification, which plays a message on living room speakers. Combined with my other automation for previewing the driveway camera image on Netgear Meural, it is a very useful security feature that helps anyone in the house know what triggered the “Garage Opened” event.
This text-to-speech notification script checks if the speech notifications are enabled and if anyone is home before using Amazon Polly for text-to-speech conversion and playing the audio on my Sonos speakers.
- id: '1611615366724'
alias: Alert - Garage Cover Opened
description: ''
trigger:
- platform: state
entity_id: cover.garage_cover
to: open
condition: []
action:
- service: script.text_to_speech_notification
data_template:
media_player_entity: media_player.living_room
speech_message: Garage Cover is opening.
mode: single
Check out some of my other posts on automations and dashboards for Home Assistant for more ideas.
2 thoughts on “Smart Garage Cover”