I’m receiving duplicate notifications for some of my automations. It used to work fine. I think this started happening in the past month or so, but I don’t have an exact date.
Here is one of the automations:
- alias: "Notify If New Backup Found"
trigger:
- platform: state
entity_id: sensor.last_backup
mode: single
condition:
condition: template
value_template: >-
{% set last_backup = states('sensor.last_backup') | as_datetime %}
{{ ((utcnow() - last_backup).seconds) < 60 }}
action:
- service: notify.mobile_app_ceres
data:
title: "System"
message: "A new Home Assistant backup was made."
data:
group: "system-backup"
url: homeassistant://navigate/lovelace/devices
And what I see:
At first, I thought there could be a race condition in the state engine, but I found very little evidence of anything even close to that – and I think the world would’ve been up in arms if that was the case. Regardless, I explicitly added mode: single
(even though it’s the default).
My current theory is that it might have something to do with when you can receive push notifications directly (when on your home network). Unfortunately, I’ve been too late to capture the companion app logs (truncated). I need to be quicker to export it when it happens again. Maybe the notification gets sent both internally and externally?
I’m sure the state the automation triggers on only changed once – at that time. The second change seen here was after an HA restart.
Zoomed in to 02:00 until 02:10.
I’m sure the automation only triggered once:
Server version: 2022.2.9 (I’m still planning my upgrade to 2022.3.x)
Companion app (iOS): 2022.3
I couldn’t find any related posts on the forum or on any of the relevant GitHub repos.