Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 102657

Template sensor state remains "unknown"

$
0
0

@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 remains unknown, it also doesn’t show any unit_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

Read full topic


Viewing all articles
Browse latest Browse all 102657

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>