Ziyatoe / DTUProController

Hoymiles DTU-Pro controller for zero export
5 stars 0 forks source link

Configuration with 2 HM1500 and 1 HM800 #3

Closed Wind06 closed 10 months ago

Wind06 commented 1 year ago

Hi again,

In your description you mention one Microinverter MH/MI1500, I am wondering if it can workwith my config 2 Microinverter MH/MI1500 and 1 Microinverter MH/MI800 ?

Or some code modification is required.

Thanks again

Ziyatoe commented 1 year ago

hi, this script is only for ONE microinverter, you can enhanced it your own. since I have no hoymiles, I'm not continue this project

Wind06 commented 1 year ago

Thanks for your answer, I will try to update hope that I will not break my inverter 😶 But you had Hoymiles to develop this script right ?

one more question the script can either perform zero injection, or just report data from ddsu666. Is my understanding ok ?

thanks spend a good Sunday.

Ziyatoe commented 1 year ago

sure I had a MI1500 + DTUpro + DDSU666 for developping. this script can zeroexport, usage: .py Controller=0/1 [1=controler&datalog] [0=only datalogger], Output=1/0, Limit=10-100 .py 1 1 50 means, inverter will be limited to 50% with output to console

if you get rid off to this damn DTUPro, you can try https://github.com/lumapu/ahoy

Wind06 commented 1 year ago

Perfect thanks again

Wind06 commented 1 year ago

well I received the USB/485 today I enter the following command python3 dtupro_ctrl.py 1 1 100 or python3 dtupro_ctrl.py 0 1 100

below is what I got, and idea ?

DTU-Pro RS485/ModbusDTU zero export controller. Version 0.4.0 Limit: 100 OldLimit: 100 MQTT:Connecting to broker 127.0.0.1 MQTT:wait loop MQTT:connected Error connecting DTU sernr at 0x2000

I already build an Ahoy which is working correctly, never tried it for zéro injection yet. Thanks,

Ziyatoe commented 1 year ago

edit: this script is only for 2.gen inverter like tested MI1500, if you have 3.gen inverter (all HM s) you have to change all adress in dtudtsuregister.json and base adress in script !!! here are the serialnummerbegin for the 2.gen inverter 0x1020: return MI300 #MI200,MI300 0x1021: return MI300 #MI200,MI300 0x1040: return MI600 0x1041: return MI600 #MI500,MI600,TSUN TSOL-M800 0x1060: return MI1500 0x1061: return MI1500 #MI1000,MI1200, MI1500.


well, it says clearly that you cant connect to the dtu,

in script under CONFIGURATION you have to check the setting ports, in script is for linux:

clientDTU = ModbusSerialClient( method='rtu', port='/dev/ttyUSB0', <<<<<<<<<<< ?????????? baudrate=9600, timeout=8, parity='N', stopbits=1, bytesize=8 ) DTU_DEV_NR = 101 # Hoymiles DTU-Pro Modbus device number

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

clientDTSU = ModbusSerialClient( method='rtu', port='/dev/ttyUSB0', <<<<<<<<<<<<<<<<<<<??????? baudrate=9600, timeout=8, parity='N', stopbits=1, bytesize=8 ) DTSU_DEV_NR = 22 # Chint DTSU666 grid meter Modbus device number

Wind06 commented 1 year ago

Hello,

Thanks for your reply, I checked this morning and all seems to be correct

/dev/ttyUSB0 Future Technology Devices International FT232 Serial (UART) IC

Maybe the USB is not PI4 compatible, I will do more testing and will keep ou posted.

Thanks again for your quick answer / help.

Ziyatoe commented 1 year ago

do you have 2.gen inverter? compare the serial nr. first

Wind06 commented 1 year ago

Hi you are right I do have 3.gen inverter HM-1500, So I will have to update data accordingly.

But I guess that my connection problem is not linked not the Serial nulber right ?

Ziyatoe commented 1 year ago

I changed the script, now for HM and MI inverters, should work for max. 6 inverters. I can't test it, could you test it?

Wind06 commented 1 year ago

Hi, sure I will give a try and let you know. Again many thanks for your support

Wind06 commented 1 year ago

