Platform integration sensor crashing in Energy Dashboard

Using the platform integration sensor sensor.energy_import (se below) as input sensor in the Energy Dashboard causes failure of the sensor Energy Import Cost - when HA is rebooted. The power input is from the Huawei Solar integration. and my own two sensors for energy and costs do not crash?

The sensor crashing is created automatically by HA.

The energy sensor used as input in the Energy Dashboard.

  - platform: integration
    source: sensor.power_import
    name: "Energy Import"
    unique_id: energy_import
    round: 6
    unit_prefix: k
    unit_time: h
    method: left

The power sensor used as input to the energy sensor.

      - name: "Power Import"
        unique_id: power_import
        unit_of_measurement: W
        device_class: power
        state_class: measurement
        state: >
          {{ (
          states('sensor.power_meter_active_power') | float(0)
          , 0 ) | min | abs }}

Adding availability + removing default and “(0)” in float, does not seam to do the trick. Removing “, 0” the sensor is not providing any result.

      - name: "Power Import"
        unique_id: power_import
        unit_of_measurement: W
        device_class: power
        state_class: measurement
        state: >
          {{ (
          states('sensor.power_meter_active_power') | float
          , 0 ) | min | abs }}
        availability: >
          {{ has_value('sensor.power_meter_active_power') }}

I guess “This is the way”. :wink:

UPDATE: Apparently not…“The way”. I created a utility meter Energy Import UM in stead of the sensor. Teste with and without periodically_resetting: and with both values true and false . No effect what so ever.

energy_import_um:
  source: sensor.energy_import
  name: "Energy Import UM"
  unique_id: energy_import_um
  periodically_resetting: false

The strange thing is that the consumption in the Energy Dashboard does not reflect the value of the sensor that HA has created Energy Import UM Cost? It seams to add all the delta values up. Sorry but this does not make any sense to me.

Any pointers would be appreciated. Thanks!