TDM crash when connecting to MQTT broker
Hello,
Seems like TDM don't like something in my network 😅 . First I tried binary but it dumped me exception in Qt5Core.dll - that much reported windows in event log:
Faulting application name: tdmgr_0.2.11.exe, version: 0.0.0.0, time stamp: 0x60ec063e
Faulting module name: Qt5Core.dll, version: 5.14.2.0, time stamp: 0x5e7dfaa2
Exception code: 0xc0000409
Fault offset: 0x00000000000250d8
Faulting process id: 0x3554
Faulting application start time: 0x01d842dcbcc5a7cb
Faulting application path: D:\Program Files\TDM\tdmgr_0.2.11.exe
Faulting module path: C:\Users\<user>\AppData\Local\Temp\_MEI151082\Qt5Core.dll
Report Id: 2c8d757d-b607-4286-8f3d-53a00af983f5
Faulting package full name:
Faulting package-relative application ID:
So I added to cfg loglevel=DEBUG and got in log:
2022-03-28 22:43:35 [INFO] ### TDM START ###
2022-03-28 22:43:58 [INFO] MQTT: Subscribed to tele/#, stat/#, cmnd/#, +/tele/#, +/stat/#, +/cmnd/#, home/esp/#, home/esp/#, home/esp/#, home/esp/tele/#, home/esp/stat/#, home/esp/cmnd/#
2022-03-28 22:43:58 [INFO] DISCOVERY: LWT from an unknown device tele/odpwr/LWT
2022-03-28 22:43:58 [DEBUG] DISCOVERY: Asking an unknown device for FullTopic at cmnd/odpwr/FullTopic
2022-03-28 22:43:58 [INFO] DISCOVERY: LWT from an unknown device home/esp/odpwr/LWT
2022-03-28 22:43:58 [DEBUG] DISCOVERY: Asking an unknown device for FullTopic at cmnd/esp/FullTopic
2022-03-28 22:43:58 [DEBUG] DISCOVERY: Asking an unknown device for FullTopic at home/cmnd/FullTopic
But I'm stubborn 😁 , so my next attempt is to grab code from git and run it, so I got python3.9 (on windows 😒 ), created venv, installed needed modules... and this is what I got in command when I try connecting to MQTT:
Traceback (most recent call last):
File "D:\Program Files\TDMpy\tdm\tdmgr.py", line 353, in mqtt_message
possible_topic_cmnd = p.replace("%prefix%", "cmnd").replace("%topic%", possible_topic) + "FullTopic"
TypeError: replace() argument 2 must be str, not None
The device on which one, seems TDM to crash is running tasmota 8.1.0 (I know I bit old, but it works perfect: "if it works, don't touch it 😄 " ).
This Tasmota device seems to be badly configured:
2022-03-28 22:43:58 [INFO] DISCOVERY: LWT from an unknown device home/esp/odpwr/LWT
The FullTopic is likely to be missing the %prefix% part
Hello,
Sorry, I don't have notification on mail enabled so I only now saw this...
I have some devices configured more "hard" way 😅
That how looks fulltopic for this device:
21:03:51 CMD: fulltopic
21:03:51 MQT: tele/odpwr/RESULT = {"FullTopic":"tele/%topic%/"}
Yes, totally wrong Don't expect neither tasmota nor TDM to work with such setup
Tasmota work OK, this one particular device works as monitor and "switch with schedule" , it never meant to be controlled remotely. (and I prefer to set-up devices manually via yaml in HA so I don't even care nor bother for auto-discovery 🙃 )
I think, You should consider this a bug - because misconfiguration should not totally crash application 😬 without leaving no logs...
I've tested this fulltopic on my device and it doesn't crash TDM (anymore?)
However I've modified the line you've pointed out to check if there is any match before processing further.
why did I close that? :D