Home Energy Management in 2021.8

It’s impossible. What version of HA are you using? Is there something in the log? Errors, warnings, etc.

Go in dev tools-> statistics, tell me what you see there.

image

@Max1963
Not sure if this might help. I had to enable the last reset. device class should be set to energy which you have done.
I did set this general setting into the customize_glob entry.

# Home Assistant customization for Energy Sensors
homeassistant:
  customize_glob: !include customize_global.yaml
# General customization for energy sensors
# Set class to energy and enable statistic
"sensor.*_energy":
   last_reset: '1970-01-01T00:00:00+00:00'
   device_class: energy
   state_class: measurement

# General customization for power sensors
# Set class to power and enable statistic
"sensor.*_power":
   last_reset: '1970-01-01T00:00:00+00:00'
   device_class: power
   state_class: measurement

Salve @alexdelprete
mea maxima culpa! the Peak shows the battery positive power which is usually the action when the solar charges the battery. Totally weird and i do have no explanation for it. Kind of curious as well.

Here is the flow:

And here is the sensor… it suddenly peaked up.
2021-11-15_19-20-22

This is how it should happen. From the solar to the battery.
2021-11-15_19-21-24

HA core-2021.10.6; no error or warnings; no problem related to ShellyEM sensors also in statistic.

Many thanks ArminF, but as Alex wrote seem that ShellyEm doesn’t need modify to custon configuration… but I’ll try anyway your tip.

last_reset is generally not used anymore since HA 2021.9, unless you have a specific requirement. what state_class are you using? if it’s a sensor that can increase and decrase then it has to be used, together with state_class: total. He uses a Shelly EM, the energy sensor always increases, so he doesn’t need last_reset.

No need for last_reset, the Shelly EM energy sensor is always increasing, it doesn’t reset to zero:

Do you have a specific configuration for recorder? Did you filter out something?

The pink line in the energy flow goes from solar to battery, so it looks ok. I don’t understand why you say it comes from grid…

Max, open the sensor and show me the history, like this:

image

Good advice Alex, no history there, I’ve exclude sensors in the recorder as they broken my last two SD card for too much records written… so this could be the problem! Is there a method to select what sensor data collect and what don’t record?

yes, from the color the line looks like it does come from the solar panels to the battery.
But we did not had much sun here in Switzerland the last few days and my SoC on the battery shows 0%.

This peak where it suddenly raised up this morning 9 am . Could it be a maintenance and then the server found data for the sensor? A restart?

But still should it show more than the solar production shows?
am i able to reset these values?

This did the trick, many many thanks Alex!!!

1 Like

I was pretty sure about the recorder, since I read “No statistics available” in the energy integration.

Sure, and you used it, excluding sensors. :slight_smile:

Study this: Recorder - Home Assistant

This is how I use it: added only an exclude section, and you can use wildcards for names, or exclude domains.

exclude:
  domains:
    - device_tracker
    - media_player
    - uptime
    - time_date
    - worldclock
  entity_globs:
    # - sensor.snmp_stats_*
  entities:
    - sensor.tempest_direzione_del_vento_rt
    - sensor.tempest_velocita_del_vento_rt
    # - sensor.consumi_condizionatore_power
    # - sensor.consumi_prese_casa_power
    # - sensor.consumi_condizionatore_voltage
    # - sensor.consumi_prese_casa_voltage

Just wait for the next cycle…tomorrow, and check. I can’t tell you what’s going on there, and if the values are correct or not.

Like I told you: check EACH sensor, one at a time, if it’s working ok. If the battery sensor says 15,85kwh check if it’s true. If the solar energy sensor says 9.49kwh, check on the inverter if that’s true. etc.

I can’t tell you if the values are not ok…

No problem. I was confident that was the issue.

One advice: if you want to use HA seriously, don’t use RPi with an SD card. Get another device or use the RPi with an SSD. SD cards are not designed for this use case, you will only have issues and limitations if you use them like this.

Will do! Thank you very much.

Let me know how it goes…:slight_smile:

Thanks also for this advice, I’ve already take into account to traslate HA config on SSD, expecially now that all my domotics are on the hub.

With time, the more you will depend on those, more things you will install, more you will understand that RPi is not the best platform for this.

Alessandro,
i have to go over the sensor calculations again. I guess there is the issue with these peak.
Do you have me any tip how i can deal with negative values?

My Battery and my Grid Power sensor does show -/+ values. But for calculation i have to sort this out as i need only positive numbers. I used a idea from another topic but i think this does not work as i assume it should.

thanks
armin