leodesigner / powmr4500_comm

PowMr 4500W/6500W Inverter communication protocol
GNU General Public License v3.0
9 stars 2 forks source link

updating inverter config #9

Closed aa755 closed 1 month ago

aa755 commented 1 month ago

You say:

you have to read the entire inverter config first in order to modify settings. Then you have to sent it back to the inverter.

I did exactly that, but it seems the inverter is not updating the state to SBU (Solar then Battery then Utility priority for powering loads) from SUB. I have the 6500W version.

pi@rpi-sbr-ac:~ $ python3 ser.py --sbu
Request sent: 88510003020000004cb0
Response received:  8851000302005e0080a0af846419fc08701700000000b80bb80bb80b500a8214e00638187017e4114812500ab80bf00a7c15e0151815ec132003f4016400000000003cfb32003cec32f67c158813f401241308005a5a505a5a50d0163c003c001e00325f1400b3cd
Request sent:       8851000302005e0080a4af846419fc08701700000000b80bb80bb80b500a8214e00638187017e4114812500ab80bf00a7c15e0151815ec132003f4016400000000003cfb32003cec32f67c158813f401241308005a5a505a5a50d0163c003c001e00325f1400750c
No response received.
pi@rpi-sbr-ac:~ $ python3 ser.py --sbu
Request sent: 88510003020000004cb0
Response received:  8851000302005e0080a0af846419fc08701700000000b80bb80bb80b500a8214e00638187017e4114812500ab80bf00a7c15e0151815ec132003f4016400000000003cfb32003cec32f67c158813f401241308005a5a505a5a50d0163c003c001e00325f1400b3cd
Request sent:       8851000302005e0080a4af846419fc08701700000000b80bb80bb80b500a8214e00638187017e4114812500ab80bf00a7c15e0151815ec132003f4016400000000003cfb32003cec32f67c158813f401241308005a5a505a5a50d0163c003c001e00325f1400750c
No response received.
aa755 commented 1 month ago

can anyone confirm they were able to update inverter configuration via serial communication?

leodesigner commented 1 month ago

You should specify WRITE COMMAND.

From the serial communication dump: 8851001002005a0010a0adc69411fc ^^^^

See: https://github.com/leodesigner/powmr4500_comm/blob/214396e327e1d05fa7904f9e8b241d5926e253d7/include/inv8851.h#L194

And modify CRC.

aa755 commented 1 month ago

Thanks, that worked:

def set_sbu_sub(sbu):
    response=read_config()
    trimmed_resp=bytearray(response[:-2])
    trimmed_resp[3]=0x10
    if sbu:
        trimmed_resp[9]=0xa4
    else:
        trimmed_resp[9]=0xa0
    updated_resp=append_modbus_crc16(trimmed_resp)
    send_request_and_receive(port_name, bytes(updated_resp), 0)