@timvancann wrote:
I’m using a template sensor to calculate total energy consumption and production in my house, as well as net energy usage.
Here’s my setup:
sensor: - platform: dsmr dsmr_version: 5 port: /dev/ttyUSB0 - platform: template sensors: energy_production_total: value_template: > {{ (states('sensor.energy_production_tarif_1') | float + states('sensor.energy_production_tarif_2') | float) | round(1) }} unit_of_measurement: 'kWh' energy_consumption_total: value_template: > {{ (states('sensor.energy_consumption_tarif_1') | float + states('sensor.energy_consumption_tarif_2') | float) | round(1) }} unit_of_measurement: 'kWh' net_energy: value_template: > {{ (states('sensor.energy_consumption_total') | float - states('sensor.energy_production_total') | float) | round(1) }} unit_of_measurement: 'kWh'
The problem is that
energy_consumption_total
remainsunknown
, it also doesn’t show anyunit_measurement
. The template developer tools can parse the template just fine and calculates it as it should.
As a result, any derivative sensor using the
utility_meter
component also fails. I can’t find anything in the logs that indicates a failure in the template. What could be going on here?
Posts: 1
Participants: 1