jziolkowski / tdm

GUI application to discover and monitor devices flashed with https://github.com/arendst/tasmota
GNU General Public License v3.0
664 stars 84 forks source link

Not all devices are recognized #54

Closed arendst closed 4 years ago

arendst commented 4 years ago

As a continuation of our discord chat I would like to open an issue to keep track of the situation.

I'm still missing consistenly devices from the TDM device list. After I first missed a POW I now also miss another device. Both devices seem to be accessable by TDM as they both show this after a restart:

00:00:00 CFG: Loaded from flash at F9, Count 3625
00:00:00 Project tasmota Pow1 Logeerkamer Version 7.0.0.5(tasmota)-2_6_1
00:00:04 WIF: Connecting to AP1 indebuurt3 in mode 11N as pow1...
00:00:05 WIF: Connected
00:00:05 HTP: Web server active on pow1 with IP address 192.168.2.151
09:26:30 MQT: Attempting connection...
09:26:30 MQT: Connected
09:26:30 MQT: tele/pow1/LWT = Online (retained)
09:26:30 MQT: cmnd/pow1/POWER = 
09:26:30 MQT: tele/pow1/INFO1 = {"Module":"Sonoff Pow","Version":"7.0.0.5(tasmota)","FallbackTopic":"cmnd/DVES_20DCDC_fb/","GroupTopic":"cmnd/sonoffs/"}
09:26:30 MQT: tele/pow1/INFO2 = {"WebServerMode":"Admin","Hostname":"pow1","IPAddress":"192.168.2.151"}
09:26:30 MQT: tele/pow1/INFO3 = {"RestartReason":"Software/System restart"}
09:26:30 MQT: stat/pow1/POWER1 = {"POWER1":"ON"}
09:26:30 MQT: stat/pow1/POWER1 = ON
09:26:30 MQT: stat/pow1/FULLTOPIC = {"FullTopic":"%prefix%/%topic%/"}

or

00:00:00 CFG: Loaded from flash at FA, Count 5600
00:00:00 Project tasmota Wkaku8 Slaapkamer BBus Version 7.0.0.5(tasmota)-2_6_1
00:00:04 WIF: Connecting to AP2 indebuurt3 in mode 11N as wkaku8...
00:00:05 WIF: Connected
00:00:05 HTP: Web server active on wkaku8 with IP address 192.168.2.210
09:14:01 MQT: Attempting connection...
09:14:01 MQT: Connected
09:14:01 MQT: tele/wkaku8/LWT = Online (retained)
09:14:01 MQT: cmnd/wkaku8/POWER = 
09:14:01 MQT: tele/wkaku8/INFO1 = {"Module":"Sonoff Basic","Version":"7.0.0.5(tasmota)","FallbackTopic":"cmnd/DVES_8875AD_fb/","GroupTopic":"cmnd/brievenbus/"}
09:14:01 MQT: tele/wkaku8/INFO2 = {"WebServerMode":"Admin","Hostname":"wkaku8","IPAddress":"192.168.2.210"}
09:14:01 MQT: tele/wkaku8/INFO3 = {"RestartReason":"Software/System restart"}
09:14:01 MQT: stat/wkaku8/POWER1 = {"POWER1":"OFF"}
09:14:01 MQT: stat/wkaku8/POWER1 = OFF
09:14:01 MQT: stat/wkaku8/FULLTOPIC = {"FullTopic":"%prefix%/%topic%/"}
09:14:02 MQT: domoticz/in = {"idx":133,"nvalue":0,"svalue":"","Battery":100,"RSSI":5}
09:14:05 MQT: tele/wkaku8/STATE = {"Time":"2019-11-20T09:14:05","Uptime":"0T00:00:13","UptimeSec":13,"Heap":30,"SleepMode":"Dynamic","Sleep":0,"LoadAvg":68,"MqttCount":1,"POWER1":"OFF","Wifi":{"AP":2,"SSId":"indebuurt3","BSSId":"60:E3:27:58:77:E6","Channel":12,"RSSI":52,"LinkCount":1,"Downtime":"0T00:00:07"}}
09:16:51 MQT: stat/wkaku8/FULLTOPIC = {"FullTopic":"%prefix%/%topic%/"}

The fulltopic probe comes from TDM I suppose as they are normally not there. After this no other TDM requests are received other than once in a while the fulltopic request.

