Automation - re-send notification every X seconds

What do you mean ?
How to use it ?
Where is it documented ?

Where nearly everything is documented :wink:

1 Like

yep - and that led me to this fantastic blueprint

I didn’t know there was an integration called alert.
The way you said, I thought it was some kind of optional parameter of “notify” integration.

Thanks

Trying to implement this but I am not getting notification… this is in my configuration.yaml file and both notifiers are tested working. Not getting any alerts. for now I am using a state of ‘off’ so I do not have to hold the button to on. So I trigger it to on get a notice from other automation but I would expect if this is working that 1 minute later I would get a notification from this alert. Thanks for the help. TIA

alert:
water_found:
name: Flooding detected
done_message: Flooding is clear
message: flooding detected
entity_id:
- binary_sensor.water_sensor_main_drain_water_leak
state: ‘off’
notifiers:
- gmail
- mobile_app_bphone11
repeat: 1

can_acknowledge: true

Please post it formatted. Otherwise, we can not see if the reason is perhaps a wrong yaml code.

image

image

Again. Please use formatted text. I directly gave you the toolbar button. No plain text, no screenshot of text.

First try

entity_id: input_boolean.water_sensor_main_drain_water_leak

Secondly, it will not trigger after one minute, but directly, when the condition is true and then every new minute again. If you want to avoid the first, use skip_first. See docs.

And then, what is the history of input_boolean.water_sensor_main_drain_water_leak? The alert will only switch on, if it changes from something else to off in your example. You should test this behavior manually with your input_boolean. And double-check, the status of the (generated) alert-entity alert.water_found.

BTW is there a alert.water_found entity and did you restart HA?

alert:
  water_found:
    name: Flooding detected
    done_message: Flooding is clear
    message: flooding detected
    entity_id:
      - binary_sensor.water_sensor_main_drain_water_leak
    state: 'off'
    notifiers: 
      - gmail
      - mobile_app_bphone11
    repeat: 1
#    can_acknowledge: true

very sorry did not realize what you where telling me… believe I have it right this time

input_boolean does not appear to come up on the list when I start entering it. Should it?

Yes so the way I have written the code is test the water sensor when it goes from the on to off state so that I am not listening to the beep beep beep while I wait for a minute (or more to go buy) testing to make sure it works … So I trigger a wet condition and other interfaces confirm that it has been triggered and then then I stop the device from thinking it is wet so it returns to off state which is when I would expect this to trigger this action and likely keep sending me out alerts for a long time (kinda of a dumb move but it would prove the point with out listening to beep beep beep beep… :slight_smile: ) Once working I would move the state to ‘on’ in the action

Hope that all made sense.

This code works for the control panel. Showing the binary_sensor… item works with on and off

      {% if states('binary_sensor.water_sensor_main_drain_water_leak') == 'on'
      %}
        mdi:water-circle
      {% else %}
        mdi:water-off
      {% endif %}

Thanks for all the help

Sorry, was a typo. I was talking about your binary_sensor.water_sensor_main_drain_water_leak

