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

Calculation sensor not working

$
0
0

Hello,
I have a “small” problem. I have created several sensors via configuration.yaml and they work fine. Now I want to create a new sensor that takes a sensor value and calculates it * 365. The existing sensor provides data that I am ready to use and the value is also displayed correctly under “States”.
Unfortunately, the new sensor only ever returns 0. Does anyone have any idea why this might be?

This sensor works:

      # Verbrauch seit letzter Ablesung 
      - name: "Durchschnittsverbrauch seit letzter Ablesung"
        unique_id: "durchschnittsverbrauch"
        unit_of_measurement: "kWh"
        device_class: "energy"
        state_class: "total_increasing"
        state: >-
            {{ ((states('sensor.stromverbrauch_ab_referenzwert') | float(0)) / (states('sensor.vergangene_tage_seit_letzter_ablesung_2') | float(1))) | round(3) }}

the new one:

template:
  - sensor:
      - name: "Jahresverbrauch"
        unique_id: jahresverbrauch
        unit_of_measurement: "kWh"
        state_class: measurement
        device_class: energy
        state: "{{ (states('sensor.durchschnittsverbrauch') | float(0) * 365) | round(2) }}"

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 108876

Trending Articles



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