Alert with delay on binary-sensor

Hi there,

again a noob, who has just started.
What I want to do:
I have an aqara sensor for open/close status. This is recognized and working already.
I want it to trigger a telegram message to my mobile, if the fridge is not closed. I already got it working with a alert action, but it now sends everytime if the fridge is open. Therefore, I want to modify that in a way, that it only sends a warning message if the fridge is open for, lets say >1 minute.

I found, that this is not working with a normal alert, but a binary sensor, but unfortunately, here I am stuck at progress → it doesnt work.
Attached is the code that I tried in different variations already:

template:
    - binary_sensor:
      - name: "kuhlschrank_status_sensor"
        delay_off:
          minutes: 1
        state: "{{ is_state('binary_sensor.openclose_27') , 'on' }}"


alert:
    kuehlschrank_status_alarm:
        name: Kuehlschrank ist offen!
        done_message: Kuehlschrank wieder geschlossen!
        entity_id: binary_sensor.kuhlschrank_status_sensor
        state: "on"
        repeat: 5
        can_acknowledge: true
        notifiers:
            - zyv_telegram

So, it shows no configuration failures, but running it, wont generate any messages.
On the frontend it shows:
image
so, something seems to be wrong with that generated binary sensor of mine.
Anybody might chip in to help? :confused:

Thx already!

BR,
Martin

Use the aqara binary sensor in the alert, set the alert repeat minutes to 1, but also set the alert skip_first to true.

I’m pretty sure if the fridge is closed within that first minute the repeated alerts won’t occur.

Thx for the feedback! I will definetly try that.

But on the other hand: what is wrong with my code? Consulting the wiki and faqs, I would have assumend that it should work like that… :frowning:

This:

state: "{{ is_state('binary_sensor.openclose_27') , 'on' }}"

Should be:

state: "{{ is_state('binary_sensor.openclose_27', 'on') }}"

i.e. closing bracket for is_state() in the wrong place.

Also you are detecting the on state in your alert as soon as it occurs, just making this last longer is not going to help.

1 Like

Works! Thx…such a small failure…