hello, a new test made this morning after a clean install of Raspbian I have no chance because the same issue :-( I noticed that you updated the dtupro_ctrl.py but not the dtudtsuregister.json ?

python3 dtupro_ctrl.py 1 1 100 DTU-Pro RS485/ModbusDTU zero export controller. Version 0.4.5 Limit: 100 OldLimit: 100 MQTT:Connecting to broker 127.0.0.1 MQTT:wait loop MQTT:connected Error connecting DTU sernr at 0x2000 Error connecting DTU sernr at 0x2000 ^CTraceback (most recent call last): File "dtupro_ctrl.py", line 639, in time.sleep(3) KeyboardInterrupt

Ziyatoe commented 1 year ago

this is the error from first read from dtupro, so I think, you are not connecting the dtupro over rs485, what device number has your dtupro and ddsu666?

Wind06 commented 1 year ago

Maybe stupide question, but how do you find the device number of DTUpro and ddsu666 ?

Ziyatoe commented 12 months ago

so you do not know the device numbers and trying to connect?lol device numbers are in settings, you should also set the dtupro as remote monitor

Wind06 commented 12 months ago

Well to be able to do what you suggest, I need an installer account for the DTUpro right ? Which is not the case today. Can you confirm ?

Ziyatoe commented 12 months ago

very clear, if you can not set the dtupro as "remote monitored", which allows to set rs485 device adress, you can not communicate with it

Wind06 commented 12 months ago

Ok I contacted hoymiles, and they confirm to me that dtupro is set as « remote monitored » as default Inverter and DTU don’t have ID number but only serial number. can you please explain how you get these IDs this will be more efficient :-)

thanks

Ziyatoe commented 12 months ago

oh common! read the manual Screenshot from 2023-11-22 12-42-41

Wind06 commented 12 months ago

As I told you I only have user access not installer So I asked them for information. Hope that they will provide it. As soon as received I will restart testing 😉

Wind06 commented 12 months ago

Hey good news I finally got that number 202, far from the 101 😄 I will go home and start testing. I keep you posted

Wind06 commented 12 months ago

Hello, sorry for the late answer, even with the correct device ID of the DTU-pro and the correct Device ID of the DDSU666 no luck for connection.

So I tried to communicante with DTU-Pro and DDSU666 with a Modbus Application:

I have no issue to communicate with DDSU666 But I tried to communicate with the same app with the DTU-Pro and the communication cannot be established 👎 Maybe the remote control has not been set, I will contact them again on Monday, that's very painfull not to have installer account ... grrrrrr

Ziyatoe commented 12 months ago

normally, the DTUpro is delivered as "export management" unit, you have to set it as "remote control/modbus"

Ziyatoe commented 12 months ago

if you use this as main, you could test the connection with your ddsu:

if name == "main":

main -------------------------------------------------------------------------------------------------------------

setupresult=setup_things()

while not (clientDTSU.connect):
    if Output: print("main: Error connecting client DTU or DTSU")
    #time.sleep(5)

dtsu =DTSUCtrl()
while True:#todo try

    dtsu.getData() #get dtsu666 AC data

    if Output: print (boldon,"[main]GridP:", dtsu.GridP," SolarP:",SolarP,boldoff,"do now ZeroExport")

    if Output: print("[main]",datetime.now().strftime('%H:%M:%S'),"----------------------------------sleep ",SLEEP)

    now = datetime.now()
    if now.hour >= 20 or now.hour <= 7: # sleep longer
        time.sleep(60*10)
    else:
        time.sleep(SLEEP)
Wind06 commented 12 months ago

Thanks again, below is the result, what is strange is that data are empty. by the way for the time being I do have set 0 export on the DTU-pro.

DTU-Pro RS485/ModbusDTU zero export controller. Version 0.4.5 Limit: 100 OldLimit: 100 MQTT:Connecting to broker 127.0.0.1 MQTT:wait loop MQTT:connected grid U_ACL1 0.0 V grid I_ACL1 0.0 A grid P_ACtot nan W grid P_ACL1 nan W grid P_ACL2 nan W grid P_ACL3 nan W error readFromDataRegList grid F_AC 0.0 Hz error readFromDataRegList grid Q_IMP 0.0 kWh error readFromDataRegList grid Q_EXP 0.0 kWh [main]GridP: nan SolarP: 0 do now ZeroExport [main] 10:06:48 ----------------------------------sleep 30

Wind06 commented 11 months ago

Hello,

Very sorry for the long delay, after 2 weeks discussion with Hoymiles Support I finally get an installer account :-) so I succeed to setup the rs485 port.

