Energy Management in Home Assistant

Yes. Since September version.

1 Like

all graphs and automation show UTC as well since the update for me. Energy dashboard is completely broken atm, lets see what it does in 2h or tomorrow.

I had the Integration - Riemann sum integral working perfectly for my energy management in 2021.9
Since updating to 2021.10 they are not supported anymore for energy management ?! :frowning:

What is your basis for this allegation?

1 Like

Using Aeon HEM Energy; because it has some spikes on the reading sometimes, i use outlier filter:

  - platform: filter
    name: "Aeon Hem Energy Filter"
    entity_id: sensor.home_energy_meter_gen5_electric_consumed_kwh
    filters:
      - filter: outlier
        window_size: 10
        radius: 5.0

I think filters also should be included in the “Add Consumption” entities; otherwise those spikes in the reading keeps energy management useless for me. Right now i am using “Utility Meter” which is fed from the outlier filter. Works within the month but all goes sideways when utility meter resets at the end of the month:

utility_meter:
  monthly_home_energy:
    source: sensor.aeon_hem_energy_filter
    cycle: monthly
    offset:
      days: 21

In 2021.9 this worked fine:

  - platform: integration
    source: sensor.grid_imported_power
    name: em_grid_imported_power
    unit_prefix: k
    unit_time: h
    method: left
    round: 2

  - platform: integration
    source: sensor.grid_exported_power
    name: em_grid_exported_power
    unit_prefix: k
    unit_time: h
    method: left
    round: 2

  - platform: integration
    source: sensor.solar_generated_power
    name: em_solar_generated_power
    unit_prefix: k
    unit_time: h
    method: left
    round: 2

Now I cant use this type anymore. :worried:

If you can go to the developer tools and show us all the attributes for the sensors you think should be available that will help

1 Like

Im getting live data every minute from 10 sensors.

Example:

unit_of_measurement: W
friendly_name: Senec_solar_generated_power
icon: mdi:solar-power

The make integration sensors show up in the energy dashboard, set these 4 values, then Ctrl+F5, reload, restart etc:

unit_of_measurement: kWh
state_class: measurement
last_reset: 0
device_class: energy

Error Message possibly related to broken UTC times and broken Energy Dashboard:

Logger: homeassistant.components.recorder
Source: util/dt.py:133
Integration: Recorder (documentation, issues)
First occurred: 11:05:21 AM (168 occurrences)
Last logged: 11:50:10 AM

Error while processing event StatisticsTask(start=datetime.datetime(2021, 10, 8, 9, 25, tzinfo=datetime.timezone.utc)): argument 1 must be str, not int
Error while processing event StatisticsTask(start=datetime.datetime(2021, 10, 8, 9, 30, tzinfo=datetime.timezone.utc)): argument 1 must be str, not int
Error while processing event StatisticsTask(start=datetime.datetime(2021, 10, 8, 9, 35, tzinfo=datetime.timezone.utc)): argument 1 must be str, not int
Error while processing event StatisticsTask(start=datetime.datetime(2021, 10, 8, 9, 40, tzinfo=datetime.timezone.utc)): argument 1 must be str, not int
Error while processing event StatisticsTask(start=datetime.datetime(2021, 10, 8, 9, 45, tzinfo=datetime.timezone.utc)): argument 1 must be str, not int
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 673, in _run_event_loop
    self._process_one_event_or_recover(event)
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 682, in _process_one_event_or_recover
    self._process_one_event(event)
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 788, in _process_one_event
    self._run_statistics(event.start)
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 771, in _run_statistics
    if statistics.compile_statistics(self, start):
  File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 315, in wrapper
    return job(instance, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 336, in compile_statistics
    platform_stat = platform.compile_statistics(instance.hass, start, end)
  File "/usr/src/homeassistant/homeassistant/components/sensor/recorder.py", line 388, in compile_statistics
    result = _compile_statistics(hass, session, start, end)
  File "/usr/src/homeassistant/homeassistant/components/sensor/recorder.py", line 516, in _compile_statistics
    last_reset := _last_reset_as_utc_isoformat(
  File "/usr/src/homeassistant/homeassistant/components/sensor/recorder.py", line 371, in _last_reset_as_utc_isoformat
    last_reset = dt_util.parse_datetime(last_reset_s)
  File "/usr/src/homeassistant/homeassistant/util/dt.py", line 133, in parse_datetime
    return ciso8601.parse_datetime(dt_str)
TypeError: argument 1 must be str, not int

You can’t add that sensor as that is a power sensor (W) not an energy sensor (kWh)

I cant get your point.

I am using this one. That’s not a power sensor (W)

  - platform: integration
    source: sensor.sum_house_power
    name: Stromverbrauch
    unit_prefix: k
    unit_time: h
    method: left
    round: 2

OK so can you now post all the attributes of the sensor that is created by that integration?

I fixed it for the most part at least for the spike in the morning. I worte 0.01 and 0.02 values at one hour, 10 min 10sec before sunrise. The 10sec and 10min were not enough and still had a spike but already a lot smaller. For the spike during a cloudy day I still have no solution.

I still hope this will be fixed in homeassistant so I don’t have to create these strange automations

edit : deleting .storage/energy in your config directory will reset it

Anyone seen this problem with HA gas not calculating price?

It’s straight forward kWh gas meter and static price. What could be wrong here?

image

image

I have exactly the same issue in Euros/KWh.
I have an opened (not read ! PR)
Phil

1 Like

I fixed it via customization: You have to select device class “energy”

1 Like

See my screenshot. It has got all the correct classes/attributes.

Although it didn’t start correct when I initially added it. I wonder if that’s the cause…

I have exactly the same issue.
The only thing I found was this error in the logs.
Found unexpected unit kWh for sensor.gas_consumption_today
2021-10-13 10:54:02 WARNING
I had no problem adding the sensor and it counts up the kWh but just won’t add up a static price.

Same !
And developers said me that this was not in their roadmap to fix such issue
We all have to make PR
Regards
Phil