Energy Management in Home Assistant

Yours :

  #sensor sonoff_pow_kwh_total:
  - platform: mqtt
    name: Power meter 1 Total Power
    state_topic: "tele/sonoff_power1/SENSOR"
    value_template: "{{ value_json['ENERGY'].Total }}"
    qos: 1
    unit_of_measurement: "kWh"

Changed :

  #sensor sonoff_pow_kwh_total:
  - platform: mqtt
    name: Power meter 1 Total Power
    state_topic: "tele/sonoff_power1/SENSOR"
    value_template: "{{ value_json['ENERGY'].Total }}"
    qos: 1
    unit_of_measurement: "kWh"
    device_class: "energy"
    state_class: "total_increasing"

You really don’t see the difference ?

2 Likes

I have an electricity sensor and a gas sensor:

sensor:
  - platform: mqtt
    state_topic: amr/reading/SCMplus/110/100583244/message
    name: Electricity Meter
    unique_id: electricity_meter_01
    unit_of_measurement: kWh
    device_class: energy
    state_class: total_increasing
    availability_topic: amr/status/availability
    value_template: "{{ value_json.Message.Consumption | float / 1000 }}"
    json_attributes_template: "{{ value_json.Message | tojson }}"
    json_attributes_topic: amr/reading/SCMplus/110/100583244/message

  - platform: mqtt
    state_topic: amr/reading/SCM/12/51643176/message
    name: Gas Meter
    unique_id: gas_meter_01
    unit_of_measurement: "m³"
    device_class: gas
    state_class: total_increasing
    availability_topic: amr/status/availability
    value_template: >
      {{ value_json.Message.Consumption | float / 100 * 2.83168 }}
    json_attributes_template: "{{ value_json.Message | tojson }}"
    json_attributes_topic: amr/reading/SCM/12/51643176/message

The electricity sensor shows up in the Energy panel just fine, but the gas one does not. Banging my head against the wall. :pensive:

How can we use this kind of cost sensor in the new energy management dashboard? Thanks so much

Hello HA-users,
I am still struggling with my Solar energy. Main question: what value is exactly required:

  • Today’s energy production (in kWh)
  • Or Total lifetime energy production (in kWh)
  • Or maybe actual power (in Watts)?

Thanks!

I have a bug since upgrade from 2021.8.8 to 2021.9.5 version.

Before upgrade the energy dashboard works great :

After upgrade the values for Grid consumption show cumulative values instead of calculating the difference
(Solar values are still good but we can’t see them because of scale) :

I tried to change some parameters in entity customization but with no success.

Some suggestion ?
Thanks

Either of the energy figures is OK. Power is not used.

Post the attributes of your sensors.

Capture d’écran (78)


Would it be possible to swap the bars priority?
I would prefer if the new battery statistics (light blue / pink bars) would be drawn prior to the grid in/out statistics (dark blue / purple bars).
It should always show first what is happening on your premises prior to drawing the bars that go in and out of your house.

Edit: I.e. swap the light blue and dark blue, and swap the pink and purple bars.

You need to make your own energy card as you cannot edit the one on the left. You can get everything that is on that one plus whatever you want.

Capture d’écran (78)

Hey, I am so new at this but I thought I would give you some things to try. Will not hurt :slight_smile:
People keep saying class should be power, not energy
and remove/remark out last updated’s

You are missing

state_class: total_increasing
1 Like

In this case energy is correct as it is the total amount of power cosumed over a time period hence the kWh (kilowatt HOUR). If the measurement was in watts or kilowatts then power would be correct. Hamish is correct that the state_class needs changing since 2021.9

Thanks,

@PapaLanc : in this case I believe it’s really energy (kWh) because it’s the energy consumed since the meter was installed (near 1 year) from my (Linky) energy meter.

@hmoffatt : I will try it. It must be forced in the configuration file otherwise the only option available is measurement for class state_class
I forced it and will wait few hours for Energy Dashboard update the values.

Hi folks! Sorry if that was mentioned, but how to calculate cost if I have 2 prices per kWh - daily and night one?

You will need somewhere to store the current cost. I use an input_number.
You will then need an automation to change that cost at the appropriate times

1 Like

Have another quick: how to change the currency from EUR to smtg else? Thanks!

@OzGav You are my hero of the day! This was indeed the reason. My recorder is limited to the entities I want, and the CO2 signal integration sensors where no part of them.

Now I added it and it works!

Hi guys,

Everything works as it should for me, except the cost sensors (automatically created by HA) which reset every now and then instead of always increasing:
image

Looks like (but I’m not sure) the _cost sensors reset when HA is restarted. The corresponding energy sensors behave as they should (always increasing).

Any idea what’s happening there?

1 Like

You are right, It works !

Thank you.

1 Like