Baldric78
(Eloi Boronat)
September 3, 2024, 9:04am
1
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?
tom_l
September 3, 2024, 9:07am
2
Baldric78:
Regar:
No capital letters in slugs.
regar:
name: Regar el jardí
Also this is not valid:
Baldric78:
below: 40.0
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.
Baldric78
(Eloi Boronat)
September 9, 2024, 2:18pm
3
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
tom_l
September 9, 2024, 9:34pm
4
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:
Make the default greater than 40, |float(42)
this will make your binary sensor off when the source sensor is unavailable.
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.