How to receive a single alert?

How do I configure an alert to send a single message? I want a single alert when someone comes home. Currently I have to put a value in the repeat field so it comes more than once.

userhome:
name: User Home Alert
entity_id: device_tracker.awesomeuser
state: ‘home’
repeat: 60
notifiers:
- useremail

Have you tried repeat: 00?

Just tried that. I got 50 alerts in less than a minute before I killed the server. 00 must send it every second.

In that case, you should probably setup an automation to your notifier.

1 Like

I don’t see a way around this component to get a single notification.

I just did a test automation using pushbullet and it works instantaneously.

Hope this helps.

I suppose I could set the repeat timer to 9999999 minutes.

I was thinking the same, not ideal but may work.

Try with the automation, it works well.

I solved this problem by setting up a input_boolean and turning it off as the last step of my notification. Then I had an automation that turned the input_boolean on again if the input_boolean was set to off. You can have that second automation to turn the input_boolean on wait for a specific amount of time, but you probably don’t have to.

This has worked for me. If you need an example, say the word and I’ll throw one on here.

Please share your example.
Which is the easiest way, simplest to setup?

This is how I tested it with an Automation to Pushbullet:

### Test Notifier ###
- alias: Dad Is Home
  trigger:
    platform: state
    entity_id: device_tracker.my_device
    from: 'not_home'
    to: 'home'
  action:
    service: notify.notifier
    data_template:
      title: "TTS Test Dad Is Home"
      message: "Dad is home, because his phone is connected to the {{ states.device_tracker.my_device.state }} WiFi"

Not sure why you would use a template in the message if the trigger already checks that. It’s a minor thing but still performance wise it would be better to just hardcode ‘home’ in this case.

ONTOPIC: Automation is way simpler here. Please keep in mind that the alert component is only for simple things. But I can see that a only once function would be great.

~Cheers

Here’s my config. It checks every minute between 4PM and 5PM to see if it’s time to leave to pick up my kid based off of local traffic. After it triggers, it will continue to send alerts as all the trigger conditions will then evaluate to true. To rectify that, I set up an input_boolean to kill the alert by setting it as one of the conditions. It has worked perfectly. I can not really think of a better way to do this unfortunately as setting up a template trigger NEVER worked. I know that I have read others have had that issue as well when trying to setup triggers based off of templates. (Don’t know why… It’s puzzling because it should work??) Let me know if you need any help implementing this, we should be able to smash through any issues you run into.

- alias: Pick up Moose
  trigger:
   - platform: time
     minutes: '/1'
     seconds: '00'
  condition: 
   - condition: time
     after: '16:00'
     before: '17:00'
   - condition: template
     value_template: "{{ ((now().strftime('%H') | int) + (now().strftime('%M')|int / 60) | round(2)) >= ( 16.8 - ((states.sensor.dad_work_to_kid.state) | int / 60)) }}"
   - condition: state
     entity_id: input_boolean.moose_time
     state: 'on'
   - condition: state
     entity_id: device_tracker.iphone
     state: 'Office'
  action:
   - service: input_boolean.turn_off
     entity_id: input_boolean.moose_time
   - service: notify.notify
     data:
       message: "Leave to get Moose. It will take {{ states.sensor.dad_work_to_kid.state }} minutes."

Second Automation to turn input_boolean back on. You can do this after a time out, a state change, or whenever. I do it at 11:30PM to make sure it is ready for the next day.

- alias: Turn On Moose Time
  trigger:
   - platform: time
     at: '23:30'
  condition:
     condition: state
     entity_id: input_boolean.moose_time
     state: 'Off'
  action:
   - service: input_boolean.turn_on
     entity_id: input_boolean.moose_time
1 Like