I launched the command " python3 dtupro_ctrl.py 0 1 50 " The first Inverter HM800 found, second HM1500 found, for the 3rd I got an error. Attached is the log file generated.

Any help will be appreciated as usual.

SolarZeroinjection.txt

Wind06 commented 11 months ago

Hi Ziyatoe, and idea why I can't access the 3 inverter. I am trying to understand why in the .py file, but I am lost ..

[readMiDataRegs] read DTU-Regs [readMiDataRegs] Error Port: 3 0x11b8 [readMiDataRegs]cant read DTU-Regs

Thanks

Ziyatoe commented 11 months ago

hi, I do not check my emails daily, the script was never tested with more than 1 inverter, and this version for you, I couldn't test it, I do not have any hoymiles equipment anymore. so, I have to go through the script with your log and try to figure out what is wrong, sorry, it takes time

Wind06 commented 11 months ago

Thanks for your help, if you don’t have time no problem. I asked Ahoy team for an enhancement to support zero injection with DDSU666.

I really appreciated all your help

Cheers

Le dim. 3 déc. 2023 à 21:04, Ziyatoe @.***> a écrit :

hi, I do not check my emails daily, the script was never tested with more than 1 inverter, and this version for you, I couldn't test it, I do not have any hoymiles equipment anymore. so, I have to go through the script with your log and try to figure out what is wrong, sorry, it takes time

— Reply to this email directly, view it on GitHub https://github.com/Ziyatoe/DTUProController/issues/3#issuecomment-1837585194, or unsubscribe https://github.com/notifications/unsubscribe-auth/APLBDK4427C2M7CYB2525ZDYHTLMXAVCNFSM6AAAAAA7Q3HOEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZXGU4DKMJZGQ . You are receiving this because you authored the thread.Message ID: @.***>

Ziyatoe commented 11 months ago

ich bin mir sicher, dass ahoy team nichts für ddsu666 entwickeln wird, denn ich war bei der entwicklung der ahoy am anfang dabei. wenn du schon ahoy hast, du kannst ja ddsu666 abfragen (alles im script vorhanden), wie die leistung +/-W ist und dann das ahoy dementsprechend regeln. somit brauchst du keinen dtu

Wind06 commented 11 months ago

You are right, the guy from Ahoy who answered to me was not very supportive of this option. Yes I do have an Ahoy in place which is working perfectly, and you are right I will investigate the way to implément it.

Ziyatoe commented 11 months ago

hi I think, I found the problem, try this V0.4.6

Wind06 commented 11 months ago

hello,

ooopsss I tried, now it stops reading inverter 1

DTU-Pro RS485/ModbusDTU zero export controller. Version 0.4.6 Limit: 100 OldLimit: 100 MQTT:Connecting to broker 127.0.0.1 MQTT:wait loop MQTT:connected DTUSerialNr: 0x10f882246532 Device SN Register List (10F872228412) MISerialNr : 0x114190556486 Model: Mi2CH Ports: 2 Power/Port: 375 MISerialNr : 0x116180400231 Model: Mi4CH Ports: 4 Power/Port: 375 MISerialNr : 0x116180400245 Model: Mi4CH Ports: 4 Power/Port: 375 Nr of Inv: 3 Inverter 1 of 3 SrNr: 0x114190556486 0x1000 NrOfPorts: 2 [readMiDataRegs] read DTU-Regs [readMiDataRegs] readed Traceback (most recent call last): File "dtupro_ctrl_new.py", line 686, in dtu.getData(DTUDataReg, inv, NRofPORTS, invsrnr=InvIdPowr[inv][0]) File "dtupro_ctrl_new.py", line 552, in getData dev_nr=DTU_DEV_NR, number=nrtype) File "dtupro_ctrl_new.py", line 272, in readFromDataRegList my_result[i] = DtuMiPvData[3].registers[int((adr - dtuDataRegs[3] + i) / 2)] # PV4 AttributeError: 'int' object has no attribute 'registers'

Ziyatoe commented 11 months ago

its difficult for me to check the script without an hoymiles equipment here, but lets try to fix it. try this version and give me the log

Wind06 commented 11 months ago

Yes I can imagine, Well with this version the connection is failing immediatly. Maybe if you have time I can grant you an access to my test raspberry. Just let me know and I will provide you my email address, if this option could be valid for you

