# Pure Python 3 CAN decoder for a 8-byte payload.
FRAME_LEN = 8
def dbc_1_pack_voltage_physical(data: bytes) -> float:
if len(data) < 8:
raise ValueError("Expected at least 8 payload bytes")
raw = (int.from_bytes(data[:8], "little") >> 0) & 0xFFFF
return raw * (0.01) + (0.0)
def dbc_2_pack_current_physical(data: bytes) -> float:
if len(data) < 8:
raise ValueError("Expected at least 8 payload bytes")
raw = (int.from_bytes(data[:8], "little") >> 16) & 0xFFFF
if raw & (1 << 15):
raw -= 1 << 16
return raw * (0.1) + (0.0)
def dbc_3_state_of_charge_physical(data: bytes) -> float:
if len(data) < 8:
raise ValueError("Expected at least 8 payload bytes")
raw = (int.from_bytes(data[:8], "little") >> 32) & 0xFF
return raw * (1.0) + (0.0)
def dbc_4_mosfet_temp_physical(data: bytes) -> float:
if len(data) < 8:
raise ValueError("Expected at least 8 payload bytes")
raw = (int.from_bytes(data[:8], "little") >> 40) & 0xFF
return raw * (1.0) + (0.0)
def decode_frame(data: bytes) -> dict[str, float]:
return {
"dbc_1_pack_voltage": dbc_1_pack_voltage_physical(data),
"dbc_2_pack_current": dbc_2_pack_current_physical(data),
"dbc_3_state_of_charge": dbc_3_state_of_charge_physical(data),
"dbc_4_mosfet_temp": dbc_4_mosfet_temp_physical(data),
}
Debug Seplos Mason / 10E / 10C closed-loop inverter CAN telemetry frames
Seplos V2 and V3 BMS boards communicate with Pylontech, GoodWe, Victron and Deye/Sol-Ark hybrid inverters using 500 kbps Pylontech-compatible 0x356 status frames.
In Intel little-endian layout, bytes A0 14 convert to 0x14A0 (5,280 → 52.80 V), 5E 01 decodes to +350 (+35.0 A charge) vs. two’s-complement A2 FE (−35.0 A discharge), followed by 0x52 (82% SOC) and 0x1C (28 °C).
Formulas
Pack voltage = (0x14 << 8 | 0xA0) × 0.01 = 5,280 × 0.01 = 52.80 V
Signed A = 0x015E (+350 → +35.0 A) vs. 0xFEA2 (−350 → −35.0 A)
SOC byte = 0x52 (82%); Temp byte = 0x1C (28 °C)
Worked example
Payload A0 14 5E 01 52 1C 00 00 decodes via Intel LE bitfields to 52.8 V, +35 A, 82% SOC and 28 °C alongside generated C99 extractors; A0 14 A2 FE 52 1C 00 00 switches cleanly to −35 A discharge.
Frequently asked questions
Which DIP switch / CAN protocol option selects Pylontech-style 500 kbps frames on Seplos?
On Seplos V2/V3 CAN ports using Growatt/Deye/Sol-Ark/Victron protocols, verify RJ45 pins 4–5 (CAN-H / CAN-L) and check Pylontech 0x351/0x355/0x356 traffic with an isolated USB-CAN analyzer.
Why does a swapped byte order show 40,980 V or bogus signed amps?
Confusing Intel little-endian (LSB first, used in 0x356 Pylontech/Seplos) with Motorola big-endian swaps bytes 0↔1 and flips polarity scaling immediately.
Are Seplos CAN frames compatible with Victron Venus OS / Cerbo GX?
Yes when configured for Victron/Pylontech BMS-Can profile at 500 kbps using an appropriate Victron Type-A (Pins 7–8 vs. 4–5) patch cable.