Home Assistant new Energy features

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”


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)

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.

I see what you are saying, yes, I’ve seen this on a couple occasions, especially for feature requests. Thankfully bug fixes seems to be done quite quickly.
This kind of attitude seems to be common for huge open source projects. Perhaps it’s the amount of pestering they get that closes their ability to care.

RPi does have its limitations. I went from virtual env to supervised. They published plan to axe supervised method but then made a U-turn on that. Sensing their focus is on HA OS, I now run Proxmox with HA OS as a guest OS on an i7 custom miniSTX box.

1 Like

I believe I have it working as expected for my “type 2” setup:

My three feeds are:
Import configured as:
Clamp 1: (clamped on grid)
“Allow Positive”
“Log to feed” Import
“Log to feed” Import_kwh

Returned to grid configured as:
Clamp 2: (clamped on PV)
-feed (clamp1:use)
“allow positive”
“Log to feed” export
“Log to feed” export_kwh

Solar configured as:
Clamp 2: (clamped on PV)
“Min value allowed >5”
“Log to feed” solar
“Log to feed” solar_kwh

I also unpicked a decent amount of how it works and posted the info here: