john30 / ebusd

daemon for communication with eBUS heating systems
GNU General Public License v3.0
592 stars 136 forks source link

Duplictae entry in csv not reported correctly #1307

Closed thomaskilian closed 4 months ago

thomaskilian commented 4 months ago

Description

I have created a new csv for my WRSol and trying to add more lines I see this message:

2024-07-12 16:33:35.988 [main error] error reading scan config file tem/fc..sc.csv for ID "wrsol", SW2422, HW1112: ERR: duplicate 
entry, tem/fc..sc.csv:5: ERR: duplicate entry, duplicate ID

Well, please, which one is duplicate? I almost started and have only 3 lines which makes guessing not so difficult. But clearly an error message should indicate the error and not just croak "something is wrong".

Actual behavior

see above. incomplete error message

Expected behavior

Indication of which ID exactly is duplicate

ebusd version

23.2

ebusd arguments

ebusd --foreground --mqtthost=core-mosquitto --mqttport=1883 --mqttuser=mqtt --mqttpass=c00kies --scanconfig --mqttjson --configpath=/config/ebusd/config --accesslevel=* --mqttint=/config/ebusd/mqtt-hassio.cfg --mqtttopic=ebusd --device=ens:192.168.2.136:9999 --log=all:notice --enablehex | s6-log 1 n5 s1000000 /config/ebusd/logs 2

Operating system

other

CPU architecture

arm64

Dockerized

same as ebusd version

Hardware interface

Adapter Shield v5 via WiFi

Related integration

MQTT Home Assistant via mqtt-hassio.cfg

Logs

not relevant

john30 commented 4 months ago

whats so difficult about loooking at line 5 of the definitions as reported? every message has an id field, so this would be a good start to check. and the name+circuit need to be unique, which should be obvious as well. anyway, if you shared the definitions, it would be easy to help. this way it isn't.

thomaskilian commented 4 months ago

If you KNOW that the 5 indicates the line, it's easier. of course. But an attitude about creating meaningful error messages should be planted in any coder's heart. What's so difficult in changing the code to printing "duplicate ID "?

john30 commented 4 months ago

colon followed by line number does not really seem unusual at all to me - basically nearly every code editor does it this way, so for a coder not a problem at all.

...What's so difficult in changing the code to printing "duplicate ID "?

already the case, at least according to your own comment above:

2024-07-12 16:33:35.988 [main error] error reading scan config file tem/fc..sc.csv for ID "wrsol", SW2422, HW1112: ERR: duplicate 
entry, tem/fc..sc.csv:5: ERR: duplicate entry, **duplicate ID**