I created an entity in Node Red and added it to the Energy tab as solar system. In my dashboard I can see the right output power, but not in the energy tab, there is a completely different value. I also don’t get any error messages or warnings.
Although it is a little challenging to work out what you are doing just from pictures, I suspect you are taking power (watts) figure from your inverter, dividing by 1000, and saying that this is energy kWh.
This stuff can be confusing, and there is a section in the HA documents all about the difference between power - watts, and energy - kWh
One answer - use a Riemann Sum (either set up using the new helper or hard code into configuration file). For this you need the power (watts) that is updated regularly, ideally every few seconds. The Riemann sum adds up the individual power measurements over time and provides a kWh output. For the energy dashboard to work the solar energy value needs to be just like any utility meter in that it is a total kWh energy produced that always increases with time (the energy tab does the work of slicing the increasing energy into hours and resetting the value every day, at least most of the time it does).
With the new helpers, setting up a RI sensor (power → energy) is very easy
to give it your power sensor (here I use my Modbus Solar Power entity) which is in watts
to select the integration, trapezoidal is a safe bet
to select the precision (number of decimals you want)
select k and it will scale by dividing by 1000
select h and it will produce /hours
and bingo - watts becomes kWh
My inverter is a Solis, and I have to pull the power value every 20 seconds using Modbus. This I do using Node-RED, and then like you are doing I push the captured power value to HA using an entity node. Then in HA I use an RI entity to turn this into energy, which I have added to the energy dashboard.
You appear to have a Growatt inverter, and HA has a complete integration for that, so I am not even sure why you are having to do any of this in the first place.
As you appear to have only joined the HA community recently, I suggest that you search for postings for the Growatt Inverter - there must be someone who has answered this old chestnut before!
Try reading from (and the response - which explains the sensors and reasoning used):
The sensor I suspect you require is ‘Total Lifetime Energy Output’ or, in other words, the total kWh produced since I turned the inverter on. Just the same as my electricity meter ‘Total Lifetime Energy Consumed’.
For most inverters there is an figure ‘total energy’ which is kWh, and I guess this can be used directly into the energy dashboard thus avoiding having to do a Riemann Sum. In my case, my Solis inverter has this, but the precision is only kWh and no decimal places, it updates only infrequently, and it rounds it in odd ways, which is why I prefer to go down the instantaneous power → energy kWh route.
Hi, thanks for your reply.
The addon growatt_server I testest already. But if I add “Total Lifetime Energy Output” to the energy tab, I get wrong values displayed there too. That’s why I do it via nodered.
My guess is that you are sending both a msg.payload, and another entity value in the Node-RED entity as you have included ‘attributes’ which I believe are unnecessary.
However you wish to end up doing this, the energy dashboard is expecting for solar production an entity that is energy (device class energy) and in something like kWh with a state class this is total or total increasing.
The value of this entity must always go up and never reset. The energy dashboard works out the increments per hour for the bar chart, and does the reset each day around midnight. If you send power, or you reset the value, or your value goes down, then it will probably confuse the dashboard.
The Node-RED entity node works well, but it is not clear how to set it up, and I struggled with this one for quite a while. I found that I did not need the attributes at all, just the Home Assistant config. I also found that the last-reset is not something that really should be used.
Here I am sending a daily energy value from my inverter for display in a power (energy) card (this is another power card and not the main energy dashboard).
The payload is a value (number) representing the kWh generated today, and is reset to zero by the inverter at change of day.
device class is clearly energy (as this is energy not power)
unit of measurement is kWh (inverter presents this as kWh)
and the state class I use is measurement, as it is measuring something (and is, here, neither total or total increasing as it goes back to zero every night).
The last-rest setting appears to be redundant, since either my inverter is doing the daily reset, or the energy dashboard display is doing the reset.