Closed IronicSven closed 1 year ago
Hi Sven,
no that is not planned by myself. I have only one inverter and i can´t install another one at home. I think that needs a lot of testing and tries to calculate the limit for each inverter, especially if they have different output powers. Sorry!
no that is not planned by myself
If you will change your mind on that I´m open for some tests. I have HM1500 and HM300.
Hi, i just opened a new DEV branch for multiple inverters. @Ollipop030 : can you support me here? i can´t test it at home with more than one inverter. Until now it is completely untestet and i am going to test it with one inverter at the end of this week.
Sure. But first test results in an error:
2023-03-14 08:32:47 INFO read config file: D:\Download\HoymilesZeroExport_Config.ini
2023-03-14 08:32:47 INFO Inverter 0 reachable: True
2023-03-14 08:32:47 INFO Inverter 1 reachable: True
2023-03-14 08:32:47 INFO setting new limit to 1800 Watt
Traceback (most recent call last):
File "D:\Download\HoymilesZeroExport.py", line 204, in
ah, i forgot the brackets (): GetMaxWattFromAllInverters()
Step after step:
2023-03-14 08:45:29 INFO read config file: D:\Download\Dev\HoymilesZeroExport_Config.ini 2023-03-14 08:45:29 INFO Inverter 0 reachable: True 2023-03-14 08:45:29 INFO Inverter 1 reachable: True 2023-03-14 08:45:29 INFO setting new limit to 1800 Watt 2023-03-14 08:45:29 INFO Inverter 0: setting new limit from 0 Watt to 1500 Watt 2023-03-14 08:45:31 INFO Inverter 1: setting new limit from 0 Watt to 300 Watt 2023-03-14 08:45:42 INFO Inverter 0 reachable: True 2023-03-14 08:45:42 INFO Inverter 1 reachable: True 2023-03-14 08:45:42 INFO powermeter: 151 Watt ApplyLimitsToSetpoint() missing 1 required positional argument: 'pSetpoint' 2023-03-14 08:45:55 INFO Inverter 0 reachable: True 2023-03-14 08:45:55 INFO Inverter 1 reachable: True 2023-03-14 08:45:55 INFO powermeter: 156 Watt ApplyLimitsToSetpoint() missing 1 required positional argument: 'pSetpoint'
ah, overloading does not work in python. can you try renaming:
def ApplyLimitsToSetpoint(pInverter, pSetpoint): -> def ApplyLimitsToSetpointInverter(pInverter, pSetpoint):
NewLimit = ApplyLimitsToSetpoint(i, NewLimit) -> NewLimit = ApplyLimitsToSetpointInverter(i, NewLimit)
Looks ok:
2023-03-14 09:01:38 INFO read config file: D:\Download\Dev\HoymilesZeroExport_Config.ini 2023-03-14 09:01:38 INFO Inverter 0 reachable: True 2023-03-14 09:01:38 INFO Inverter 1 reachable: True 2023-03-14 09:01:38 INFO setting new limit to 1800 Watt 2023-03-14 09:01:38 INFO Inverter 0: setting new limit from 0 Watt to 1500 Watt 2023-03-14 09:01:40 INFO Inverter 1: setting new limit from 0 Watt to 300 Watt 2023-03-14 09:01:50 INFO Inverter 0 reachable: True 2023-03-14 09:01:50 INFO Inverter 1 reachable: True 2023-03-14 09:01:50 INFO powermeter: 106 Watt 2023-03-14 09:01:50 INFO setting new limit to 1800 Watt 2023-03-14 09:01:50 INFO Inverter 0: setting new limit from 1500 Watt to 1500 Watt 2023-03-14 09:01:52 INFO Inverter 1: setting new limit from 300 Watt to 300 Watt 2023-03-14 09:02:05 INFO Inverter 0 reachable: True 2023-03-14 09:02:05 INFO Inverter 1 reachable: True 2023-03-14 09:02:05 INFO powermeter: 82 Watt 2023-03-14 09:02:05 INFO setting new limit to 1800 Watt 2023-03-14 09:02:05 INFO Inverter 0: setting new limit from 1500 Watt to 1500 Watt 2023-03-14 09:02:07 INFO Inverter 1: setting new limit from 300 Watt to 300 Watt 2023-03-14 09:02:21 INFO Inverter 0 reachable: True 2023-03-14 09:02:21 INFO Inverter 1 reachable: True 2023-03-14 09:02:21 INFO powermeter: 55 Watt 2023-03-14 09:02:21 INFO setting new limit to 1800 Watt 2023-03-14 09:02:21 INFO Inverter 0: setting new limit from 1500 Watt to 1500 Watt 2023-03-14 09:02:23 INFO Inverter 1: setting new limit from 300 Watt to 300 Watt
I will let it run on my Windows machine and hope for the sun to come out to see if the inverters are limited when overproducing. But I don´t think it will get this much power today, typical weather in northern germany.
Thank you and i found another error:
can you delete:
def GetHoymilesActualPower(pInverterId):
if USE_AHOY:
return GetHoymilesActualPowerAhoy(pInverterId)
elif USE_OPENDTU:
return GetHoymilesActualPowerOpenDTU(pInverterId)
else:
raise Exception("Error: DTU Type not defined")
it will result in an error and you don´t need it anymore.
and if you have some time you can do another test:
add
GetHoymilesActualPower()
after
newLimitSetpoint = GetMaxWattFromAllInverters()
if GetHoymilesAvailable():
SetLimit(newLimitSetpoint)
time.sleep(SET_LIMIT_DELAY_IN_SECONDS)
to test if the JSON is parsed correctly.
Thank you, I changed the lines and will report.
ok, did
GetHoymilesActualPower()
work?
Yes.
It seems to work:
2023-03-14 11:47:01 INFO Inverter 0 power producing: 302 Watt 2023-03-14 11:47:01 INFO Inverter 1 power producing: 56 Watt 2023-03-14 11:47:01 INFO overproducing: reduce limit based on actual power 2023-03-14 11:47:01 INFO setting new limit to 358 Watt 2023-03-14 11:47:01 INFO Inverter 0: setting new limit from 1500 Watt to 298 Watt 2023-03-14 11:47:03 INFO Inverter 1: setting new limit from 300 Watt to 59 Watt 2023-03-14 11:47:08 INFO Inverter 0 reachable: True 2023-03-14 11:47:08 INFO Inverter 1 reachable: True 2023-03-14 11:47:08 INFO powermeter: -109 Watt 2023-03-14 11:47:10 INFO powermeter: -116 Watt 2023-03-14 11:47:11 INFO powermeter: -116 Watt 2023-03-14 11:47:12 INFO powermeter: -116 Watt 2023-03-14 11:47:13 INFO powermeter: -116 Watt 2023-03-14 11:47:14 INFO powermeter: -116 Watt 2023-03-14 11:47:15 INFO powermeter: -116 Watt 2023-03-14 11:47:16 INFO powermeter: -116 Watt 2023-03-14 11:47:17 INFO powermeter: -116 Watt 2023-03-14 11:47:18 INFO powermeter: -116 Watt 2023-03-14 11:47:19 INFO powermeter: -116 Watt 2023-03-14 11:47:20 INFO powermeter: -116 Watt 2023-03-14 11:47:21 INFO powermeter: -116 Watt 2023-03-14 11:47:22 INFO overproducing: reduce limit based on previous limit setpoint 2023-03-14 11:47:22 INFO setting new limit to 317 Watt 2023-03-14 11:47:22 INFO Inverter 0: setting new limit from 298 Watt to 264 Watt 2023-03-14 11:47:24 INFO Inverter 1: setting new limit from 59 Watt to 52 Watt 2023-03-14 11:47:29 INFO Inverter 0 reachable: True 2023-03-14 11:47:29 INFO Inverter 1 reachable: True 2023-03-14 11:47:29 INFO powermeter: -118 Watt 2023-03-14 11:47:30 INFO powermeter: -118 Watt 2023-03-14 11:47:31 INFO powermeter: -118 Watt 2023-03-14 11:47:32 INFO powermeter: -118 Watt 2023-03-14 11:47:33 INFO powermeter: -118 Watt 2023-03-14 11:47:34 INFO powermeter: -118 Watt 2023-03-14 11:47:35 INFO powermeter: -118 Watt 2023-03-14 11:47:36 INFO powermeter: -118 Watt 2023-03-14 11:47:38 INFO powermeter: -118 Watt 2023-03-14 11:47:39 INFO powermeter: -75 Watt 2023-03-14 11:47:40 INFO powermeter: -75 Watt 2023-03-14 11:47:41 INFO powermeter: -75 Watt 2023-03-14 11:47:42 INFO powermeter: -75 Watt
But something is strange:
setting new limit to 358 Watt Inverter 0: setting new limit from 1500 Watt to 298 Watt Inverter 1: setting new limit from 300 Watt to 59 Watt 298+59=357W
and here:
setting new limit to 317 Watt Inverter 0: setting new limit from 298 Watt to 264 Watt Inverter 1: setting new limit from 59 Watt to 52 Watt 264+52=316W
Just a little calculation error?
Yes, it´s a small calculation error because i need to round the decimal value to full integer value. But i think 1 Watt doesn´t really matter.
I´m very happy that it works out of the box. I will test it at home in the next days and if it works i´ll branch it into main. Please watch this over the next few days and let me know if any errors or problems occur.
I will update the dev version with all the bugfixes above included.
Thanks for your help!
I will keep an eye on that today. I can later post a log of a few hours of the running script, so you can look for yourself if there is any inconsistency.
That would be great. Thanks
Maybe tomorrow is a better change for some "overproducing", I will report any strange behaviour. log_20230314.txt
ok thanks - you can add the next logfile via attach files :-)
Here are some results of today. Works perfectly, in my opinion v1.7 is ready for main branch.
perfect, thanks for your help! I´ll merge it into main.
Great work! Are you planning on adding support for multiple inverters? Because Ahoy and OpenDTU both support more than one and there are many users using two or more inverters. I'am also planning on buying a second one.