Energy Management in Home Assistant

ah ok,
and what about mqtt? are they configured correctly ?

Field is greyed out, so can not select it at all unfortunately
image

You are using configuration.yaml to configure HA, so update in there

homeassistant:
  currency: USD
1 Like

Based on what I have seen elsewhere, the Energy integration expects the sensor to report power consumed over a period of time (kWh) instead of power consumed right now (W).

1 Like

To me it’s pretty weird you cannot integrate the live consumed power and delivered power. At least i don’t see the entity’s available in the drop down list while configuring.Or am i wrong? Using the DSMR Slimme Meter integration.

Your config is stored in configuration.yaml so you cannot edit from UI. I think you need to add this to configuration.yaml like so:

homeassistant:
  currency: USD

Hi all, I love the new energy monitoring stuff, Im trying to set it up for some individual devices like lights and sockets etc. Im using the powercalc custom integration, to calculate power when the device is OFF (power used by the Sonoff) or ON (Sonoff + Light). Then i’m using the Integration - Riemann Sum sensors to calculate Energy. However, it seems that the Riemann Sum is only calculated once when the device is on, and not continuously when the device is off. The configuration of the two sensors is below:

- platform: powercalc
  name: upstairs_bathroom_light_power
  entity_id: light.sonoff_upstairs_bathroom_light
  fixed:
    power: 4.6
  standby_usage: 0.6
- platform: integration
  name: upstairs_bathroom_light_energy
  source: sensor.upstairs_bathroom_light_power
  unit: kWh
  unit_prefix: k
  unit_time: h
  round: 2

Device was turned on and off at ~21:00 and i would expect a slow climb as the “standby” watts should be considered. This is what the integration sensor looks like:

Any thoughts?

As mentioned above, you can use the customize feature for now. I integrated all my breaker circuits into the energy panel by simply using the following customize glob:

"sensor.*_power_meter":
  last_reset: '1970-01-01T00:00:00.000000+00:00'
  state_class: measurement

This obviously means that all your KNX sensors need to be named with the same suffix or prefix :wink:

3 Likes

Currently only Energy is enabled. I read in discord there might be plans to show live power data, but it’s not something the team aimed for with this initial release.

1 Like

ah ok, then i need to convert , any idea how i can migrate this to kWh ?

for example :

  - platform: mqtt
    state_topic: !secret smappee_service_location
    value_template: "{{ value_json['channelPowers'][0]['power'] }}"
    unit_of_measurement: "W"
    icon: mdi:power-plug
    name: "Smappee Huidig verbruik L1"
    device_class: power
    state_class: measurement

Yes, refer to kingphil123’s post above (3rd post above yours).

ah, like this then

  - platform: mqtt
    state_topic: !secret smappee_service_location
    value_template: "{{ value_json['channelPowers'][0]['power'] }}"
    unit_of_measurement: "kWh"
    round: 3
    icon: mdi:power-plug
    name: "Smappee Huidig verbruik L1"
    device_class: power
    state_class: measurement

Power and energy are different things. It will not help to change just the unit.
Have a look at the integration integration if your measurement device doesn’t support energy.

no, i can only create mqtt sensors

Your sensor reports ‘live’ power consumed and simply changing the unit won’t magically make it compute power consumed over time (i.e. “energy”).

If you read the suggested post, you will see it employs an Integration sensor to compute power over time.

1 Like

do this:

  - platform: mqtt
    state_topic: !secret smappee_service_location
    value_template: "{{ value_json['channelPowers'][0]['power'] }}"
    unit_of_measurement: "W"
    icon: mdi:power-plug
    name: "Smappee Huidig verbruik L1"
    device_class: power
    state_class: measurement
- platform: integration
  name: Smappee_Huidig_verbruik_L1_energy
  source: sensor.Smappee_Huidig_verbruik_L1
  method: left
  unit: kWh
  unit_prefix: k
  unit_time: h
  round: 2

some of my character case is not good, but hopefully will give the idea!

1 Like

Hi, I just set up this new energy management using 3 sensors:

  • Solar production directly from the SMA integration
  • House consumption using a Shelly EM
  • Return to grid which is a template that does production - consumption

I don’t understand why in the graph it shows a negative value while I’m actually sending more power to the grid compared to the power my house is using. Do I have to feed this sensor with USAGE - PRODUCTION (resulting in a negative value) or do I have to feed with PRODUCTION - USAGE (resulting in a positive value) so far I tried the latter and I am not sure it’s working as intended.



“Immissione in Rete” means “Returning to grid” which looks fine in the sources list but not in the graph accordin to other user’s screenshots

EDIT: It just updated another candle and in fact it shows it might need a negative value while I used no energy from the grid yet

That’s my question too, and I haven’t seen any of this addressed in the documentation. My main power meter (Shelly EM) already discounts solar panel production, so if my appliances need 2.500W and my solar panels are producing 500W, my Shelly meter shows 2.500-500=2.000W. So, what should I use as my home energy sensor? Usage+production, so solar panel contribution isn’t included in this measure? Or just the total (including panels), and HA will sort it out? What’s the point on having to specify a sensor for injection to grid? It can be calculated easily from the other two.

3 Likes

if you clamped both solar and main counter using Shelly’s two channels you should have two separate entities and therefore you should be able to see them separately, problem is, I do have (like in your case) Power, not energy so my question is: does this Energy management take time into account giving us kWh or we do have to make the calculations somehow?

I have two different clamps in solar panels and main meter, but they are not independent measures, since main meter has already substracted solar panel production. In fact, main meter shows negative readings when solar production is higher than home consumption.

My doubt is if I should do some math in order to remove solar panel contribution from main meter, or if it’s ok like this, and HA will take into account that main meter reading already includes solar panel production.