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

Template sensor with integration sensor: unavailable when value is zero

$
0
0

Hi,

I have a template sensor:

  # ---------------------------------------------------
  - name: "Elektriciteit subtotaal 2 power"
    unique_id: "sensor.elektriciteit_subtotaal_2_power"
    icon: mdi:flash
    unit_of_measurement: "W"
    state_class: measurement
    state: >
      {{ states('sensor.elektriciteit_kring_a_power') | float(default=0.0) +
         states('sensor.elektriciteit_kring_b_power') | float(default=0.0) +
         states('sensor.elektriciteit_kring_c_power') | float(default=0.0) +
         states('sensor.elektriciteit_kring_d_power') | float(default=0.0) +
         states('sensor.elektriciteit_kring_e_power') | float(default=0.0) 
      }}

and another “integration sensor” that calculates the riemann sum of this sensor

  # ---------------------------------------------------
  - name: "Elektriciteit subtotaal 2 energy"
    unique_id: "sensor.elektriciteit_subtotaal_2_energy"
    platform: integration
    source: sensor.elektriciteit_subtotaal_2_power
    unit_time: h

However, I noticed that if my sensor.elektriciteit_subtotaal_2_power has a static
value of “0.0”, the integration-sensor sensor.elektriciteit_subtotaal_2_energy gets the state of “unavailable”…

also, the graph is not updated anymore (1):

Question:

  • why becomes the integration sensor “unavailable”? when there the parent sensor has a constant value of “0.0” ?
  • why does the graph not update anymore. I would expect a horizontal line as there is no power consumption thus the subtotal of energy consumption should remain constant

kind regards,
Bart

PS
For some very specific reason, I had to redefine the source sensors as follows.
In fact, this is what I mean with a sensor with a permanent value of “0.0”

  # ---------------------------------------------------
  - name: "Elektriciteit Kring A power"
    unique_id: "sensor.elektriciteit_kring_a_power"
    icon: mdi:flash
    unit_of_measurement: "W"
    state_class: measurement
    state: >
        {{ "0" | float(default=0.0) }}

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106352

Trending Articles



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