Hi all,
I’m having a couple of issues with an automation that automatically opens my over-head garage door. It will open my garage door under these conditions:
- I press the open door now button within 4 minutes of being close to home (i.e less than 1.5 km)
- I arrive home home within 4 minutes (i.e. my phone connects to my home wifi)
Problem is:
-
I added some conditions in the “if” part to check to see if the garage door is already open/opening before it opens it…but having that condition leads to the else action of cancelling the door opening, even though the garage door is closed and no action was taken. I’m not sure why or where to put the condition to check if the overhead garage door is open/opening right before then call service send the command to open the overhead head garage door. I do not want the command to be sent if my overhead garage door is already open or opening.
-
On timeout scenarios, there are errors that are logged related to this. Not sure why these are showing up:
Logger: homeassistant.helpers.template
Source: helpers/template.py:535
First occurred: 8:18:06 AM (2 occurrences)
Last logged: 8:18:06 AM
Template variable error: 'dict object' has no attribute 'event' when rendering '{{ wait.trigger is not none and wait.trigger.event.data.action == action_stop }}'
Template variable error: 'dict object' has no attribute 'event' when rendering '{{ wait.trigger is not none and wait.trigger.event.data.action == action_open }}'
Here’s the automation and script:
Automation
alias: Open Overhead Garage Door when Approaching Driveway
description: Open Overhead Garage Door when Approaching Driveway
trigger:
- platform: numeric_state
entity_id: proximity.my_name
below: "1.5"
condition:
- condition: state
entity_id: proximity.my_name
attribute: dir_of_travel
state: towards
- condition: state
entity_id: cover.overhead_garage_door_controller
state:
- closed
- closing
- condition: state
entity_id: device_tracker.android
state: not_home
action:
- service: script.notify_android_actionable_auto_garage_door
data: {}
mode: single
And the associated script
Script
alias: Notify Android Actionable Auto-Garage Door
description: Sends an actionable notification to ZX1 about opening the overhead garage door
sequence:
- alias: Set up variables for the actions
variables:
action_stop: "{{ \"STOP_\" ~ context.id }}"
action_open: "{{ \"OPEN_\" ~ context.id }}"
- alias: Ask what to do about opening the overhead garage door
service: notify.mobile_app_sony_xperia_zx1
data:
message: >-
Your overhead garage door will automatically open if you arrive home
within 4 minutes.
data:
channel: Garage
tag: garage
actions:
- action: "{{ action_stop }}"
title: Stop
- action: "{{ action_open }}"
title: Open Now
- service: notify.mobile_app_sony_xperia_zx1
data:
message: TTS
data:
tts_text: >-
Your overhead garage door will automatically open if you arrive home
within 4 minutes.
- alias: Wait for a response or trigger
timeout: "00:04:00"
wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ action_stop }}"
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ action_open }}"
- platform: state
entity_id:
- device_tracker.android
to: home
- alias: Perform the action on button press or timeout
choose:
- conditions:
- condition: template
value_template: >-
{{ wait.trigger is not none and wait.trigger.event.data.action ==
action_stop }}
sequence:
- delay: 1
- service: notify.mobile_app_sony_xperia_zx1
data:
message: clear_notification
data:
channel: Garage
tag: garage
- service: notify.mobile_app_sony_xperia_zx1
data:
message: Your overhead garage door auto-open service has been cancelled.
title: Overhead Garage Door
data:
channel: Garage
notification_icon: mdi:garage-alert
- service: notify.mobile_app_sony_xperia_zx1
data:
message: TTS
data:
tts_text: >-
Your overhead garage door auto-open service has been
cancelled.
- conditions:
- condition: template
value_template: >-
{{ wait.trigger is not none and wait.trigger.event.data.action ==
action_open }}
- condition: state
entity_id: cover.overhead_garage_door_controller
state:
- closed
- closing
sequence:
- service: cover.open_cover
data: {}
target:
entity_id: cover.overhead_garage_door_controller
- delay: 1
- service: notify.mobile_app_sony_xperia_zx1
data:
message: clear_notification
data:
channel: Garage
tag: garage
default:
- if:
- condition: template
value_template: "\"{{ wait.trigger is not none }}\""
- condition: state
entity_id: cover.overhead_garage_door_controller
state:
- closed
- closing
then:
- service: cover.open_cover
data: {}
target:
entity_id: cover.overhead_garage_door_controller
- delay: 1
- service: notify.mobile_app_sony_xperia_zx1
data:
message: clear_notification
data:
channel: Garage
tag: garage
else:
- service: notify.mobile_app_sony_xperia_zx1
data:
message: TTS
data:
tts_text: >-
Your overhead garage door auto-open service has been
cancelled.
- service: notify.mobile_app_sony_xperia_zx1
data:
message: Your overhead garage door auto-open service has been cancelled.
title: Overhead Garage Door
data:
channel: Garage
notification_icon: mdi:garage-alert
- delay: 1
- service: notify.mobile_app_sony_xperia_zx1
data:
message: clear_notification
data:
channel: Garage
tag: garage
mode: single
icon: mdi:garage
any ideas what is going on? thanks for your help.