jollyjinx / modbus-2-mqtt-bridge

Bidirectional Modbus 2 MQTT Bridge with docker container and ready to use json definitions for lambda heatpumps, sma & goodwe inverters, phoenix contact, hm310,...
MIT License
6 stars 3 forks source link

Program crashes on startup with duplicate Modbus address entries #3

Closed daftbugs closed 6 months ago

daftbugs commented 7 months ago

Hi,

although not very grave in nature, I just wanted to give a heads up about the following crash on program startup:

Swift/NativeDictionary.swift:770: Fatal error: Duplicate values for key: '35121' 💣 Program crashed: Illegal instruction at 0x00007fa20fdcad12

Thread 1 crashed:

0 0x00007fa20fdcad12 assertionFailure(:_:file:line:flags:) + 354 in libswiftCore.so 1 specialized static ModbusDefinition.read(from:) + 1794 in modbus2mqtt at /swift/Sources/modbus2mqtt/ModbusDefinition.swift:121:27 2 startServing(modbusDevice:mqttServer:options:) + 147 in modbus2mqtt at /swift/Sources/modbus2mqtt/modbus2mqtt.swift:157:50 3 modbus2mqtt.run() in modbus2mqtt at /swift/Sources/modbus2mqtt/modbus2mqtt.swift:127 4 static AsyncParsableCommand.main() in modbus2mqtt at /swift/.build/checkouts/swift-argument-parser/Sources/ArgumentParser/Parsable Types/AsyncParsableCommand.swift:37 5 0x00007fa20fc450b0 completeTaskAndRelease(swift::AsyncContext, swift::SwiftError) in libswift_Concurrency.so

Backtrace took 2.41s This happens if there are (at least) 2 entries with the same Modbus address in the JSON device spec file.

jollyjinx commented 6 months ago

Thanx for the bug report. Have to make a test for that as it's a hinderance for novice users that want to add an entry.

jollyjinx commented 6 months ago

I've added a test and an exact error about the duplicate entry on the development branch right now.