I would like to create an automation that detects if my garage port is left open for 5 minutes and, if that’s the case, send me a message to my phone somewhat like this: “Garagedoor is still open, should i close it?” . i would like to have 2 choices in that message, 1. “Close garage” which trigs my shelly to close the garage. and 2. “leave open”, which then does nothing.
I have really tried to read and study in order to understand how to make this automation, but i still have no clue… (bad understanding from me…) Can someone please help me out with this? its the notification that makes me struggle.
My devices are.
Shelly1 which controls the garageport. (switch.shelly1_garageport)
Aqara door sensor (binary_sensor.garageport)
an iPhone which i want to be notified.
Please experts, help me out!
how should i set this automation up?
as far as i can understand and to my knowledge this is what i have done, and still it does not work, do anyone see any clear mistakes in the code?
This is in the config.yaml file
- id: '1607970342761'
alias: notifiera när garageport är öppen
description: ''
trigger:
- platform: state
entity_id: binary_sensor.garageport
to: 'on'
for: 00:03:00
condition: []
action:
- service: notify.mobile_app_patriks_telefon
data:
title: "Garageport öppen!"
message: "Garageporten har vart öppen i 3 minuter, vad ska jag göra?"
push:
category: 'garage1'
- id: '1608053706257'
alias: öppna garageport
description: ''
trigger:
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: CLOSE
condition: []
action:
- type: turn_on
device_id: dd13dc9b512b6ec26c17629288cb043f
entity_id: switch.shelly1_garageport
domain: switch
mode: single
When i try to run the automation, nothing at all happens, as it seems, at least no push notification is sent to my phone, and then of course, no actions either.
So might be late here but I have set up the exact same scenario for my garage. The main difference is that I am using Android vs iOS so you would need to match it up. I am also keeping the notification persistent so it will stay up until the garage closes. Here are my 3 automations. If you want to wait 5 min, just put 5 in the ‘For’ part of the first automation.
Notify when garage is open for
alias: Notify if garage is open
description: ''
trigger:
- entity_id: cover.garage
platform: state
to: open
condition: []
action:
- data:
data:
actions:
- action: close
title: Close
tag: garage
persistent: true
sticky: 'true'
color: red
message: Garage is open
service: notify.mobile
mode: single
Close garage on notification action
alias: Close on notif action
description: ''
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: close
condition:
- condition: state
entity_id: cover.garage
state: open
action:
- service: cover.close_cover
data: {}
entity_id: cover.garage
mode: single
Clear notification
alias: Clear garage open notification
description: ''
trigger:
- platform: state
entity_id: cover.garage
to: closed
condition: []
action:
- service: notify.mobile
data:
message: clear_notification
data:
tag: garage
mode: single