javichun
(javichun)
March 13, 2021, 7:44pm
1
Hi everyone, I have the following automation and I don’t understand why it only works the first time.
- alias: Humedad Tierra sensor1
description: HT1
trigger:
- platform: template
value_template: '{{ states("sensor.humedad_tierra_2") | float >= 75}}'
condition: []
action:
- service: notify.enviaremail
data_template:
message: >
{% set humedad = states('sensor.humedad_tierra_2') | float %}
{% if humedad >= 75 %}
La jardinera 1 necesita agua !!!
Humedad del Suelo: {{humedad}} %
{% endif %}
- service: notify.whatsapp
data_template:
message: >
{% set humedad = states('sensor.humedad_tierra_2') | float %}
{% if humedad >= 75 %}
La jardinera 1 necesita agua Alta !!!
Humedad del Suelo: {{humedad}} %
{% endif %}
mode: single
Trigger:
if sensor.humedad_tierra_2 >= 75 --> work
…
-The value of sensor.humedad_tierra_2 < 75
…
-The value of >= 75 --> no work, no send notifys
why is this happening? that i’m missing, how can I solve it?
Nota: if restart Home assistan works the first time.
Thanks!!!
You’re using an if statement, but it is not required for your use case.
action:
- service: notify.enviaremail
data_template:
message: >
{% set humedad = states('sensor.humedad_tierra_2') | float %}
La jardinera 1 necesita agua !!!
Humedad del Suelo: {{humedad}} %
- service: notify.whatsapp
data_template:
message: >
{% set humedad = states('sensor.humedad_tierra_2') | float %}
La jardinera 1 necesita agua Alta !!!
Humedad del Suelo: {{humedad}} %
What do the logs say when you surpass the threshold and it doesn’t work?
Try this:
- alias: Humedad Tierra sensor1
description: HT1
trigger:
- platform: numeric_state
entity_id: sensor.humedad_tierra_2
above: 75
action:
- service: notify.enviaremail
data:
message: "La jardinera 1 necesita agua !!! Humedad del Suelo: {{states('sensor.humedad_tierra_2')}}%"
- service: notify.whatsapp
data:
message: "La jardinera 1 necesita agua Alta !!! Humedad del Suelo: {{states('sensor.humedad_tierra_2')}}%"
mode: single
javichun
(javichun)
March 14, 2021, 3:36pm
4
Thanks for replying, this only works once, like before, The records say nothing.
I don’t understand why the trigger doesn’t fire for this sequence:
if sensor.humedad_tierra_2 >= 75 --> work
…
-The value of sensor.humedad_tierra_2 < 75
…
-The value of >= 75 --> no work, no send notifys
I do not understand, any suggestions
Thanks!
javichun
(javichun)
March 14, 2021, 4:18pm
5
sorry,
It works perfectly, the problem was that I receive the data by MQTT and in the program it was limiting to send only the data> = 75 (deep_sleep-> no wifi activation) and of course the trigger did not receive the change of state.
Thanks to both of you. All the best!!!