It checks if the value of precipitation, which is part of sensor.weather_prediction’s attributes, is greater than or equal to 0 and less than or equal to 0.5.
So if its value is 0 then it should pass the Template Condition.
NOTE
Go to Developer Tools > States, find the sensor in the list and confirm its attribute is spelled precipitation. If it’s spelled Precipitation then you must correct the example I posted.
Similarly, confirm the sensor’s entity_id is correct because it’s truncated in the screenshot you posted. I made an assumption it’s sensor.weather_prediction
Haha, works! Thanks @123
But one question. Why do I have to use “template”?
sensor.weather_prediction is a sensor and a sensor is an entity.
It seems that I do not understand the concept of “template” here.
How to decide when to choose theh correct type within automations?
You could use the Numeric state condition without the above component… unless precipitation can report negative numbers it shouldn’t cause any false positives.
In your original condition, the issue was that 0 isn’t above 0, so the condition failed. Taras’ template condition provides for “>=” where the Numeric state condition only provides “>”.
Generally speaking, I minimize the use of delay or, when I do use it, ensure it is a very short delay (less than a few minutes).
The reason is because if Home Assistant is restarted while the delay is counting down, all automations are immediately terminated. That means your automation wouldn’t execute the switch.turn_off command.
For your application, simply create two Time Triggers, one for 06:30 and the other for 07:00. Identify each one with a trigger id.
The following example turns on the switch at 06:30, and off at 07:00, but only if precipitation is less than or equal to 0.5.
This was also my concern that it could happen that the sprinkler will run forever. What I did was to create a security mechanism: at 9am just send a turn off to the sprinkler.
You don’t need to wait for 2 hours of water being wasted before turning it off. At the very least, you can set the sprinkler to turn off at 07:10 in your separate automation.
Otherwise just set the automation to turn off your sprinkler if it’s been on for 40 mins.