Problem with two alerts

Hello everyone.

I configured an alert inside the configuration.yaml with good results:

alert:
  porta_garatge:
    name: Garatge obert
    done_message: Garage tancat
    entity_id: binary_sensor.esp32_porta_sensor_porta_garatge_tancada
    state: "off"
    repeat:
      - 5
      - 30
    can_acknowledge: true
    skip_first: true
    notifiers:
      - mobile_app_iphone_de_eloi

Now I have defined a new alert but the result is not correct:

alert:
  porta_garatge:
    name: Garatge obert
    done_message: Garage tancat
    entity_id: binary_sensor.esp32_porta_sensor_porta_garatge_tancada
    state: "off"
    repeat:
      - 5
      - 30
    can_acknowledge: true
    skip_first: true
    notifiers:
      - mobile_app_iphone_de_eloi

  Regar:
    name: Regar el jardí
    done_message: Jardí regat
    entity_id: sensor.sensor_humitat_humitat_del_sol
    below: 40.0
    repeat:
      - 1440
    can_acknowledge: true
    skip_first: false
    notifiers:
      - mobile_app_iphone_de_eloi 

The logs shows a configuration error.
I want to receive a notification when a sensor drops below 40.0%.

Can someone help me?

No capital letters in slugs.

  regar:
    name: Regar el jardí

Also this is not valid:

The available options are listed here:

You cant just make up your own.

You will have to create a template binary sensor that is on when your sensor is below 40. Then use that in the alert.

Thank you [tom_l]. Your instructions have resolved the problem.

To help another users with a similar problem, here is the specific solution:

1- I have created a template defined as a binary sensor with this specification:

{{ states('sensor.sensor_humitat_humitat_del_sol') | float(0) < 40.0 }}

The name of this template is: binary_sensor.falta_regar

2- Configuration.yaml:

alert:
    regar:
    name: Regar el jardí
    done_message: Jardí regat
    entity_id: binary_sensor.falta_regar
    state: "on"
    repeat:
      - 1440
    can_acknowledge: true
    skip_first: false
    notifiers:
      - mobile_app_iphone_de_eloi

One thing to be aware of, your default value for your float filter is 0, which is less than 40 which means this binary sensor will turn on if your source sensor goes unavailable. If you do not want this you have a couple of options:

  1. Make the default greater than 40, |float(42) this will make your binary sensor off when the source sensor is unavailable.

  2. Use an availability template:

state: "{{ states('sensor.sensor_humitat_humitat_del_sol') | float < 40.0 }}"
availability: "{{ has_value('sensor.sensor_humitat_humitat_del_sol') }}"

This will make your binary sensor unavailable when your source sensor is unavailable.

Interesting. Thank you Tom :+1:

Following improving it, is it possible to set the hour to be notified?

Something similar to:

“sensor <40 and time=19:00h”

Sure but you may miss alerts if they happen before that time.

state: "{{ now().hour == 19 and states('sensor.sensor_humitat_humitat_del_sol') | float < 40.0 }}"

This solution is perfect. Thanks