Hi all!
I’m new to this community and have used Hassio a couple of months now and I love it!. Now I’m stuck with an problem, dont know if its even possible to accomplish what I’m trying to do, but if it is I hope some one can push me in the right direction.
I have a Gogogate 2 and two garage doors, now I’m making an automation that sends me an HTML5 push notification when my door open and a new notification when the door is closed. I have also added actionable buttons so I can close my doors directly from the notification when I leave my home.
That part is working great, but what I would like to accomplish is to only have one action button in the notification that gives me the option to close only the door that just opened, so my question is, is it possible to use templating in the “actions” part of the notification (data_template), if so…where do I start?
Code from my notify.yaml
- alias: Notification Garage Door
trigger:
- platform: state
# from: 'closed'
# to: 'open'
entity_id: cover.cover1
- platform: state
# from: 'closed'
# to: 'open'
entity_id: cover.cover2
condition: []
action:
- service: notify.html5_notification
data_template:
message: >
{{ now().strftime("%H:%M") }}: Garage door {{ trigger.to_state.name }} is now {{ trigger.to_state.state }}
data:
actions:
- action: "car1"
title: "Close door 1"
- action: "car2"
title: "Close door 2"
I guess I could accomplish what I want with two different automations, but my goal is to have fewer automations (and learn how to use templating)