Yesterday I followed a YouTube by everytingsmarthome on setting up a sensor template for an entity that was the negative of an existing one. I got it working. Today I keep getting a unknown non-numeric value returned. I have used the Developer Tool Template to test my code and can’t seem to use “| float(0)” to force it numeric.
My configuration.yaml code is:
sensor:
- platform: template
sensors:
pw_battery_now:
friendly_name: “PW Battery Now”
unit_of_measurement: “kW”
device_class: power
value_template: >
{% set pw_battery_now = states(‘sensor.powerwall_battery_now’) | float(0) * -1 %}
The code is the same today as it was yesterday. I can’t understand what has changed. Any ideas?