Whole file
marcelblijleven/goodwe
The author described this change as “Fix decoding 0 energy values”. It counts as a record because the check below fails on the code as it stood at 366d35652 and passes on a555e3e72, with nothing else changed between the two runs.
Projectmarcelblijleven/goodwe
Fix saved2024-05-14
Sharing licenceMIT · LICENSE
Change size+2 −2
What the code was meant to do, written into the code itself as a save note
Fix decoding 0 energy values
The change
| 183 | 183 | ||
| 184 | 184 | def read_value(self, data: ProtocolResponse): | |
| 185 | 185 | value = read_bytes2(data) | |
| 186 | - | return float(value) / 10 if value else None | |
| 186 | + | return float(value) / 10 if value is not None else None | |
| 187 | 187 | ||
| 188 | 188 | ||
| 189 | 189 | class Energy4(Sensor): | |
| ⋯ | |||
| 194 | 194 | ||
| 195 | 195 | def read_value(self, data: ProtocolResponse): | |
| 196 | 196 | value = read_bytes4(data) | |
| 197 | - | return float(value) / 10 if value else None | |
| 197 | + | return float(value) / 10 if value is not None else None | |
| 198 | 198 | ||
| 199 | 199 | ||
| 200 | 200 | class Apparent(Sensor): | |
The check that tells the two apart
fail→pass·tests/test_dt.py::GW5000D_NS_Test::test_GW5000D_NS_runtime_data
Check file tests/test_dt.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 it366d35652752ff8207ae7b0ae0767d0e30391180
Broken version dated2024-05-14
Modulegoodwe.sensor
Units changedEnergy, Energy4
Fingerprint3576d940d8c693c3
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
- 2026-03-29Fix duplicate sensor registrations
- 2024-05-12Fix writing single byte settings on ES inverters
- 2024-05-08Fix setup of BT inverters
- 2024-04-08Fix decoding of voltage values
- 2024-01-09Fix deconding 0x55 as not-set value of EcoMode
- 2023-12-31Fix unit of current MPPT sensors