home-assistant-rct-power-integration
home-assistant-rct-power-integration copied to clipboard
fix issue #258
Changed SensorStateClass for Inverter Energy Production Day/Month/Year/Total from TOTAL_INCREASING to TOTAL.
Thanks for taking the time to submit this.
I'm not sure this will produce the correct long-term statistics, though. As I understand the docs, the total
state class for the daily, weekly and monthly entities would have to be accompanied by a last_reset
value in order to exhibit the expected behavior. Support for negative values is not great overall.
We could try to work around this by inverting the sign used by RCT Power for their production measurements such that total_increasing
can be used. But that would break statistics for existing installations. :thinking: Do you have any other ideas?
I'm not familiar with the integration's code, nor with the HA docs. But I would believe that the solution MUST be to invert the negative measurements that the RCT API is putting out, because that is where the source of the inconsistency seems to be. Looking at the outputs of the production measurements (in HA with your integration), there is also an inconsistency between sensor.rct_power_storage_grid_energy_production_absolute_total - which is positive - and all the other ...grid_energy_production... statistics, which are negative.
The effect is that you cannot use these measures as inputs for the HA "Energy" Dashboard without getting nonsensical statistics for net grid usage, autarky and energy flows/distribution - that obviously also assumes positive numbers throughout to do its accounting! Thus, I doubt that the existing statistics that people might have from this are actually that useful...
to answer folowing statement from my pov: you cannot use these measures as inputs for the HA "Energy" Dashboard without getting nonsensical statistics for net grid usage, autarky and energy flows/distribution
I've been comparing the statistics in the inverter and the statistics gathered by homeAssistant/influxDB/Graphana and these seem to be correct. I've also compared data for grid feed between Homeassistant/the inverter/P1 port on digital enerymeter installed by the grid operator (used for my billing) and they are simmilar (allthough the time interval between measurements differ.
Thanks for the reply.
To clarify, since you don't mention the sign problem explicitly: I'm not saying that the statistics weren't correct by their absolute values, but that they arrive at Home Assistant, specifically the Energy dashboard, with the incorrect (negative) sign. And that is where the calculations performed by the Energy dashboard seem to get confused...
This is yesterday's Energie dashboard graphics for me:
And this is the report for yesterday from the RCT Portal:
The configuration screen for the Energy Dashboard throws an error about the grid_production_day... being negative:
Not sure if you can make sense of the German labels for the graphs. I could translate those if needed.
But the issue is that the 'Energieverteilung' graph reports the energy usage of my home to have been 22.8 kWh - which is entirely off, about twice as high as correct. The RCT board has the energy usage to be 11.33 kWh. I haven't yet found a way to reconstruct the dashboard house consumption values from the RCT outputs, but there must be something... it might be something weird like the dashboard discarding the 'invalid' negative measurement for grid_production and just hopping to the next variable in an array or such...
Just for info, my integration works OK. No negative sign.
@mqatgit I believe that your issue comes from not following the proposed setup for the energy dashboard. Here is my setup, using different measurements as proposed in the documentation:
With this, the values in the dashboard closely resemble the ones shown in the RCT portal or the RCT app, except for the home consumption. It appears that the home consumption in HA is calculated from the other values (generation, grid feed, grid load, battery feed, battery load). However, the generation measurement is a DC value (prior to conversion and conversion losses) which is why even with these settings the total consumption always appears a bit higher then in the portal or in the app.
@gutwinski , thank you very much, that is an excellent suggestion, as it indeed fixes my problem with the HA energy dashboard - looking good now! (But I'm not aware of which part of the documentation - regarding the "proposed setup of the Energy dashboard" - I missed that would have contained that information? I.e., to what proposed setup do you refer?)
However, I still believe that the negative values for grid_production_today etc. are an error that needs to be fixed. Note that, as I said before, ...grid_production_absolute_total is the ONLY positive value among the whole set of grid_production... measures. Which is probably exactly why it works with the dashboard, and the others don't. Also note that the Energy dashboard is fine with measures reported on a daily basis in other places. For example, I still have my solar panels' daily output pulled from the RCT inverter into the dashboard, and that works just fine.
@mqatgit Sorry, with the documentation I meant the READ.ME file and more specifically the part about the energy dashboard:
@gutwinski Thanks! I had seen the READ.ME, but didn't read that part close enough. It seemed so evident to me to use 'daily' measures...