Now I want to change the condition to be only true if sensor.A is below this calculation: (sensor.B - 5).
How do I do this? I have not seen anything related in the condition docs.
I tried the following but I am getting syntax errors on both: below: sensor.B - 5 {below: sensor.B - 5 }
Note that for comparison of numeric states in templates, you need to convert the state (which is always a stirng) to a number. That’s what |float() does, and the number in brackets is what to use if the sensor state cannot be converted.
Here, if my temperature sensor failed, the second line would return an error and the third line would return 2. Without the second float() in the third line, the calculation would fail (can’t convert "x" to a number, then can’t add the number 2 to the string "5.1").
The two links at the top of that page give you all the information you need.