DSMR / P1: value - sensor.energy_consumption_total - unknown

Quick question:
The state of the sensor (sensor.energy_consumption_total) is always unknown.
Where is the value is this sensor coming from?

sensor.energy_consumption_tarif_1 + sensor.energy_consumption_tarif_2 = sensor.energy_consumption_total

Or should the value perhaps be from one or more DSMR sensors which are Disabled?

1 Like

I’m running into the exact same issue.
With the _TOTAL number you can easily use the utility_meter to generate hourly/daily/weekly/monthly data. Now I have to use a template to sum _t1 and _t2 into entities and use those in the utility_meter config.
Would like to find out IF sensor.energy_consumption_total should be populated and why it is not.

Did you find a solution to the total?
I am running in the same issue…

What have you set up to combine the two sensors? That seems like a good workaround for now!

My sensor.energy_consumption_total is still unknown.

My current setup:

template:
  - sensor:
      # ____ ENERGY sensor that sums energy tariff 1+2 into an entity ____________
      - name: "Energy consumption Total hourly"
        unit_of_measurement: kWh
        state: "{{ states('sensor.energy_total_hourly_t1')|float(0) + states('sensor.energy_total_hourly_t2')|float(0) }}"
      - name: "Energy consumption Total daily"
        unit_of_measurement: kWh
        state: "{{ states('sensor.energy_total_daily_t1')|float(0) + states('sensor.energy_total_daily_t2')|float(0) }}"
      - name: "Energy consumption Total weekly"
        unit_of_measurement: kWh
        state: "{{ states('sensor.energy_total_weekly_t1')|float(0) + states('sensor.energy_total_weekly_t2')|float(0) }}"
      - name: "Energy consumption Total monthly"
        unit_of_measurement: kWh
        state: "{{ states('sensor.energy_total_monthly_t1')|float(0) + states('sensor.energy_total_monthly_t2')|float(0) }}"

Does anyone have a clue on how to resolve this issue please?

Do the used source sensors have a value (sensor.energy_total_hourly_t1, etc)?

@bbccdd I suspect the energy meter does not supply the wifi module with the total consumption, only with the total consumption per tariff. The fact that the integration does not calculatate any values that have not been supplied by the meter is would arguably out of scope.

My template sensor has an availability template to make the sensor jump to Unavailable reliably when the sensor is offline.

  - platform: template
    sensors:
      dsmr_reading_electricity_consumed_total:
        friendly_name: "DSMR All Tariff Grid Usage"
        unit_of_measurement: "kWh"
        device_class: energy
        value_template: >
          {% set tarif1 = states('sensor.energy_consumption_tarif_1') | float(0) %}
          {% set tarif2 = states('sensor.energy_consumption_tarif_2') | float(0) %}
          {{ tarif1 + tarif2 }}
        availability_template: >
          {% set tarif1 = states('sensor.energy_consumption_tarif_1') | float(-1) %}
          {% set tarif2 = states('sensor.energy_consumption_tarif_2') | float(-1) %}
          {{ [tarif1, tarif2] | min >= 0 }}

float in the availability section checks the states of two and returns -1 if either of them fails to be converted to a float (in other words, isn’t a number).The [tarif1, tarif2] | min > 0 line checks if the smallest number of either of the sensors is equal to or greater than 0. If they are it returns True and the sensor will be available. If not, one of the sensors has an issue and it will return False, letting the sensor jump to Unavailable.

The availability sensor is recommended since these numbers are going into your long term statistics. You don’t want any inaccurate calculations where one of the sensors is reporting correctly while the other one is being converted to 0 by float(0).

The unit_of_measurement: "kWh" and device_class: energy are necessary for long term statistics and to be able to include the template sensor into your energy dashboard.

1 Like