How to enable power consumption statistics

Ok I changed the value of the last_reset to
2021-08-09T11:47:23.862268+00:00

and now it works

Hello, I am also struggling with this… would you be so kind and share code that you have in customization file.
Thank you in advance

I solved by changing the value of last_reset

Hi, how do I reset stats on a zigbee plug? The sensor does not have a last_reset parameter. Thanks.

Would it be possible to make an anergy measuring template from the time a bulb is on, knowing that the bulb is consumming 5Wh ?

Look at powercalc, it does exactly that and more.

Thanks for this info

Hi!

Thanks for the help provided here.

I was able to get the template sensors running for total power and total energy.
My PV setup contains two SMA 3-phase inverters and the SMA integration unfortunately does not provide the sum of all inverters for the current power and the total energy generated so far.

Here is my config:

template:
  - sensor:
      - name: "PV Total Power"
        unique_id: "sensor.pv_total_power"
        unit_of_measurement: "W"
        state: "{{ states('sensor.grid_power') |float + states('sensor.grid_power_2') | float }}"
        state_class: measurement
        device_class: power
      - name: "PV Total Energy"
        unique_id: "sensor.pv_total_energy"
        unit_of_measurement: "kWh"
        state: "{{ states('sensor.total_yield') |float + states('sensor.total_yield_2') | float }}"
        state_class: total_increasing
        device_class: energy
        attributes:         
          last_reset: '1970-01-01T00:00:00+00:00'        

After reading all off the topic i am to struggeling to get the power consuption statistics working. I have a ESP8266 reading the optical port en writing this to MQTT. The sensor is showing and providing the correct values:

  - platform: mqtt
    name: totaalstroomverbruik
    state_topic: "iot/smartmeter/sensor/1/obis/1-0:1.8.0/255/value"   
    unit_of_measurement: 'kWh'
    state_class: measurement
    device_class: energy
    last_reset_topic: "iot/smartmeter/sensor/1/obis/1-0:1.8.0/255/value"
    last_reset_value_template: '2021-08-09T11:47:23.862268+00:00'

The sensor is not selectable for the statistics. Any help is welcome :smiley:

Hi @elik745i, Can I please ask how you fixed the unit_of_measurement showing as kwhh please? I have left mine running for over an hour and it still shows kwhh which stops it logging energy data.
Thanks

OK so I’m not sure what the original problem was but I sorted it by deleting the original sensor and recreating it with a slightly different name and it now shows as kWh.

Don’t know what changed, but since a while my solar used energy doesn’t show in the Energy dashboard:



The supplying sensor does work however:
image

Anyone an idea?

Im having the same issue. Nothing changed it just stopped showing up on the graph.

I have double checked the sensor and the config and it seems to be configured correctly.

Hi I have a similar problem as many above.
I have a smart home hub which allows me to connect, among money others, z-wave devices to it. I have a smart plug with power and energy measurement connected to it. I do not have a Z-wave dongle for my HA setup.
I can expose the device and its 3 entities to HA using MQTT. This lets me turn it on/of, read out the power and energy use. I would like to add the reading from this device to the energy dashboard but it does not appear on the list of entities. I can however add it as a card to my other dashboards and get correct readings.
Is there any way around it? I understand that HA cannot track statistics for this entity as per: Expected data source not listed - Home Assistant but can I do anything about it?

I tried adding this to my configuration.yaml but it did not work out. I read that there is a new configuration format for templates and I gave that a try as well but with no success.

- platform: template
  sensors:
    power_meter_energy:
        device_class: energy
        state_class: measurement
        friendly_name: "power meter energy"
        unit_of_measurement: "kWh"
        last_reset: none

Hello everyone,
I tried to reproduce the same exact sensor but I had no luck in allowing home assistant to use it as a grid consumption source.

This is my sensor definition:

template:
  - sensor:
    - name: "house_energy_kwh"
      unit_of_measurement: "kWh"
      state_class: measurement
      device_class: energy
      state: "{{ states('sensor.house_statistics_instant_total') }}"
      attributes:         
        last_reset: '1970-01-01T00:00:00+00:00'