I need some help. I created an automation for my gardena watering. I want to water the garden only when it did not rain (not more than 0.259l).
I am unsure about the way I entered the condition. Do I need to use “,” or “.” and does it work with the key “<” to indicate the rain amount.
Unfortunately I cannot test it easily, because rain sensor is on the roof
- id: '1656760454216'
alias: Bewässerung An
description: ''
trigger:
- platform: time
at: '18:00:00'
condition:
- condition: state
entity_id: sensor.regen_tag
attribute: state_class
state: < 0,259
action:
- service: switch.toggle
data: {}
target:
entity_id: switch.water_control_50914
mode: single
- id: '1656760734324'
alias: Bewässerung Aus
description: ''
trigger:
- platform: time
at: '19:00:00'
condition: []
action:
- service: switch.toggle
data: {}
target:
entity_id: switch.water_control_50914
mode: single
The YAML code you posted is unformatted which makes it difficult for anyone to inspect it for indentation errors. Please format it using the forum editor’s </> icon.
OK, unfortunately this didnt work. Log says that the condition wasnt met, although I had no rain today.
What puzzles me is rhe fact, that the rain amout has a comma, like 0,258, but today it was zero.
The rain amount comes from a utility meter, not shure whether this has something to say.
I checked the sensor value. Indeed the sensor value has a decimal point. It seems due to language setting it is just displayed with comma.
Anyhow, even stranger that condition was not met. Just time works fine.
For the Numeric State Condition, there no difference between this:
below: 0.259
and this:
below: '0.259'
The first one represents the value as a floating point number.
The second represents it as a string which gets converted to a floating point number.
The main point is that your original version using a State Condition and this:
attribute: state_class
state: < 0,259
was completely invalid because the state option doesn’t support mathematical operators and you specified an attribute option which made the State Condition refer to the wrong value.