30 other devices are detected just fine.

Any suggestion?

arendst commented 4 years ago

Once I add the devices manually to devices,cfg as:

[5C-CF-7F-88-75-AD]
topic=wkaku8
full_topic=%prefix%/%topic%/
friendly_name=Wkaku8 Slaapkamer BBus

[5C-CF-7F-20-DC-DC]
topic=pow1
full_topic=%prefix%/%topic%/
friendly_name=Pow1 Logeerkamer

They show up in the device list BUT without a Module name ?!?

image

image

Hope this helps narrowing it down.

jziolkowski commented 4 years ago

If they show up without module info, it means that there is some obstruction in the MQTT chat between TDM and the device/broker. I'll add some logging to the discovery process, I'll let you know.

jziolkowski commented 4 years ago

Please get the latest commit. Remove the devices.cfg file. Edit tdm.cfg and in the 'General' section add "loglevel=DEBUG". Start tdm and paste the output of tdm.log (nothing sensitive goes there).

arendst commented 4 years ago
jziolkowski commented 4 years ago

Seems you have a LOT of retained LWT messages ;) I'll add a function to TDM to delete them on request.

Do you see any LWTs from other devices that are present, but not being picked up by TDM?

either way, I see that

2019-11-20 16:11:05 [DEBUG] DISCOVERY: LWT from an unknown device tele/pow1/LWT 2019-11-20 16:11:05 [DEBUG] DISCOVERY: Asking an unknown device for FullTopic at cmnd/pow1/FullTopic

the elusive pow1 is being asked for the FullTopic but no reply reaches the tool. Can you do publish FullTopic command to pow1 using a standalone MQTT client?

(p.s. that OpenHAB thing is a dummy import from new OH functions and are irrelevant if you use OH or not)

arendst commented 4 years ago

With line 13 enabled the code just doesn't run. I think a try/except will solve this.

There are a lot of retained LWT messages indeed.

Using mqtt-spy I execute cmnd/pow1/fulltopic and receive the requested info correctly.

stat/pow1/FULLTOPIC
{"FullTopic":"%prefix%/%topic%/"}
jziolkowski commented 4 years ago

aaaand we see the culprit :)

your device replies on /FULLTOPIC instead of /RESULT. I'll add the necessary logic to TDM. Stay tuned ;)

And yes, L13 indeed breaks TDM because being the git hacker I am, I forgot to commit the OpenHAB dialog ;)

arendst commented 4 years ago

Wonderful!

jziolkowski commented 4 years ago

However this SetOption4 might open a whole new can of worms in TDM, as most of the logic relies on the standard options for now. I'll enable this option on my test device and check for other problems before releasing the fix.

arendst commented 4 years ago

Take your time and pls do support this functionality.

jziolkowski commented 4 years ago

Well with all the misc improvements done in Tasmota for TDM I can only respond with the same ;)

arendst commented 4 years ago

Your latest change at least finds the devices.

Now on to fixing all other non-RESULT responses like Module ;-)

arendst commented 4 years ago

In the meantime I'll switch SetOption4 off as it found now one other device I apparently missed.

jziolkowski commented 4 years ago

I've created a new dev branch for SO4-enabled devices. Please try it. At the moment the it only should show all the info in the devices list (stuff like rules, timers etc will not work at this moment). Please test.

arendst commented 4 years ago

At least it recognizes the Module name correctly so that looks fine.

What you do with the old LWT I don't know as they still appear in my mosquito console which is fine as I would like to keep them.

Also nice to have the WebUI in the pop-up. I know double click opens console but having it in the pop-up too makes it complete.

arendst commented 4 years ago

Ah it's a new option in MQTT. Testing...

arendst commented 4 years ago

Yes, the unwanted ones are gone. Pls disable all as default as I had to go ver them one by one. Or add a selection for all or none.

jziolkowski commented 4 years ago

Added select all/none in latest commit.

I'll continue in further supporting SO4 then, if it seems to be working.

jziolkowski commented 4 years ago

That took WAY longer that I've anticipated, but SO4 support is done in the latest master.

jziolkowski commented 4 years ago

By the way, I've redone the rules parser and now it works even if there is JSON in the do ... endon.

jziolkowski commented 4 years ago

My test shown it works, closing due to inactivity. Can always reopen or make a new issue.