Energy Management in Home Assistant

if you go to Developer Tools and then statistics you may be able to do this by finding the relevant sensors and clicking on the adjust sum button on the far right.

This is how I’m calculating savings from my solar and battery systems both individually and collectively.

This is something I’ve attempted to do partially. My v1 approach was to calculate out what my energy consumption would have cost had I not installed PV and then take that savings (ignoring time value of money for now) from what I paid for the system.

What I have done is built a dashboard in Grafana that uses a series of SQL queries (with lots of help from the community) to my MariaDB to extract some of the datapoints and then calculate on them.

  1. How much energy has my house consumed since my PV install - it’s using a Tesla Powerwall sensor to gather this data point.

  2. How much would that energy consumption cost had I not installed PV. Data point from 1 multiplied by the average cost per kWh from my energy company. Note this isn’t calculating in inflation or raising rates yet. Hypothetical energy cost.

  3. How much I have paid my energy company since I installed my PV system. This is a manual input sensor in HA since I haven’t found a way to get this automatically added. Each month I enter my balance due from my energy bill. Actual energy cost.

4.Calculate how much have my “savings” paid back my investment. E.g. ((Total Investment) - (Hypothetical Energy Cost - Actual Energy Cost)) = remaining balance to payback. Once this number is positive, the system has paid for itself.

As I stated above, this ignores inflation and time value of money, but I figure I’ll tackle those aspects after I figure out how to get this into HA as a native sensor instead of through Grafana. And then, my ultimate goal was to have an HA sensor that shows the projected payback date, but I haven’t gotten that far yet. I still have a ways to go here. But at least after a year of ownership I can tell how much the system hypothetically saved me!

Suggestions and feedback on this are appreciated.

Did you ever find some type of solution that’s ‘good enough’ that covers the multiple variables? - here in NSW with Energy AUstralia I have 8 time sets depending on the season - which could mean i’d need to setup 16 time start / stop helpers and a further 6 for season stop / start…grr…then somehow incorporate the ‘controlled load’ which is just the hot water on a timer…heh

I don’t use Home Assistant for tracking energy costs. Too much of a PITA. I just do it in Excel. I may should one day HA add something to the energy dashboard set up to make it easy, but I have little interest in mucking about coding stuff.

1 Like

Are you sure about this calculation? Isn’t imported energy simply a value that is read through a sensor? Am pretty sure that is the case in my situation…

Yes, grid import and export are / can be read from meters. The calculation I quoted was just to show how it all fits together and balances. Beware mixing kw (power) and kwhrs (energy) though.

I’m looking for some help here to get a number of systems all appearing in the same reporting window.
I have 3 separate solar systems of 6Kw. Each is linked to an SMA inverter of 5Kw. These are then connected to a SMA home manager recently installed. (I installed this as the 3rd system was not going to be read by my existing SMA energy meter apparently)
I am also an Amber (AUS) customer.
I also have a Sonnen 13.5Kw battery linked into my MSB.
Before installing the battery and the new 6Kw array I could read the two SMA inverters through the SMA smart meter on the energy dashboard by using the SMA integration.
I have read recently that the SMA integration doesn’t talk to the Home manager 2?
Anyway to be able to get some understanding of my energy flow, usage , grid feed etc I now navigate between the Sonnen app, sunnyportal and the Amber app.
Would really like to be able to send all relevant data through to HA for management with a view to using EMHASS to really get some smarts in the mix.
Does anyone have any ideas to assist?
Pat

Chuck an IotaWatt on the outputs of each inverter and your main grid input? add each inverter as an energy source in dashboard

Dean
thanks for the idea - I am trying to avoid buying yet another set of gadgets to do a job that the original units should do. I am talking with SMA about this and my solar installer. If I find a better solution I will post.
Pat

there’s a Home Assistant modbus integration that talks to a number of inverters, why can’t that talk to all 3 SMA inverters that you have…Read the MPPT power directly into HA and into your solar production in your energy dash…Bonus, each inverter is likely to have at least 2 strings, so graphing all 6MPPT’s will look much cooler in the dash and also give interesting data at different times of the year when your panels work differently.
Also, there seems to be a number of Sonnen battery integrations.
Finally, if you can’t read the new inverter, what’s different? - could it be a simple addressing issue? - i.e. two devices may have the same ID,

