Home Assistant new Energy features

Long time HA user here and been using emonCMS for a few years now. Great bit of open source softwares, thank you!

HA just released 2021.8 which has focus on Energy Management.

But unfortunately the official Emoncms integration isn’t included in their energy filtering. It also doesn’t appear to expose to HA the necessary statistics to use in the energy dashboard :frowning:

Any ideas?
Is this something you or code owner for the HA integration need to update?

The learn more link takes you to here:

2 Likes

Tried to add all characteristics to the sensor (metered etc ) but no success

By the way: how dig you get to the dashboard… I cannot even get to that.
If I am looking for energy integration all I can find is the currently compatible energy integrations

I got it working, just seen first bar appear :smiley:

Need to add total consumption / return / solar template sensors (using this as my starting point and this to set last reset time).

Here is my config using EmonCMS. You’ll need to set up all-time total kWh as one of the feed in EmonCMS.

homeassistant:
  customize_glob:
    sensor.haenergy_*:
      last_reset: "2021-08-05T08:05:00+00:00"
      state_class: measurement

template:
  # Home Energy sensors for HAEnergy
  - sensor:
      - name: HAEnergy Consumption
        state: "{{ states('sensor.emoncms2_import_all_time') | float | round(2) }}"
        unit_of_measurement: "kWh"
        state_class: measurement
        device_class: energy
      - name: HAEnergy Return to Grid
        state: "{{ states('sensor.emoncms2_export_all_time') | float | round(2) }}"
        unit_of_measurement: "kWh"
        state_class: measurement
        device_class: energy
      - name: HAEnergy Solar Production
        state: "{{ states('sensor.emoncms2_solar_all_time') | float | round(2) }}"
        unit_of_measurement: "kWh"
        state_class: measurement
        device_class: energy

Just to clarify for people searching:

In emonCMS, you’ll need to generate the following feeds:

  • import_all_time
  • export_all_time
  • solar_all_time

Then import the feeds into HA using standard emonCMS integration.

Finally, simply copy and paste the above config into configuration.yaml. Restart HA and now you will see selectable entries in the HA Energy configuration page.

It will be automatically added after upgrading to 2021.8 if you use default_config.

Otherwise to get to this new energy integration, you need to add this to your configuration.yaml.

energy:

It would be good if it integrated, but although I did some minor updates to the integration, doing anything further is beyond my Python skills.

Ideally it would be configured from the UI as well.

If anyone is interested, feel free to contribute.

Fair enough. The previous change to add units is much appreciated.
I don’t really understand python, so it’s beyond me unfortunately.

Agree, ideally it would use HA’s integration UI and be brought up to their latest standard with all the necessary attached metadata.

I think my template and the customize bodge works well enough thanks to HA’s incredible flexibility. All it needs is end user to configure all-time total kWh feeds in emonCMS and then bring it into HA, finally use my configuration above to make it selectable.

This integration needs to be overhauled and updated for config UI etc. and this. I will try to get it added to development at Carbon Co-op as we are using HA a lot now.

2 Likes

That would be great if you could :slight_smile:

This of course adds extra impetus to looking at getting the Emoncms Add-on going properly.

My biggest concern with the HA implementation would be the integrity of the long term data.

Hi,

Would you mind sharing your emoncms config for the import_all_time feed?

Thanks in advance!!

Sure, hopefully this is what you are asking for:

In EmonCMS, go to Setup → Inputs and click the little spanner to add the circled part to your solar production (assuming your solar generation reads power in W or kW, not energy Wh or kWh) to get that Feed.

In EmonCMS, I have 3 power inputs: solar production, grid power (this one goes negative for export) and a house fuse-box (or consumer unit) consumption. Not directly measured is outdoor EV charging, but it can be easily calculated.

When you add a process, the blue description text box below tells you the output from that process, the output is then fed into the next process, this way you can do maths or logic. Very elegant solution to provide huge amount of flexibility, well done whoever designed it.

1 Like

I have used the standard feeds set up when I installed my emonPi for solar/consumption monitoring.
Took a while for info to start showing up, and I haven’t yet seen everything populate including solar production and widgets. Not sure if this is because I am not using the correct feeds…

  - sensor:
      - name: Consumption
        state: "{{ states('sensor.emoncms_import_kwh') | float | round(2) }}"
        unit_of_measurement: "kWh"
        state_class: measurement
        device_class: energy
      - name: Return to Grid
        state: "{{ states('sensor.emoncms_use_kwh') | float | round(2) }}"
        unit_of_measurement: "kWh"
        state_class: measurement
        device_class: energy
      - name: Solar Production
        state: "{{ states('sensor.emoncms_solar_kwh') | float | round(2) }}"
        unit_of_measurement: "kWh"
        state_class: measurement
        device_class: energy

One thing I like about this new ENERGY integration in HomeAssistant is that it is very easy to see electricity tariff info and COSTS. I split grid imports into Peak/OffPeak Feeds in EmonCMS. This allows me to enter TWO consumption entities in the Grid Consumption section of the Energy Integration.

1 Like

… and for anyone following along … this is the input process …

I have one Schedule defined in EmonCMS called ‘Peak’ which looks like this:

Screen Shot 2021-08-08 at 13.51.31

As today is a Sunday (actually is a nice Winter Sunny Day :smiley: )
my ‘peak’ costs are currently zero.

Hope this helps other HA users out there. Regards

3 Likes

Thank you, having used openenergymonitor since 2013 its great to see others focusing on energy as well and it would be superb to have this functionality in my HA

how did this turn out as my feeds are also different and my data is all at 0 even the distribution on the right hand side

  - sensor:
      - name: HAEnergy Consumption
        state: "{{ states('sensor.emoncms_import_all_time') | float | round(2) }}"
        unit_of_measurement: "kWh"
        state_class: measurement
        device_class: energy
      - name: HAEnergy Return to Grid
        state: "{{ states('sensor.emoncms_export_all_time') | float | round(2) }}"
        unit_of_measurement: "kWh"
        state_class: measurement
        device_class: energy
      - name: HAEnergy Solar Production
        state: "{{ states('sensor.emoncms_SolarTotal') | float | round(2) }}"
        unit_of_measurement: "kWh"
        state_class: measurement
        device_class: energy
      - name: HAEnergy EV Consumption
        state: "{{ states('sensor.emoncms_Power3EV') | float | round(2) }}"
        unit_of_measurement: "kWh"
        state_class: measurement
        device_class: energy

This is what I see from my emonpi (note I don’t have solar panels, so just consumption to capture)

On the HA side:

I don’t see anything populated in the energy dashboard…

Entity view:

Configuration:

2 posts were split to a new topic: MQTT connection errors