Prevent multiple repeated Push Bullet notification

i have a motion sensor to see when the kids are up in my office room. i just need to know when they are in there once. as of now, i get multiple messages every 10 or 15 seconds as seen below:

- action:
  - data:
      message: motion detected from DOME sensor
    service: notify.house_push
  alias: sensor motion
  condition: []
  id: '1513522579448'
  trigger:
  - entity_id: binary_sensor.dome_motion_sensor
    from: 'off'
    platform: state
    to: 'on'

how to get it, maybe once every 10 minutes? meaning if i get notified at 10:00 am, the next one will come at 10:10 am and not every 15 seconds?
ps, the code above looks kinda funky cause i used HA GUI to create the automation…

You could maybe use the alert component.

in case you’re not “happy” with Keith’s suggestion (no reason you shouldn’t :wink: ) you can use a condition:

    - condition: template
      value_template: '{{ (as_timestamp(now()) - as_timestamp(states.automation.sensor_motion.attributes.last_triggered | default(0)) | int > 600)}}'

1 Like

i will assume, i would put your code at the end of my configuration.yaml?
no changes to my automation.yaml, correct?
sorry for the late response. just was super busy with a newborn son. thanks for your help.

No you need to put this as a condition for each automation you want this to apply to. You’ll have to replace the automation name in the code to match the automation you want checked

ok. i think i understand you now. so finished code in automation.yaml would look like this:

- action:
  - data:
      message: motion detected from DOME sensor
    service: notify.house_push
  alias: sensor motion
  condition: template
      value_template: '{{ (as_timestamp(now()) - as_timestamp(states.binary_sensor.dome_motion_sensor.attributes.last_triggered | default(0)) | int > 600)}}'
  id: '1513522579448'
  trigger:
  - entity_id: binary_sensor.dome_motion_sensor
    from: 'off'
    platform: state
    to: 'on'

strange i only added the condition template in automations.yaml file and that didnt work. in fact, it hates so much that my access to my HA at http://192.168.1.202:8123/ shows up blank :frowning:
im using HA .60. not sure if that matters or not

you have a script error, should be like this:

- action:
  - data:
      message: motion detected from DOME sensor
    service: notify.house_push
  alias: sensor motion
  condition:
    condition: template
        value_template: '{{ (as_timestamp(now()) - as_timestamp(states.binary_sensor.dome_motion_sensor.attributes.last_triggered | default(0)) | int > 600)}}'
  id: '1513522579448'
  trigger:
  - entity_id: binary_sensor.dome_motion_sensor
    from: 'off'
    platform: state
    to: 'on'

You should test your code with hass --script check_config or the built in code checker in Configuration > General > Check Config. This error would have been highlighted thene

1 Like

I have notifications tell me when the weather has changed ( any state to any state). My problem is similar, about every hour I have the same state, mainly partlycloudy, repeating notifications. How can I change your script so I never get the same state repeated. Your script looks like it has a timer starting on the last trigger. I was thinking of making the timer so long that it does not repeat… like a day later. That way by then it will in fact change state.

Add another condition:

    - condition: template
      value_template: '{{ trigger.to_state.state != trigger.from_state.state }} '
1 Like