Do you have metering installed for all 3 inverters?

I have two Sungrow inverters, both happily chirping out MODBUS data for all 4 of my MPPT’s

On this parameter


Electricity meter represent the reading of the counter of the house. It’s the absolute value on the counter at that moment.

For instance,
at 08:00 / 8495.5 kwh
at 10:00 / 8494.2 kw/h
electricty_meter = house consumption + solar production.
In this example my solar production produce more than the house consumption, thus counter is decreasing as there is return to grid of 1.3kwh

On energy dasboard, it’s translated in positive value is grid consumption and negative value is when it’s returning to the Grid.
Fine but I can’t use this in return to grid section because it give graphic is the reverse way.

There is no possibility to say in HA : if positive value (increasing kwh) then it’s grid consumption and if it’s negative value (counter going in reverse way - decreasing kwh) it’s return to grid ?

I think this subject is already discussed but I didn’t find any good post or documentation explain the best practice.

Hi, sorry to bother you all with probably beginners questions. In my energy dashboard I have added quit a few sensors of existing hardware. I would like to start a setup for batteries which I can extend to approx. 20 kwh. I would also like to influence the offload to match the nightly.use. There is a lot to read and don"t know what is working. Thought I would ask the combined brainpower here for some guidelines where and how to start.

Think there are two possibilities/best practices:

  • Ask for a dsmr slimme meter; they will provide this as soon as you mention you have solar panels.
  • You can add additional counters so you will have a total, consumption and production counter.

Thank you @WJ4IoT
I finally did myself via template and filter integration. It’s not 100% accurate but it’s better then before.

  • Create a template sensor to remove night bad reading (removing negative value) triggered when meter state change.
  • Filter this template sensor
  • Create a template sensor triggered by filtered value state change containing the delta and also a binary sensor with auto state off. This will serve for calculation for the next action.
  • Create 2 template sensor triggered by the binary sensor from the previous template in order to populate data for the return to grid and consumption from grid used by the energy dashboard .

I prefer to keep my old counter because if I ask for a numeric counter, this will not go anymore in the reverse way when you return to grid.

Filtering part is not easy, I tried low pass but nok (not following max and min) . From now I used this config:

filter: time_simple_moving_average
         window_size: "00:20"
         precision: 1

Glad you found your HA-solution on your old analog meter.

That statement is not true, the are some digital meters with a single meter which do/did not reverse (got one years ago at the same time 4 solar panels were installed) but in principle you should get a SMART (read big brother is watching you) meter consisting of (4) separate meters. Two of them will report your production to the grid, which are you returns (likely before “saldering” roundish 60-70%). This kind of meter will work seamlessly in HA. And yes, The subject of “saldering” and your obligation (*) to report you solar panels is a completely different topic.

Aanmelden zonnepanelen wettelijk verplicht

Volgens de Europese en Nederlandse wet- en regelgeving is zonnepanelen aanmelden verplicht. Deze regelgeving is vermeld in artikel 40, vijfde lid, van Verordening (EU) 2017/1485 (de System Operation Verordening).

BTW for argument sake I dislike the upcoming changes in the “salderingsregeling” too (if you live in the Netherlands) but again this is a completely different topic.

All my solar systems is installed since more than 10y and it’s know by the authority. So I don’t have any issue. This is just the rule they applied, either you choose the taxes based on your inverter power (1Kw = 108eur) with the old gen counter or you upgrade to numeric without taxes, with reinjection for ridiculous price and keep just energy groing when you take from the grid, no more reversed way like old gen.

Ah, those are the rules in Belgium, right? I understand why you want to keep your analog kit…

Correct, Belgium with ridiculous amount of sun :wink:

We are charged a utility cost each day regardless if we use electricity or not.

How do I add this fixed cost to the energy panel so it adds it to the total cost.