pawcio50501 / domoticz-VictronMultiplusII

Domoticz plugin for the Victron Multiplus-II Inverter
2 stars 1 forks source link

OverflowError: int too big to convert #2

Closed simat-git closed 1 year ago

simat-git commented 1 year ago

Hi,

Since replacing a RS450/100 Solar Charge controller the VRM ID changed from the default 226 to 280 ! and now this plugin isn't happy in Domoticz. After some investigation if "First Solar Charger Unit-id:" is greater than 255 you get the following error because 280 is too large for the data type INT..?

2023-07-10 18:49:10.983 Error: Victron ESS: File "/home/simat/domoticz/plugins/VictronMultiplusII/plugin.py", line 55, in onStart 2023-07-10 18:49:10.983 Error: Victron ESS: self.registers.append(int(Parameters["Mode5"]).to_bytes(1, byteorder='big') + b'\x03\x03\x03\x00\x15') 2023-07-10 18:49:10.983 Error: Victron ESS: OverflowError: int too big to convert

I can't find any documentation regarding the self.registers function to be able to help.

Any ideas ?

Would using long work ?

if True == self.firstSolarCharger: self.registers.append(long(Parameters["Mode5"]).to_bytes(1, byteorder='big') + b'\x03\x03\x03\x00\x15')

pawcio50501 commented 1 year ago

Hi, you should check int.to_byte() call Numbers bigger than 255 won't fit on one byte...

simat-git commented 1 year ago

Thanks for that, rather than edit the plugin to use Modbus IDs higher than 255, it might be better to fix the ID on the Victron kit

https://community.victronenergy.com/questions/110482/device-id-over-255-in-modbus.html