Notification not send

Hi,

I have an automation to check status of my water and gas-meter. The meter is from Smartgateways. The automation checks the sensor gasmeter_lastchanged. This keeps track of changes received from MQTT. Approx. every 30 seconds an update is received over MQTT.
So I want a notification when this sensor is above 30 seconds for over 15 minutes so I know that I need to check.
I created this YAML code:

alias: Gasmeter alive check
description: Check of gasmeter nog live is en na 15 minuten een mail
triggers:
  - entity_id:
      - sensor.gasmeter_lastchanged
    for:
      hours: 0
      minutes: 15
      seconds: 0
    above: 30
    trigger: numeric_state
    conditions: []
actions:
  - metadata: {}
    data:
      message: >-
        Gasmeter al meer dan 15 minuten geen waarde doorgegeven. Check status
        van device op IP: 192.168.xxx.xxx
      title: Gasmeter not reporting
    action: notify.email_1
  - action: notify.persistent_notification
    metadata: {}
    data:
      message: >-
        Gasmeter al meer dan 15 minuten geen waarde doorgegeven. Check status
        van device op IP: 192.168.xxx.xxx
      title: Gasmeter not reporting
mode: single

sensor was down for over a day a few days ago and no notification send. Tried to test by setting value to above 5 seconds to trigger notification. This did not work too. Have used the Automation Editor to build this one.

What am I not doing right to get this working. Thank you for the support.

Bernard

Hi, have you checked the traces from that automation?

Also, there is no use to mask that IP address since it’s a private/LAN IP which a lot of users will be using too and those are not reachable from the internet.

Yes checked the traces there were none. When I run it as test it only shows traces of the notification. Yeah I know RFC1918 IP’s but still just a habit :slight_smile:

So the trigger doesn’t work at all.
As a test you can put the action in a script to make sure that part is right.

Have you checked the values/history of that sensor.gasmeter_lastchanged?

Okay trigger does not work.
I checked the history:


History is there it seems that part is working.
Checked the settings to get a notification:

Need to read the documentation on that, but maybe this is the reason the trigger is not working.

Not sure how I can put it in a script, no knowledge of scripting languages.

Thanks for the support! Much appriciated.

HA also has a way to use scripts - try them!
It’s like automations but without the trigger.
Don"t you see the specific states in Developer tools?

No, it’s not because of not having a unique ID that your trigger is not working.

Will check the scripts later (depending on the weather) this weekend.
Looked in developer tools no reference to the trigger.
Will test later more complicated then hoped for. I am used to ‘Blocky’ which most likely is not as powerful but I did understand what is going on :slight_smile:

Sorry, not the the trigger but the sensor.

I see in this in the log of developer tools for the automation:

id: 1719579907604
last_triggered: 2024-10-20T18:29:16.845444+00:00
mode: single
current: 0
friendly_name: Gasmeter alive check

3 days ago it was triggered but no notification or mail. Strange.
When I set the trigger to above 5 seconds and remove the for 15 minutes, I should receive after within a minute a notification.

That’s not how sensor.gasmeter_lastchanged works. It will show a timestamp, and you’re telling your automation to look for a value above 30.

The automation doesn’t know you mean a timestamp which is less than 30s from now, so will never trigger.

1 Like

Okay thanks for the insight.
I need to trigger on the timestamp not being changed for over 15 minutes. How do I do that? Suggestions are welcome.

I have ‘last reported’ sensors for the micro-inverters on my solar panels and check if they have not changed for 15 minutes like this:

{{ (as_timestamp(now()) - as_timestamp(states('sensor.inverter_482252022420_last_reported'))) | float(0) > 900  }}

As soon as the update interval is more than 900s it triggers a notification.

Thanks that is what I needed :slight_smile:
It does the trick, as test I set it to 10 seconds and notification send.