Whole file

marcelblijleven/goodwe

The author described this change as Fix writing single byte settings on ES inverters. It counts as a record because the check below fails on the code as it stood at 5f1811df4 and passes on 337a7993b, with nothing else changed between the two runs.

Fix saved2024-05-12
Sharing licenceMIT · LICENSE
Change size+1 2

What the code was meant to do, written into the code itself as a save note

Fix writing single byte settings on ES inverters

The change

254254 # modbus can address/store only 16 bit values, read the other 8 bytes
255255 if self._is_modbus_setting(setting):
256256 response = await self._read_from_socket(self._read_command(setting.offset, 1))
257- raw_value = setting.encode_value(value, response.response_data()[0:2])
258257 else:
259258 response = await self._read_from_socket(Aa55ReadCommand(setting.offset, 1))
260- raw_value = setting.encode_value(value, response.response_data()[2:4])
259+ raw_value = setting.encode_value(value, response.response_data()[0:2])
261260 else:
262261 raw_value = setting.encode_value(value)
263262 if len(raw_value) <= 2:

The check that tells the two apart

failpass·tests/test_es.py::GW5048D_ES_Test::test_write_setting

Check file tests/test_es.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it5f1811df4c813ac9bb2661bd7c90f531fc82c4b4
Broken version dated2024-05-12
Modulegoodwe.es
Units changedES
Fingerprinta1ba428cec6d4dc6
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in marcelblijleven/goodwe