Energy Management in Home Assistant

anyone got any thoughts on my above post? Energy Management in Home Assistant - #172 by kingphil123

Hi,

You can convert your template sensors to utility meters, it picks up the utility meter.

:space_invader:

Please could you add solar production money calculation in similar way to consumption cost.

All U.K. solar panels installed before around 2019/2020 will get “Feed-in tariff” (FIT). This is a form of payment the government pays at a fixed rate to all solar install. It is based solely on production. There is a regular dumb meter from the inverter AC output and quarterly reading is submitted, money then appears in my account.

2 Likes

I love this! Already added my energy template sensors and CO2Signal and I can see how much power I’m drawing already.

Buying a Shelly EM next, I just can’t figure out if I need 50A or 120A CT (have an apartment in NYC with sub-metered electric so I can’t just read the meter)

After reading the blog post, it seems like a lot of international (to me, usa) users have their utility meters inside?

How can we monitor energy usage if our meters are outside on the house (e.g. National Grid / Eversource?) in the US? I noticed the blogpost talks about ?P1? plugs and monitoring a light with the “Glow”, but I don’t think we have those things here, no?

Not sure how to get started, but would enjoy monitoring the usage outside of our account with the electricity company.

1 Like

In the US a lot of energy meters use a special Zigbee protocol called Smart Energy Profile. It requires special devices, some of which work with HA (ie EAGLE-200). You can check with your energy provider if they support it. Here is an example from my energy provider listing their supported devices.

3 Likes

thanks! I’ll poke around with those links a bit more

I have a similar setup with two Aeotec Home Energy Meter Gen5 (ZW095) - one monitoring solar inverter output, and one monitoring our grid connection.

Grid reports positive when consuming more power than the solar panels produce, negative when we feed back excess back into the grid.

Not finding any discussion about the proper way to configure the new energy integration in this setup, and if flipping the CT clamps would make it work, I don’t understand why.

1 Like

Is it possible to make the energy dashboard update more frequently than once per hour? I don’t mind not updating the third party APIs more frequently to avoid overloading them, but would enjoy perhaps seeing the current hour slowly build as it progresses.

Thanks :slight_smile:

3 Likes

I got this working. First I created 2 new template sensors to get W figures for import/export:

      grid_export:
        friendly_name: "Grid Feed In"
        unit_of_measurement: 'W'
        value_template: >
          {% if states('sensor.home_energy_meter_grid_supply_w') | int > 0 %}
            0
          {% else -%}
            {{ (states('sensor.home_energy_meter_grid_supply_w') | int) | abs }} 
          {% endif %}      
      grid_import:
        friendly_name: "Grid Consumption"
        unit_of_measurement: 'W'
        value_template: >
          {% if states('sensor.home_energy_meter_grid_supply_w') | int > 0 %}
            {{ states('sensor.home_energy_meter_grid_supply_w') }}
          {% else -%}
            0
          {% endif %}

Next I made integration sensors to build the KWhs:

- platform: integration
  source: sensor.grid_import
  name: grid_import_kwh
  unit_prefix: k
  unit: kWh
  round: 2
- platform: integration
  source: sensor.grid_export
  name: grid_export_kwh
  unit_prefix: k
  unit: kWh
  round: 2

Finally I used Customizations (from the configuration section) to set the device class to “energy” for sensor.grid_export_kwh and sensor.grid_import_kwh

11 Likes

I am using the Aeotec Home Engergy Meter Gen5. I have a question how to set this up.

I have a utility meter setup like this:

utility_meter:
  monthly_energy:
    source: sensor.home_energy_meter_gen_5_electric_consumed_kwh
    cycle: monthly
    offset:
      days: 26
    tariffs:
      - peak
      - offpeak
  daily_energy:
    source: sensor.home_energy_meter_gen_5_electric_consumed_kwh
    cycle: daily
    tariffs:
      - peak
      - offpeak
  hourly_energy:
    source: sensor.home_energy_meter_gen_5_electric_consumed_kwh
    cycle: hourly
    tariffs:
      - peak
      - offpeak

as well as the automations to switch tariffs.

Do I use the hourly_energy, daily_energy, or just the raw sensor in the energy configuration?

Thank you,
David

You can the add the needed attribute through customization. Works fine for me, e.g.

homeassistant:
  customize:
    sensor.energy_daily_lights:
      last_reset: "2021-07-30T00:00:00+00:00"
      state_class: measurement
2 Likes

It seems that something is not working correectly.
I i compare my energy app from Homewizard with the new HA energy tab.
The numbers dont add up correctly.


Below are the settings, did i make a mistake here?

As long as there’s a cable getting inside your home, you can place a clamp like Shelly EM and monitor power.

Thanks!
Tried that yesterday (SEK instead of USD, but same principle)
Didn’t work when I tried it, hence why I wondered about exact syntax to use.
tried again now, and now it worked!
Perhaps it was fixed in the 2021.8.1 this morning.

1 Like

Congrats to the team on an INCREDIBLE addition. Home Assistant changed my life on both my farm and island in how I manage my off grid solar production and storage. I would love to contribute in any way possible to help further this. I think that a key piece that is needed is Battery Storage monitoring, so I have attached a small recommended approach in the image. I am more than happy to make my IslandAssistant accessible to the devs, as I have 2x75kWh reclaimed Tesla Model 3 battery packs, 12x5kWh Tesla Model S Modules, some wind and hopefully wave and tide in the future.

Snap001

13 Likes

Hi All,

When I enable CO2Signal I see those errors:

2021-08-05 20:51:16 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform co2signal
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 587, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 711, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 464, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 498, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 470, in _stringify_state
    state = self.state
  File "/usr/src/homeassistant/homeassistant/components/co2signal/sensor.py", line 127, in state
    return round(self.coordinator.data["data"][self._description.key], 2)  # type: ignore[misc]
TypeError: type NoneType doesn't define __round__ method
2021-08-05 20:51:17 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up co2signal platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 257, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 587, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 711, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 464, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 498, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 470, in _stringify_state
    state = self.state
  File "/usr/src/homeassistant/homeassistant/components/co2signal/sensor.py", line 127, in state
    return round(self.coordinator.data["data"][self._description.key], 2)  # type: ignore[misc]

Hello
I have similar question. On my side I used the Aetoec Raw sensor providing the consumption in kWh. It works and I get the hourly Bar Chart in new Energy Dashboard, however I would like now to represent the OffPeak + Peak Consumption (and then enable so the Price setting), but I don"t know how to do. I also have the utility_meter configured as yours (+ automation to switch the Peak / Offpeak) but don"t know which sensor to put in the new Energy Configuration to represent the 2 consumptions Offpeak and Peak. If someone has an idea it’s more than welcome

Frenck,
I have a Solaredge too, OK for solar production I can take the lifetime energy as you do, but I also have that solaredge module that reports grid import and export. Solaredge reports this in Wh by default, not in kWh so when it comes to electricity grid, the sensor.solaredge_exported_power and sensor.solaredge_imported_power (or sensor.solaredge_consumption_power and sensor.solaredge_production_power) are not listed and not usable. Is there any way to fix this ?

You can either long-click on the sidebar header (where it says Home Assistant) or go to your profile in the sidebar and select “Change the order and hide items from the sidebar”.

2 Likes