Exploring Smart Home Automation with Notifications and Triggers

I’ve been diving into the world of smart home automation lately, and I’m absolutely fascinated by the possibilities it offers. One feature that really caught my attention is the ability to set up actionable notifications using the wait_for_trigger action in Home Assistant. I came across some examples that showed how to create a simple Yes/No notification, but I wanted to take it a step further and integrate it into a real-life scenario.

Here’s the scenario I’m working on: I often forget to lock my door when I leave the house. I want to set up an automation that detects when I’m no longer at home and then sends me a notification asking if I’d like the door to be locked automatically. If I press “Yes,” the automation should proceed to lock the door. If I press “No,” it should either do nothing or perhaps send a reminder later.

I’ve started drafting some code, but I’m not entirely sure how to structure it properly. I’ve looked through the documentation and some community examples, but I’m still a bit stuck on how to handle the conditional actions based on the notification response.

Here’s what I have so far:
yaml
automation:
alias: Door Lock Reminder
trigger:
- platform: state
entity_id: input_boolean.i_am_home
to: ‘off’
action:
- service: notify.pushover
data:
message: “You forgot to lock the door. Should I lock it for you?”
data:
buttons: [‘Yes’, ‘No’]
- wait_for_trigger:
trigger:
- platform: event
event_type: notify_response
event_data:
message: “You forgot to lock the door. Should I lock it for you?”
action:
- service: lock.lock
entity_id: lock.front_door

I’m not sure if this is the right approach. Will the wait_for_trigger correctly capture the response from the notification? How do I handle the case where the user selects “No”? I’d love to hear from anyone who has experience with this or has implemented something similar. Your insights would be incredibly helpful!

This kind of automation would be a huge convenience, and I’m excited to get it working. It’s amazing how these small automations can make such a big difference in daily life. I can’t wait to see how this project turns out and how it can be expanded further. Thanks in advance for your help and suggestions!