DTU-Pro RS485/ModbusDTU zero export controller. Version 0.4.6.1 Limit: 100 OldLimit: 100 MQTT:Connecting to broker 127.0.0.1 MQTT:wait loop MQTT:connected DTUSerialNr: 0x10f882246532 Traceback (most recent call last): File "dtupro_ctrl.py", line 663, in while not (read_sernr()): File "dtupro_ctrl.py", line 166, in read_sernr if Output: print("DTUSerialNr:", hex(int(DtuId)), "\tDevice SN Register List (L\u0130KE:10F8xxxxxxxx)") UnicodeEncodeError: 'latin-1' codec can't encode character '\u0130' in position 27: ordinal not in range(256)

Ziyatoe commented 11 months ago

was für ein system hast du, windows? der fehler sagt, dass dein system 'latin-1' unicode nicht encoden kann, eigenartig! ich habe die zeile geaendert, probiere nochmals

Wind06 commented 11 months ago

My system is a PI4 with raspbian Buster installed. I can try with another environment or setup the unix system differently.

Ziyatoe commented 11 months ago

ok, just try it

Wind06 commented 11 months ago

Attached the log, still and issue reading the 3rd inverter data DTUlog.txt

Ziyatoe commented 11 months ago

ok, I hope, I see the problem now, gonna try to fix it

Ziyatoe commented 11 months ago

sunday work ;-) try this one and give me the log please check the power from each inverter, if total power is approx. ok

Wind06 commented 11 months ago

"sunday work", indeed yes and sorry for that, result attached.

Reported data seems to be accurate

[getData]>>>>>>>> this inverter: 0x114190556486 total 86.9 W [getData]>>>>>>>> this inverter: 0x116180400231 total 152.8 W [getData]>>>>>>>> this inverter: 0x116180400245 total 149.0 W

DTUlog.txt

But after sleep---30 when it start again to pool data I get error reading DTU stuff

Wind06 commented 11 months ago

I confirm that inverters data are read once, and data are accurate. Then when trying to read data again, the following error is displayed.

[main]GridP: 0.0 SolarP: 364.4 do now ZeroExport mainGridP: 0.0 is in doZEROSensivity: 16 [main] 15:41:54 ----------------------------------sleep 30 Inverter 1 of ^[[1m 3 SrNr: 0x114190556486 ^[[0m basis: 0x11e0 0x1190 NrOfPorts: 2 [readMiDataRegs] read DTU-Regs [readMiDataRegs] Error Port: 1 0x11b8 [readMiDataRegs]cant read DTU-Regs [DtuDtsuCtrl]Cant read DTU All Registers!! [readMiDataRegs] read DTU-Regs [readMiDataRegs] Error Port: 0 0x1190 [readMiDataRegs] Error Port: 1 0x11b8 [readMiDataRegs]cant read DTU-Regs .....

Ziyatoe commented 11 months ago

ok, getting closer with inverter! I missed one line, now its in, try it, now we should get all inverters/ports in each iteration. the other issue is your dtsu666, it seems to be, that the data registers are not compatible with, what I have in dtudtsuregisters.json under "directory": "grid". you have to check that with your manual.

Ziyatoe commented 11 months ago

you can comment the line 709, without dtsu to check only the inverters. and use: python dtupro_ctrl.py 0 1

Wind06 commented 11 months ago

Hello, I will do testing tomorrow, for inverter only.

For dtsu666 I noticed this already I will check and compare mine with information you have and will do some testing on my side.

many thanks for all your help, we will succeed :-) Good evening.

Ziyatoe commented 11 months ago

dtsu666: it can be also the rs485 modbus adress, you have to check it aswell, in code it is DTSU_DEV_NR = 22

Wind06 commented 11 months ago

Hi, I tested inverter today and all seems to be ok, the loop is working and reported data accurate. Now I will focus on DDSU666 to find out correct registers, the DTSU_DEV_NR is alrady set correctly on my side.

Ziyatoe commented 11 months ago

good news! so, you can comment the line 261 for better output view. are you able to check the mqtt data aswell?

Ziyatoe commented 11 months ago

Hi, I tested inverter today and all seems to be ok, the loop is working and reported data accurate. Now I will focus on DDSU666 to find out correct registers, the DTSU_DEV_NR is alrady set correctly on my side.

on the market, there are many dtsu666, I was using the orig. CHINT DTSU666