Ive created a sensor that calculates a Kwh value, but I need this to be 0 if appliance is off? How can I do this is HA? So, I have sensor.appliance which returns say 24. sensor.enable is either ON or OFF. If ON then the value needs to be 24 (or whatever) else 0 (if off)
"{{ states('sensor.Flame_level') | float(0) * 0.01 * 27 +6.7 }}"
This is needs to work with sensor.ot_flame_enable which is either ON or OFF.
I also struggle in working out where code needs to go in yaml. and how it should be indented.