Hi Guys,
Having trouble with a simple template sensor subtraction. My end result ends up at 2.150000000076398 as an example and unable to round down to 2 decimal places.
platform: template
sensors:
todays_export:
friendly_name: 'Todays Export kWh'
value_template: "{{ states('sensor.modbus_export_kwh') | float - states('input_number.today_export_consumption') | float | round(2) }}"
unit_of_measurement: kWh
device_class: power
Both Sensor.modbus_export_kwh
and input_number.today_export_consumption
return a nice 1234.56 format. No matter what I do with the round (2) doesnt seem to change the end result.
Interestingly if I add ( + ) the two variables in the same template then the format result is perfect complete to 2 decimal places. !!! Any ideas appreciated
Thanks Dave