Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lost Data & Maybe an idea for solution #5

Closed
Cees2439867 opened this issue Apr 6, 2020 · 12 comments
Closed

Lost Data & Maybe an idea for solution #5

Cees2439867 opened this issue Apr 6, 2020 · 12 comments

Comments

@Cees2439867
Copy link

Hello Sincze,
During the past days I am losing data on my connection to the Growatt server. At first I show you the data from the Growatt app:
Screenshot_20200405_222310_com growatt shinephones
Now the data showing in Domotics:
2020-04-06 Solar Power Datya Glitches
You can see the drops in the data arriving back here in the Netherlands. I suspect that the internet is very busy because of the Corona exchange of data now very high.

Maybe a solution is the take the data retrieved from Growatt servers and update the total for the day with it? There is a difference between the Growatt number, in this example 17 KWh and the Domoticz amount of 15.894 KWh. In the reporting of Domoticz I am short 1.106 for this day.

Sorry if I am not clear enough but I hope I have addressed the issue correctly.
Best regards, Cees

@sincze
Copy link
Owner

sincze commented Apr 9, 2020

Yes I think I understand what you mean,
If we grab an other field from the return JSON (total generated) value should always be correct as that one is retrieved from the INVERTER website so should be accurate.

It should be correct...
$todaypower = (float)str_ireplace('kWh', '', $data['todayStr']);

Did you configure your device like:
image

@Cees2439867
Copy link
Author

afbeelding
I Have been struggling with that and thought it hat to be computed?
Should it be changed?

@sincze
Copy link
Owner

sincze commented Apr 10, 2020 via email

@Cees2439867
Copy link
Author

Oeps that works out strangely:
afbeelding
The day before yesterday I changed to "From Device". Very strange result. Suddenly I have a very big number for the output of my solar system. Just before 00:00 hours I switched back to "Computed". Left it during yesterday. but now the per hour bars have disappeared. This morning I tried again. No difference. I cannot get it working again. What to do now?

@sincze
Copy link
Owner

sincze commented Apr 12, 2020

I think I spotted the issue. You probably creatd incremental counter.
That is an issue if the counter is reset everyday ''todayStr'' starts with 0 every day.

$todaypower = (float)str_ireplace('kWh', '', $data['todayStr']);

Let me check.

@sincze
Copy link
Owner

sincze commented Apr 12, 2020

Can you modify

$todaypower = (float)str_ireplace('kWh', '', $data['todayStr']);

to
$todaypower = (float)str_ireplace('kWh', '', $data['totalValue']);

I've also created a Domoticz plugin.
https://github.com/sincze/Domoticz-Growatt-Webserver-Plugin

@Cees2439867
Copy link
Author

I have updated as proposed. The code now looks like:
if ($continue) { $data = json_decode($result, JSON_PRETTY_PRINT);
$nowpower = (float)str_ireplace('kWh', '', $data['powerValue']);
$todaypower = (float)str_ireplace('kWh', '', $data['totalValue']);
$str=( $nowpower.';'. $todaypower * 1000 ); #times 1000 to convert the 0.1kWh to 100 WattHour and to convert 2.1kWh to 2100 WattHour
lg('Growatt Inverter: '. $nowpower.' for domoticz: '.$str);
ud(DOMOTICZDEVICE,0,$str,'GrowattInverter: Generation updated');
}
It looks better but the values seem 1000 times to high.
afbeelding
Do I need to change the conversion? I am so happy you help me with this. Thank you.

@Cees2439867
Copy link
Author

Huge values. I now changed:

$str=( $nowpower.';'. $todaypower * 1000 ); #times 1000 to convert the 0.1kWh to 100 WattHour and to convert 2.1kWh to 2100 WattHour

To:
$str=( $nowpower.';'. $todaypower * 1 ); #times 1000 to convert the 0.1kWh to 100 WattHour and to convert 2.1kWh to 2100 WattHour

Values reported in the log file now seem okay. Don't know how to update the values in Domoticz. But that is an nice task for the upcoming days. I am hopeful it works now.

@Cees2439867
Copy link
Author

After I changed the multiplication factor the yellow line is fine. The blue bars stay at zero. I have been looking at the code but donot understand this enough to try something else. The log file says now:
2020-04-13 11:35:02.904 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie exists!
2020-04-13 11:35:02.907 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie is writable!
2020-04-13 11:35:04.191 Status: --->> Growatt Inverter: 1880.7 for domoticz: 1880.7;569.1
2020-04-13 11:35:04.213 Status: --->> (udevice) | 11 => 0,1880.7;569.1

Where before I changed the multiplication factor from 1000 to 1 the logfile showed:
2020-04-13 09:50:02.175 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie exists!
2020-04-13 09:50:02.179 Status: --->> Cookie File: /home/pi/domoticz/scripts/pass2php/growatt.cookie is writable!
2020-04-13 09:50:03.367 Status: --->> Growatt Inverter: 386.1 for domoticz: 386.1;567400
2020-04-13 09:50:03.381 Status: --->> (udevice) | 11 => 0,386.1;567400

Hope this helps.

@sincze
Copy link
Owner

sincze commented Apr 13, 2020

Leave the code as I suggested it works just fine.

image

If you never worked with totalvalue before you will indeed notice a big spike..
ONLY After 24h it is okay and you can remove the big spike as that is the number of generated energy since installation. )

@Cees2439867
Copy link
Author

Cees2439867 commented Apr 14, 2020

You are very right! It works fine now. Thank you very much very your detailed help, much appreciated!

@sincze
Copy link
Owner

sincze commented Apr 14, 2020

Haha well I've sailed that boat many times. ;-) and sometimes I remember stuff.

@sincze sincze closed this as completed Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants