Open klvbdmh opened 1 month ago
I've got this working in powermon code, I'll see if I can backport to mppsolar (but i might not be able to easily)
➜ /workspaces/powermon (master) $ powermon -C tests/config/ble_daly.yaml -I
2024-10-15 21:27:52,231:INFO:runner:main@108: Power Device Monitoring Utility, version: 1.0.10-dev, python version: 3.11.7
2024-10-15 21:27:52,231:INFO:runner:main@120: Using config file: tests/config/ble_daly.yaml
2024-10-15 21:27:52,233:INFO:runner:main@131: Config validation successful
2024-10-15 21:27:52,233:INFO:runner:main@147: config: {'device': {'name': 'BLE_Advertising', 'serial_number': 'SmartShunt Bat2', 'model': 'SmartShunt 500A/50mV', 'manufacturer': 'Victron', 'port': {'type': 'test', 'protocol': 'DALY', 'response_number': 3}}, 'commands': [{'command': 'cell_voltages', 'outputs': [{'type': 'screen', 'format': {'type': 'table', 'draw_lines': True}}]}], 'loop': 'once', 'debuglevel': 20}
2024-10-15 21:27:52,233:INFO:runner:main@151: MqttBroker DISABLED
2024-10-15 21:27:52,237:INFO:abstractprotocol:check_definitions_count@123: Using protocol:b'DALY' with 6 commands (SOC, cell_voltage_range, temperatures, mosfet, status, cell_voltages)
2024-10-15 21:27:52,237:INFO:runner:main@174: Adding command, config: {'command': 'cell_voltages', 'outputs': [{'type': 'screen', 'format': {'type': 'table', 'draw_lines': True}}]}
2024-10-15 21:27:52,238:INFO:runner:main@176: Device: BLE_Advertising, self.device_info.serial_number='SmartShunt Bat2', self.device_info.model='SmartShunt 500A/50mV', self.device_info.manufacturer='Victron', port: Test port, mqtt_broker: MqttBroker DISABLED, commands:[<powermon.commands.command.Command object at 0x7426300382d0>]
2024-10-15 21:27:52,238:INFO:runner:main@180: Daemon DISABLED
2024-10-15 21:27:52,238:INFO:apicoordinator:from_config@49: No api definition in config
2024-10-15 21:27:52,238:INFO:runner:main@186: ApiCoordinator DISABLED
2024-10-15 21:27:52,238:INFO:device:initialize@153: initializing device
2024-10-15 21:27:52,238:INFO:device:run@196: Running command: Command: self.code='cell_voltages' self.full_command=None, self.command_type='basic', [_outs='outputs.Screen: outputs the results to the screen as per the formatter supplied'], last_run='Not yet run', next_run='15 Oct 2024 21:27:52', trigger: every 60 loops togo: 0, CommandDefinition: self.code='cell_voltages', self.description='cell_voltages', self.result_type=<ResultType.CONSTRUCT: 8>, reading_definition count: 30, self.command_code='95', self.command_type=<CommandType.SERIAL_READ_UNTIL_DONE: 'serial_read_util_done'>, self.command_data=None self.override=None self.template=None
2024-10-15 21:27:52,239:INFO:daly:get_full_command@297: Using protocol b'DALY' with 6 commands
2024-10-15 21:27:52,239:INFO:testport:send_and_receive@68: Selected response number 3:, b'{\xa5\x01\x95\x08\x06\x0c\xce\x0c\xd0\x0c\xd0\xa0{\xa5\x01\x95\x08\x01\x0c\xd1\x0c\xd0\x0c\xce\xa0w\xa5\x01\x95\x08\x02\x0c\xd0\x0c\xcf\x0c\xd0\xa0x\xa5\x01\x95\x08\x03\x0c\xcf\x0c\xd0\x0c\xcf\xa0x\xa5\x01\x95\x08\x04\x0c\xd0\x0c\xcf\x0c\xd0\xa0z\xa5\x01\x95\x08\x05\x0c\xcf\x0c\xd0\x0c\xcf\xa0z\xa5\x01\x95\x08\x06\x0c\xcf\x0c\xd0\x0c\xcf\xa0{'
2024-10-15 21:27:52,239:INFO:result:decode_responses@105: result.response passed to decode: [('cell_16_voltage', 3278), ('cell_17_voltage', 3280), ('cell_18_voltage', 3280), ('cell_01_voltage', 3281), ('cell_02_voltage', 3280), ('cell_03_voltage', 3278), ('cell_04_voltage', 3280), ('cell_05_voltage', 3279), ('cell_06_voltage', 3280), ('cell_07_voltage', 3279), ('cell_08_voltage', 3280), ('cell_09_voltage', 3279), ('cell_10_voltage', 3280), ('cell_11_voltage', 3279), ('cell_12_voltage', 3280), ('cell_13_voltage', 3279), ('cell_14_voltage', 3280), ('cell_15_voltage', 3279), ('cell_16_voltage', 3279), ('cell_17_voltage', 3280), ('cell_18_voltage', 3279)], result_type ResultType.CONSTRUCT
2024-10-15 21:27:52,239:INFO:device:run@200: Got result: Result: self.command.command_definition.description='cell_voltages': self.is_valid=True, self.error=False - self.error_messages=[], self.raw_response=b'{\xa5\x01\x95\x08\x06\x0c\xce\x0c\xd0\x0c\xd0\xa0{\xa5\x01\x95\x08\x01\x0c\xd1\x0c\xd0\x0c\xce\xa0w\xa5\x01\x95\x08\x02\x0c\xd0\x0c\xcf\x0c\xd0\xa0x\xa5\x01\x95\x08\x03\x0c\xcf\x0c\xd0\x0c\xcf\xa0x\xa5\x01\x95\x08\x04\x0c\xd0\x0c\xcf\x0c\xd0\xa0z\xa5\x01\x95\x08\x05\x0c\xcf\x0c\xd0\x0c\xcf\xa0z\xa5\x01\x95\x08\x06\x0c\xcf\x0c\xd0\x0c\xcf\xa0{', Reading: self.data_name='cell_16_voltage', self.data_value=3.278, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_17_voltage', self.data_value=3.28, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_18_voltage', self.data_value=3.28, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_01_voltage', self.data_value=3.281, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_02_voltage', self.data_value=3.28, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_03_voltage', self.data_value=3.278, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_04_voltage', self.data_value=3.28, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_05_voltage', self.data_value=3.279, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_06_voltage', self.data_value=3.28, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_07_voltage', self.data_value=3.279, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_08_voltage', self.data_value=3.28, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_09_voltage', self.data_value=3.279, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_10_voltage', self.data_value=3.28, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_11_voltage', self.data_value=3.279, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_12_voltage', self.data_value=3.28, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_13_voltage', self.data_value=3.279, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_14_voltage', self.data_value=3.28, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_15_voltage', self.data_value=3.279, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_16_voltage', self.data_value=3.279, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_17_voltage', self.data_value=3.28, self.data_unit='V', self.is_valid=True,Reading: self.data_name='cell_18_voltage', self.data_value=3.279, self.data_unit='V', self.is_valid=True
2024-10-15 21:27:52,240:INFO:screen:process@19: Using output sender: screen
2024-10-15 21:27:52,240:INFO:table:format@29: Using output formatter: table
╔════════════════════════════════════════╗
║ Command: cell_voltages - cell_voltages ║
╠═════════════════╤═══════╤══════════════╣
║ Parameter │ Value │ Unit ║
╟─────────────────┼───────┼──────────────╢
║ cell_16_voltage │ 3.278 │ V ║
║ cell_17_voltage │ 3.28 │ V ║
║ cell_18_voltage │ 3.28 │ V ║
║ cell_01_voltage │ 3.281 │ V ║
║ cell_02_voltage │ 3.28 │ V ║
║ cell_03_voltage │ 3.278 │ V ║
║ cell_04_voltage │ 3.28 │ V ║
║ cell_05_voltage │ 3.279 │ V ║
║ cell_06_voltage │ 3.28 │ V ║
║ cell_07_voltage │ 3.279 │ V ║
║ cell_08_voltage │ 3.28 │ V ║
║ cell_09_voltage │ 3.279 │ V ║
║ cell_10_voltage │ 3.28 │ V ║
║ cell_11_voltage │ 3.279 │ V ║
║ cell_12_voltage │ 3.28 │ V ║
║ cell_13_voltage │ 3.279 │ V ║
║ cell_14_voltage │ 3.28 │ V ║
║ cell_15_voltage │ 3.279 │ V ║
║ cell_16_voltage │ 3.279 │ V ║
║ cell_17_voltage │ 3.28 │ V ║
║ cell_18_voltage │ 3.279 │ V ║
╚═════════════════╧═══════╧══════════════╝
2024-10-15 21:27:52,240:INFO:device:finalize@157: finalizing device
When I have some free time over the weekend, I'll check out powermon. I like the table formatter.
Offtopic, but I see you're using construct for parsing. That's awesome, I used it too when I was troubleshooting my issue (and on some other projects).
I ran the powermon overnight and reported voltage values were within the norm. It works well so far. Thank you.
I had one hiccup with the abnormal values elsewhere (soc, current), but I don't have any debug log. I'll see if I can reproduce it - anyway, that's for another repo.
good news it would be good to see the debug for other abnormal value - as it shouldnt pass crc if the data is corrupt...
I'm not sure exactly what caused it. I noticed the powermon was sending mqtt data (confirmed with MQTT Explorer), but Home Assistant wasn't updating the sensors for a few minutes. I restarted the services and there was a single update with abnormal values - but not all of them. Interestingly, individual cell voltages, capacity_ah, and cycles were fine.
It hasn't happened again so far, so it might be tricky to catch it again with debug. Maybe I can edit my install files so it writes a detailed log if SOC is over 100%.
Occasionally, reported cellVoltage values are outside of the norm. The app and the UART monitor show correct values all of the time.
Setup
I connected my Daly BMS (16S 48V 250A) to Raspberry Pi 4B through the UART to USB cable.
Input
mpp-solar -n DalyBMS -p /dev/ttyUSB0 -b 9600 -P DALY --porttype=dalyserial -c cellVoltages -D
Output (debug)
Notes
This is the serial response, broken down in chunks:
Based on the
frame_number
(the fifth byte) it looks like two readings where the first one is cut off right before the 6th chunk.Relevant dalyserialio logs:
Here's another example, same command:
Here we have more fragmented outputs. There are also chunks from different
command_ids
(\x93
,\x96
,\x94
).I observed that the correct readings have exactly 78 bytes (6 * 13). Anything else results in incorrect readings.
Things I've tried
--porttype=daly
makes many responses incompletebaud
rate other than9600
doesn't return anything at allP=DALY40
doesn't seem to have any effect