Home Assistant new Energy features

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

I’ve set this up, but either I am misreading this, or it is not quite as expected. I’m wondering whether HA expects both positive and negative values from “grid”

image

I think we might be in the same boat - I have Type 2 solar PV setup so it is calculating export off a negative figure. I didn’t think it through when I just assigned my 3 x standard kWh feeds to HA, which will never work. I need to find time to rethink the logic and then set up a new feed in emonCMS to provide an Export sensor to HA.

  • CT1 (power 1) = grid import (positive) / export (negative), and
  • CT2 (power 2) = solar generation,

Type 2 system: Site-consumption = Generation + Grid import (negative when exporting)

HA is expecting energy (kWh) figures in same style as always incrementing meter readings for:

  • Consumption
  • Export (return to grid)
  • Solar

If you have a single sensor reading positive for import and negative for export, you’ll need to do something like this to the input:

  1. *-1
  2. allow positive >0
  3. power to energy kWh (this is your export feed for HA)
  4. reset to original
  5. +solar
  6. power to energy kWh (this is your consumption feed for HA)

HA isn’t expecting negative figures. All 3 energy readings should be always increasing.

Thanks @wyx087, I assume I can flow this on from the existing input process? Only bit I can’t figure out is your first process step. Can you explain how to add a wildcard process or how would it appear in emoncms process list options?

Taking input ‘power 1’ and adding processes:

[quote=“Tockley, post:22, topic:18301”]
I need to find time to rethink the logic
[/quote]I might just wait for you to figure it out :slight_smile:

@Tockley the command you actually want is x -1 (where x = times and then minus one)
image

Back to HA though:
This is one of the things that pisses me off about HA, it does everything but the docco and how data flows is manipulated is significantly under-described.

I mean, there is NOWHERE to find out how the energy part is calculated, what it expects, etc.

:sweat_smile: :man_facepalming: of course, thanks.

No I think it was fine (and obvious in hindsight), my brain didn’t make the leap though

Apologies, that wasn’t clear. I thought I’d use mathematically correct character as input on computer. But obviously it doesn’t read correct and I forgot to check how it is displayed on EmonCMS.

Agree. The documentation for this new energy feature is waaaaaay less than their usual integration. I only figured out everything by very closely follow the thread on HA community. Even then, people had to guess how the dashboard is updated.

Would love the documentation about now too! :expressionless:
My data seems to have gone a bit haywire after making the corrections to my feeds from emoncms just for one period today… don’t suppose anyone has figured out how to remove/reset energy data?

I think the next day will give you correct data.

From what I can gather, the calculations are done after each hour, comparing current value against value from 1 hour ago. So check again tomorrow and everything will look correct.

But no idea how to reset apart from blow away your whole database. If you use MariaDB, you can try using phpMyAdmin add-on, then manually find & delete relevant entry.

1 Like

Which I think is a significant flaw. I’m going to be very interested in seeing how HA handles a reset to zero of the measuring kit due to a power cycle.

It is one of the frustrating things about HA. The Devs implement things that will suit them very often and to hell with the rest. A ‘My way or the highway’ attitude. The fiddling of the templates is a good example of that. They didn’t use them so didn’t care they broke a load of instances. The excuse ’ it was an undocumented feature’.

I think I have discovered how the energy thing is calculated. I brought into HA derived feeds for my CU consumption and EV charger consumption. So I removed whole-house consumption from energy dashboard and added the two new-to-HA entities.

This is what I get now. Going back, all my consumption data is gone from the graphs.

Therefore the energy dashboard is derived from historical data saved for the entity. Because HA doesn’t know my CU consumption increments before 4pm, it isn’t in its recorder database.

So to get rid of previous negative data. You can rename your entity by rename the feed in EmonCMS. Unlike simple entity rename, this should create a new entity within HA, thus removes prior data and gives you a clean slate.

I think you will get negative data for that reset hour. Because it compares new value to previous hour in its database. Then it should continue as usual.

Well, I think their pace of change and breaking changes get a bad rep. I’ve been using HA for almost 4 years. The early bodged template based automations still work to this day. All I do is carefully read breaking changes and never had any problem that couldn’t be fixed within an hour of upgrading to new major releases, or rolled back if it was a bug and wait for it to be fixed.

This looks fantastic, it would be great to get OpenEnergy monitor integration working with this. I’m a long time HA user myself. The Emoncms HA integration was done by a contributor.

1 Like

Yes I’ve been using it for a while and invested in a Blue as the Pi4 was simply too unreliable (as the Devs all use Blues - that is their focus - and you could not easily run HA OS on an SSD at the time).

Yes always read the breaking changes - I also don’t update until the end of the month.

It isn’t about pace of change, it is how the change is implemented relative to the extensive user base that often is the reason it is so successful. I suggested a couple of changes - actually corrected bad assumptions in the programming and it simply got shut down with a NO! I don’t bother now.

Thing is, it really cannot be mainstream while they roll out releases with so many bugs and breaking changes. It is a recurring theme that the Devs simply do not listen especially if it is in an area they do not use.