One time notifications

Sometimes I have the need to quickly set a notification on a state change, like for example:

  • Someone in the family is at a location and I want to know if he/she leaves (kids going for a night out for example)
  • I made an automation and I want to get notification when it was triggered to verify if all is working
  • Specific sensor check, like motion detection or camera movement detection
  • If my wife locked my car when she borrowed it… :slight_smile:
  • etc.

Ideally, I would be able to have a quick way to set a “notify me” option per sensor for only 1 time (or like a selection or something)

Would be interested to learn if more people have this desire and if it is something to consider adding as a feature?

Hello,

This is possible but with a workaround. Just create a helper (boolean) that will be on when you want to receive the notification. Booleans are like switches. So let’s assume that when the boolean is on, you will receive the notification. Then your notification automation should be:

Trigger:
Motion sensor or camera or whatever

Condition:
boolean is on

Action:

  1. send the notification
  2. turn the boolean off

This way, because the boolean is also in the condition, next time that the trigger will be triggered it will be off and the notification will not be sent.

Then, you can create another automation (it can be timed) to turn on the boolean again when you want to be receiving notifications.

I have such set up with my bed sensor… For example, when i go to bed, all lights are turning off and i receive a notification on my phone to set up an alarm. When i didn’t have the boolean in place, if i would stood up and go to bed again, i was receiving the notification again. I implemented the boolean and now i receive it only once when i go to bed.

I have another automation that turns the boolean on about 19:00 in the afternoon so when i go to bed i can receive again the notification.

Hope this helps
Kind Regards
M

Thanks Michael for your suggestion!

Your example will work in situations where you know upfront which sensor you would like to receive a notification on.

I was thinking more in general, like make this possible for any sensor whenever you want.

That would be a blueprint; it would allow you to:

  1. select the sensor
  2. specify the desired state to trigger on
  3. enter a notification message

When saved it would create a run-once automation that sends the notification when the sensor changes to the desired state.

Hi Taras,

Ah that is interesting, I never worked with blueprints before, I’m going to try this, thanks!
(So basically it should act as a template where the sensor is the variable right?)

My initial thoughts was to have something in the frontend where it would be a standard option for a sensor (seems more user friendly imho)

You’re welcome and here’s an example to get you started.

blueprint:
  name: One-Time Notification
  description: Notify when a given entity changes state.
  domain: automation
  input:
    entity:
      name: Sensor Entity
      description: The sensor entity to monitor.
      selector:
        entity:
          domain: sensor
    notify_title:
      name: Title
      description: The notification's title.
      selector:
        text:
trigger:
  - platform: state
    entity_id: !input entity
condition: []
action:
  - service: notify.persistent_notification
    data:
      title: !input notify_title
      message: 'Changed state to {{ trigger.to_state.state }}'
  - service: automation.turn_off
    target:
      entity_id: '{{ this.entity_id }}'

After you copy-paste it into a new blueprint file, it can be used to create an automation that monitors a selected sensor and posts a persistent notification when the sensor changes state and then disables itself.

The blueprint’s UI looks like this:

For more information, refer to the Blueprint Tutorial.

Super helpful!!

So once done I only need to reload the “automations” under development tools right?