I have created a binary sensor template, I will use this one for a wasmachine automation.
I found this template on the internet.
It works but I wonder if I can set a “on” value and a “off” value.
For now it’s above 25w and below 25w!, Let’s say I want a higher watt number for on, and a lower number for off, that in combination with the delay_on and delay_off… I can make it more accurate and switch faster.
The else statement keeps the binary sensor in it’s last state if not above or below the thresholds (converts on/off binary sensor state to true/false respectively as required by the template).
Binary sensors always have the state'on' or 'off' you can continue to trigger on that no problem.
The template in a template binary sensor just expects a true or falseresult and converts that to the state'on' or 'off'.
You did this with your original template, {{ states('sensor.power_dryer')|float > 25 }} the statement is either true (when above 25) or false (when below 25). The binary sensor converts this template result to 'on' or 'off'.