But coming back to my questions above. Is there the alert-entity available? And what is the value and history of that? And was ist the current value and the history of `binary_sensor.water_sensor_main_drain_water_leak?

And did you test with my suggestion above?

alert:
  water_found:
    name: Flooding detected
    done_message: Flooding is clear
    message: flooding detected
    entity_id: binary_sensor.water_sensor_main_drain_water_leak
    state: 'off'
    notifiers: 
      - gmail
      - mobile_app_bphone11
    repeat: 1

I don’t understand what you mean by this: Is there the alert-entity available? If I go to developer tools.>States->Entity and try and enter alert. nothing comes up if this is what you mean. Can’t get to history without understanding how to get to it.

For the water sensor - main drain this is the status of it (see attached) at 1:45 I put the entity_id: binary_sensor.water_sensor_main_drain_water_leak inline as suggested and reloaded the system. triggered water for which I get notification from other entities right away that water is detected but waiting for the notices to come in when the state went to off but no luck yet.

If the setup for the alert is working, there is a alert entity afterwards. In your case alert.water_found

If it is not there, it cannot work. Is the nothing in the log if you restart HA?

Did you try my suggestion above and restart HA? Really don’t get, why you are not trying suggestions. It is now the third time I’m mentioning the change in the entity_id row.

Thanks for your persistence (most people just walk away) Yup that was exactly it the alert was not loading into the system… and well that was the novice to HA in me… I had entered it into the configuratoin.yaml under the zigbee2mqtt drop down and not the one in the root directory.

But yes I was doing everything I could and understood that you documented sorry if I was not clear in my responses but ya I was doing everything.

Thanks for your help and persistence got it figured out now. As a relative newbie to HA really appreciate the help.

Found another error while checking the logs for you that will keep me busy for a little. It appears to work but I get errors (just love those ones).

Complains about this one:

TemplateError(‘ValueError: Template error: int got invalid input ‘unknown’ when rendering template ‘{{ states (‘sensor.water_mb_window_sill_battery’) | int / 2 }}’ but no default was specified’) while processing template ‘Template("{{ states (‘sensor.water_mb_window_sill_battery’) | int / 2 }}")’ for attribute ‘_attr_native_value’ in entity ‘sensor.battery_status_mb_sill’

5:06:03 PM – (ERROR) helpers/template_entity.py - message first occurred at 5:06:03 PM and shows up 4 times

Error while processing template: Template("{{ states (‘sensor.water_mb_window_sill_battery’) | int / 2 }}")

5:06:03 PM – (ERROR) helpers/template.py - message first occurred at 5:06:03 PM and shows up 4 times

But exact same line different sensor (same model… no complaints ).
{{ states (‘sensor.water_sensor_main_drain_battery’) | int / 2 }}

You’re welcome.

Regrading the errors. You should use default for filters ( here |int) wherever you can. Esp. as they are thowing errors, if there is no value and you don’t use them (new for some releases, before it returned 0 or input value or …).

So have a look here

and use e.g.

states (‘sensor.water_mb_window_sill_battery’) | int(default=0)

soem for floats, etc. etc.

This makes sense, I will review and work on it later… kinda indicates why I was not figuring it out that it did not have a valve… but weirdly the result works… Where it is being used is the Third Reality water sensors are now reporting to zigbee twice the power they have so 90 is reported as 180 and they did this because the values where getting a mess when they where going through certain devices… but left us out on a lurch that we can pickup the real value so I had to right an entity that held the value at half and so this happens on only some of there devices, depends on the firware level and they do not expose the firmware level to us to do the math with just have to do it manually for each of the devices… apparently they are going to have a chat with zigbee2mqtt to see what can be done to make it work right for them. Till then NewValue= OrgValue/2 but weird it comes back with no value but it still work and gauges are all reading correctly now.

Thanks again for you help its been awesome… wish I had a mentor in Ottawa I could just sit down with over beers and drain tons of knowledge from.

Have a great day.

Is there any chance you can help me figure out how to repeat a low reading until it goes back to its normal level?

I have no clue how to add a repeat to this Automation that reads it out once but I would like it to keep doing this every 5 mins until the reading is above!

alias: "Read out Low reading "
description: With Echo Show 10
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.blood_sugar
    id: Low-readings
    below: 72
  - platform: numeric_state
    entity_id:
      - sensor.blood_sugar
    id: normal-readings
    above: 75
  - platform: numeric_state
    entity_id:
      - sensor.blood_sugar_2
    below: 4
    id: Low-readings_mmols
    enabled: false
condition: []
action:
  - action: notify.alexa_media_dave_s_echo_show_living_room
    data:
      message: Dave, your blood sugar is running low.
    enabled: true
  - choose:
      - conditions:
          - condition: trigger
            id:
              - Low-readings
        sequence:
          - action: notify.alexa_media_dave_s_echo_show_living_room
            metadata: {}
            data:
              message: Dave, your blood sugar is running low.
          - action: notify.alexa_media_dave_s_echo_dot_bedroom
            metadata: {}
            data:
              message: Dave, your blood sugar is running low.
          - action: notify.mobile_app_sm_s928b
            metadata: {}
            data:
              message: Dave, your blood sugar is running low.
          - action: notify.alexa_media_dave_s_echo_show_kitchen
            metadata: {}
            data:
              message: Dave, your blood sugar is running low.
          - action: notify.alexa_media_dave_s_echo_dot_bathroom
            metadata: {}
            data:
              message: Dave, your blood sugar is running low.
          - action: notify.mobile_app_ticwatch_pro_3_ultra_gps
            metadata: {}
            data:
              message: Dave, your blood sugar is running low.
          - action: notify.alexa_media_david_s_3rd_echo_dot
            metadata: {}
            data:
              message: Dave, your blood sugar is running low.
      - conditions:
          - condition: trigger
            id:
              - normal-readings
        sequence:
          - action: notify.alexa_media_dave_s_echo_show_living_room
            metadata: {}
            data:
              message: Dave, your blood sugar is ok now, and normal levels
          - action: notify.alexa_media_dave_s_echo_dot_bedroom
            metadata: {}
            data:
              message: Dave, your blood sugar is ok now, and normal levels
          - action: notify.mobile_app_sm_s928b
            metadata: {}
            data:
              message: Dave, your blood sugar is ok now, and normal levels
          - action: notify.alexa_media_dave_s_echo_show_kitchen
            metadata: {}
            data:
              message: Dave, your blood sugar is ok now, and normal levels
          - action: notify.alexa_media_dave_s_echo_dot_bathroom
            metadata: {}
            data:
              message: Dave, your blood sugar is ok now, and normal levels
          - action: notify.mobile_app_ticwatch_pro_3_ultra_gps
            metadata: {}
            data:
              message: Dave, your blood sugar is ok now, and normal levels
          - action: notify.alexa_media_david_s_3rd_echo_dot
            metadata: {}
            data:
              message: Dave, your blood sugar is ok now, and normal levels
mode: single

Well, you do not need to repeat anything if you continue on the path above to create an alert sensor. It does that for you. You can specify how often warning shoud occur while the problem persists. But you seem to have given up on that because of an error in a template, and instead want to go for a more difficult approach?

Step one: create a binary sensor that is on if there is a problem, and turns off when the problem is gone. I suggest you use a threshold sensor for that, with a lower bound of 73.5 and a hysteresis of 1.5. You can create it in the gui using a helper.

Then set up the alert entity like was suggested before, using the threshold sensor as the enitity:

1 Like

Thanks Edwin_D I will have a look and try to do it a different way! I’m not aware of all the different things I can use or try to get too, to do the processes correctly. The way I have tried so far is using my Blood Sensor like its a windows and in the real world this is not correct :slight_smile:

It’s me to know how to do it in a little more guided way it.

If I were to pick how often a warning should occur while the problem persists far, I would not know as it depends of the results from my blood reading. In the real world for me, this can be up to an hour if it was just under 3.9mmols (72 mg/dL) and I could get away with it but it would be very annoying it keeps telling me until I was to just get it over the 3.9mmols to 4.0mmols (72 mg/dL) :rofl: :blush:

I also have no clue how to pick a threshold sensor to do an automation. But will see by your links if I can!

I tend to learn by watching how to do it and then try to see how to vary it a bit by the Home Assistant Instructions!

I will see if I can try to understand the links you have sent me (Thank you!)

On my watch I have a button I select to turn off notifications for 20 mins so then this gives me time to try to get the level higher! Then If the level as not got higher after 20mins to tell me again.

I understand that it can take some time for blood levels to return to normal, but your question was to retry every five minutes. Luckily, if you check the alert documentation, you can specify for each repeating message how much time you want in between. So you could first send one, wait half an hour, alert again, then 10 minutes… The examples are in the docs, so that should not be hard.

I gave you the settings for the threshold based on the example you gave, so it should not be hard.

For the repeat frequency: You could even make two alerts, and have one threshold for medium level warning and another for high level warning, and then two alerts, the high level one warning faster then the other. Give it a go for one situation, and if it works expand on that.

1 Like

I will try to study it this week! I also have another one doing the colour of the lights which is also doing weird things :slight_smile:

Lights come on red now and I told it to do it after 10pm but looking at my settings now I cannot find where I did it last night and its showing me an old, setting!

It’s also not reliable as it will reset after I do a Home Assistant update! which is frustrating!

But it can work if done right I’m just not quite doing
ti right yet!

This is what I mean as in I’m ok on my level and know I’m going to be going lower when I’m awake! But a sleep I have no clues at all!

Thanks for your understanding too!

At least the light comes on red :slight_smile: That’s a good start! And it seems to have gone off too on me going back to normal that is the other automation Im messing about with at the moment!


The other thing I don’t understand isI can see the colour in Yaml but not in the visual editor section! So I cannot change the colour.
Is there any way to move these posts to another topic?

It’s okay I figured finding it too!
Lastly, is ok to also add it into the configuration.yaml as well as do it in Automation