tdm icon indicating copy to clipboard operation
tdm copied to clipboard

Use wildcards in Autodiscovery patterns?

Open sammyke007 opened this issue 1 year ago • 70 comments

Is it possible to use wildcards in the Autodiscovery patterns? I've tried *, # or %, but none of them work? My fulltopics are %prefix%/tasmota/*room*/%topic%/. I can configure each room in the pattern match, but using a wildcard could be a lot easier (like %prefix%/tasmota/*/%topic%/).

sammyke007 avatar Dec 14 '23 10:12 sammyke007

That kinda makes sense. Let me test something

jziolkowski avatar Dec 15 '23 22:12 jziolkowski

Ok so tests are very promising! It was easier that I assumed.

Will you be able to test a TDM version from a branch?

jziolkowski avatar Dec 16 '23 15:12 jziolkowski

here is the branch: https://github.com/jziolkowski/tdm/tree/autodiscovery wildcard character is *, in your case it would be %prefix%/tasmota/*/%topic%/

This code also enables support for native tasmota autodetection, so some of the devices might be discovered anyway irrelevant if you have patterns configured for them.

Next, for some devices the online/offline status is randomly not updating; will be fixed also the current solution makes some topic subscriptions overlap; will be optimized

jziolkowski avatar Dec 16 '23 15:12 jziolkowski

Why not using the standard + MQTT wildcard ?

barbudor avatar Dec 16 '23 16:12 barbudor

I did consider that, yes. For now it's a proof of concept

jziolkowski avatar Dec 16 '23 17:12 jziolkowski

I've updated the branch. Now it's expected to use + the same way as you would use in MQTT topic. # is still not allowed.

jziolkowski avatar Dec 16 '23 22:12 jziolkowski

I'll test tomorrow! What a fast fix, tnx!

sammyke007 avatar Dec 16 '23 22:12 sammyke007

Hi @jziolkowski

So I did some test with one of my MQTT broker where I'm using sonnaz/%topic%/%prefix%/as full topic. Not using yet tasmota Discovery on that broker (but will do soon, may be tomorrow)

I have 4 devices : teleinfo, gateway, doorctr-garage1 and skt-gateway

With the latest version and using pattern to +/%topic%/%prefix%/ I had only 3 devices detected. teleinfo isn't But despite detection, none of the columns on any tab get filled. Module renames on "Fetching module name..." Openning a console and sending a command works fine and response is provided.

image

Logs:

$ python tdmgr.py --debug --config-location /c/Users/Jean-Michel/AppData/Roaming/tdm/flespi/ --log-location  /c/Users/Jean-Michel/AppData/Roaming/tdm/flespi/
2023-12-16 23:43:44 [INFO] ### TDM START ###
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
2023-12-16 23:43:44 [INFO] MQTT: Subscribed to tasmota/discovery/+/config, tele/+/#, stat/+/#, +/tele/#, +/stat/#, +/+/tele/#, +/+/stat/#
2023-12-16 23:43:44 [INFO] DISCOVERY(LEGACY): LWT from an unknown device sonnaz/teleinfo/tele/LWT
2023-12-16 23:43:44 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at cmnd/teleinfo/tele/FullTopic
2023-12-16 23:43:44 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at sonnaz/cmnd/tele/FullTopic
2023-12-16 23:43:44 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at sonnaz/cmndinfo/cmnd/FullTopic
2023-12-16 23:43:44 [INFO] DISCOVERY(LEGACY): LWT from an unknown device sonnaz/gateway/tele/LWT
2023-12-16 23:43:44 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at cmnd/gateway/tele/FullTopic
2023-12-16 23:43:44 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at sonnaz/cmnd/tele/FullTopic
2023-12-16 23:43:44 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at sonnaz/gateway/cmnd/FullTopic
2023-12-16 23:43:44 [INFO] DISCOVERY(LEGACY): LWT from an unknown device sonnaz/doorctr-garage1/tele/LWT
2023-12-16 23:43:44 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at cmnd/doorctr-garage1/tele/FullTopic
2023-12-16 23:43:44 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at sonnaz/cmnd/tele/FullTopic
2023-12-16 23:43:44 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at sonnaz/doorctr-garage1/cmnd/FullTopic
2023-12-16 23:43:44 [INFO] DISCOVERY(LEGACY): LWT from an unknown device sonnaz/skt-gateway/tele/LWT
2023-12-16 23:43:44 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at cmnd/skt-gateway/tele/FullTopic
2023-12-16 23:43:44 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at sonnaz/cmnd/tele/FullTopic
2023-12-16 23:43:44 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at sonnaz/skt-gateway/cmnd/FullTopic
2023-12-16 23:43:45 [DEBUG] DISCOVERY(LEGACY): topic sonnaz/doorctr-garage1/stat/FULLTOPIC is matched by fulltopic sonnaz/%topic%/%prefix%
2023-12-16 23:43:45 [INFO] DISCOVERY(LEGACY): Discovered topic=doorctr-garage1 with fulltopic=sonnaz/%topic%/%prefix%
2023-12-16 23:43:45 [DEBUG] DISCOVERY: Sending initial query to topic doorctr-garage1
2023-12-16 23:43:45 [DEBUG] DISCOVERY(LEGACY): topic sonnaz/skt-gateway/stat/FULLTOPIC is matched by fulltopic sonnaz/%topic%/%prefix%
2023-12-16 23:43:45 [INFO] DISCOVERY(LEGACY): Discovered topic=skt-gateway with fulltopic=sonnaz/%topic%/%prefix%
2023-12-16 23:43:45 [DEBUG] DISCOVERY: Sending initial query to topic skt-gateway
2023-12-16 23:43:45 [DEBUG] DISCOVERY(LEGACY): topic sonnaz/gateway/stat/FULLTOPIC is matched by fulltopic sonnaz/%topic%/%prefix%
2023-12-16 23:43:45 [INFO] DISCOVERY(LEGACY): Discovered topic=gateway with fulltopic=sonnaz/%topic%/%prefix%
2023-12-16 23:43:45 [DEBUG] DISCOVERY: Sending initial query to topic gateway

I believe the tele in teleinfo may be creating some issues.

With the version just before the last commit (when hte wildcard was *), the teleinfo device was detected but still no details retreived.

Let me know if you want more tests

barbudor avatar Dec 16 '23 22:12 barbudor

Adding a view from MQTT Explorer (note that blegateway is not a real Tasmota device so it has no LWT topic).

image

barbudor avatar Dec 16 '23 22:12 barbudor

Thx a lot, I'll look into it.

As for the tele in teleinfo, it's of not importance. I'm not using partial comparisons with tele, only a full string. As long as tele is a part of a word it's ok.

As for the "fetching..." it means that the incoming command responses are not being parsed correctly. Work continues.

jziolkowski avatar Dec 16 '23 23:12 jziolkowski

Oh wait, indeed there is a replacement.

2023-12-16 23:43:44 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at sonnaz/cmndinfo/cmnd/FullTopic

Need to have a look again.

jziolkowski avatar Dec 16 '23 23:12 jziolkowski

Ah got it. I'm replacing this part of the topic using regex matched string, not the location. Therefore it replaces all occurences in the string. Need to use start/end location in the string.

jziolkowski avatar Dec 16 '23 23:12 jziolkowski

As usual, regex save the world until they break it 🤣

barbudor avatar Dec 16 '23 23:12 barbudor

This noob is meanwhile looking how to compile an exe from source. It's easier to use python I guess?

sammyke007 avatar Dec 16 '23 23:12 sammyke007

Yes, get the python code and run it in a virtualenv

jziolkowski avatar Dec 16 '23 23:12 jziolkowski

Pushed a fix.

As the old adage goes "You have a problem. You try fixing it with regex. Now you have two problems."

jziolkowski avatar Dec 17 '23 00:12 jziolkowski

Hi @jziolkowski Just pulled your latest commit Result is worse, only 2 out of 4 devices detected but teleinfois part of it. Still fetching module name...

image

2023-12-17 19:04:30 [INFO] ### TDM START ###
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
2023-12-17 19:04:30 [INFO] MQTT: Subscribed to tasmota/discovery/+/config, tele/+/#, stat/+/#, +/tele/#, +/stat/#, +/+/tele/#, +/+/stat/#
2023-12-17 19:04:30 [INFO] DISCOVERY(LEGACY): LWT from an unknown device sonnaz/teleinfo/tele/LWT
2023-12-17 19:04:30 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at sonnaz/teleinfo/cmnd/FullTopic
2023-12-17 19:04:30 [INFO] DISCOVERY(LEGACY): LWT from an unknown device sonnaz/gateway/tele/LWT
2023-12-17 19:04:30 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at sonnaz/gateway/cmnd/FullTopic
2023-12-17 19:04:30 [INFO] DISCOVERY(LEGACY): LWT from an unknown device sonnaz/doorctr-garage1/tele/LWT
2023-12-17 19:04:30 [INFO] DISCOVERY(LEGACY): LWT from an unknown device sonnaz/skt-gateway/tele/LWT
2023-12-17 19:04:30 [DEBUG] DISCOVERY(LEGACY): topic sonnaz/teleinfo/stat/FULLTOPIC is matched by fulltopic sonnaz/%topic%/%prefix%
2023-12-17 19:04:30 [INFO] DISCOVERY(LEGACY): Discovered topic=teleinfo with fulltopic=sonnaz/%topic%/%prefix%
2023-12-17 19:04:30 [DEBUG] DISCOVERY: Sending initial query to topic teleinfo
2023-12-17 19:04:31 [DEBUG] DISCOVERY(LEGACY): topic sonnaz/gateway/stat/FULLTOPIC is matched by fulltopic sonnaz/%topic%/%prefix%
2023-12-17 19:04:31 [INFO] DISCOVERY(LEGACY): Discovered topic=gateway with fulltopic=sonnaz/%topic%/%prefix%
2023-12-17 19:04:31 [DEBUG] DISCOVERY: Sending initial query to topic gateway

barbudor avatar Dec 17 '23 18:12 barbudor

Argh I omitted - in regex 🤦‍♂️

jziolkowski avatar Dec 17 '23 19:12 jziolkowski

Pushed

jziolkowski avatar Dec 17 '23 19:12 jziolkowski

another push; I reverted the regex to simply ignore chars that are not valid in topics as per mqtt spec

jziolkowski avatar Dec 17 '23 19:12 jziolkowski

Detection o fthe 4 devices is now ok but still nothing more than "fetching module name" Same result wether I use +/%topic%/%prefix%/ or the exact sonnaz/%topic%/%prefix%/ Should I have expected more ?

barbudor avatar Dec 17 '23 20:12 barbudor

I have upgraded the 4 units with a firmware including TASMOTA_DISCOVERY I don't know if it was a good idea or not, with the idea to be sure it would use the discovery and not the LWT, I removed the LWT messages from the broker:

Only 2 devices detected (strangely the ESP32 based ones), module name fetched but only that. Ohter columns remains empty

Logs: Note the [ERROR] Unable to parse Tasmota discovery message messages

2023-12-17 21:40:51 [INFO] ### TDM START ###
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
QWidget::insertAction: Attempt to insert null action
2023-12-17 21:40:51 [INFO] MQTT: Subscribed to tasmota/discovery/+/config, tele/+/#, stat/+/#, +/tele/#, +/stat/#, sonnaz/+/tele/#, sonnaz/+/stat/#
2023-12-17 21:40:51 [DEBUG] ip=IPv4Address('192.168.1.5') dn='Controleur Porte Garage 1' fn=['Controleur Porte Garage 1', None, None, None, None, None, None, None] hn='doorctr-garage1' mac='3C71BF3ADCC7' md='ESP8266' ofln='Offline' onln='Online' state=['OFF', 'ON', 'TOGGLE', 'HOLD'] sw='13.3.0.1' t='doorctr-garage1' ft='sonnaz/%topic%/%prefix%' tp=TopicPrefixes(cmnd='cmnd', stat='stat', tele='tele') rl=[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] swc=[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1] btn=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] so={'4': 1, '11': 0, '13': 0, '17': 0, '20': 0, '30': 0, '68': 0, '73': 0, '82': 0, '114': 0, '117': 0} lk=0 lt_st=<LightType.NONE: 0> ver=1
2023-12-17 21:40:51 [ERROR] Unable to parse Tasmota discovery message: {"ip":"192.168.1.5","dn":"Controleur Porte Garage 1","fn":["Controleur Porte Garage 1",null,null,null,null,null,null,null],"hn":"doorctr-garage1","mac":"3C71BF3ADCC7","md":"ESP8266","ty":0,"if":0,"ofln":"Offline","onln":"Online","state":["OFF","ON","TOGGLE","HOLD"],"sw":"13.3.0.1","t":"doorctr-garage1","ft":"sonnaz/%topic%/%prefix%","tp":["cmnd","stat","tele"],"rl":[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"swc":[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"swn":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"btn":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"so":{"4":1,"11":0,"13":0,"17":0,"20":0,"30":0,"68":0,"73":0,"82":0,"114":0,"117":0},"lk":0,"lt_st":0,"bat":0,"dslp":0,"sho":[],"sht":[],"ver":1}
2023-12-17 21:40:51 [DEBUG] ip=IPv4Address('192.168.1.6') dn='Prise Gateway' fn=['Prise Gateway', None, None, None, None, None, None, None] hn='skt-gateway' mac='2462AB34DBF0' md='Gosund SP111' ofln='Offline' onln='Online' state=['OFF', 'ON', 'TOGGLE', 'HOLD'] sw='13.3.0.1' t='skt-gateway' ft='sonnaz/%topic%/%prefix%' tp=TopicPrefixes(cmnd='cmnd', stat='stat', tele='tele') rl=[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] swc=[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1] btn=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] so={'4': 1, '11': 0, '13': 0, '17': 0, '20': 0, '30': 0, '68': 0, '73': 0, '82': 0, '114': 0, '117': 0} lk=0 lt_st=<LightType.NONE: 0> ver=1
2023-12-17 21:40:51 [ERROR] Unable to parse Tasmota discovery message: {"ip":"192.168.1.6","dn":"Prise Gateway","fn":["Prise Gateway",null,null,null,null,null,null,null],"hn":"skt-gateway","mac":"2462AB34DBF0","md":"Gosund SP111","ty":0,"if":0,"ofln":"Offline","onln":"Online","state":["OFF","ON","TOGGLE","HOLD"],"sw":"13.3.0.1","t":"skt-gateway","ft":"sonnaz/%topic%/%prefix%","tp":["cmnd","stat","tele"],"rl":[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"swc":[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"swn":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"btn":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"so":{"4":1,"11":0,"13":0,"17":0,"20":0,"30":0,"68":0,"73":0,"82":0,"114":0,"117":0},"lk":0,"lt_st":0,"bat":0,"dslp":0,"sho":[],"sht":[],"ver":1}
2023-12-17 21:40:51 [DEBUG] ip=IPv4Address('192.168.1.3') dn='Gateway (Sonnaz)' fn=['Unconfigured', None, None, None, None, None, None, None] hn='gateway' mac='B8F009CC8C5C' md='ESP32-DevKit' ofln='Offline' onln='Online' state=['OFF', 'ON', 'TOGGLE', 'HOLD'] sw='13.3.0.1' t='gateway' ft='sonnaz/%topic%/%prefix%' tp=TopicPrefixes(cmnd='cmnd', stat='stat', tele='tele') rl=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] swc=[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1] btn=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] so={'4': 1, '11': 0, '13': 0, '17': 0, '20': 0, '30': 0, '68': 0, '73': 0, '82': 0, '114': 0, '117': 0} lk=0 lt_st=<LightType.NONE: 0> ver=1
2023-12-17 21:40:51 [INFO] DISCOVERY(NATIVE): Discovered topic=gateway with fulltopic=sonnaz/%topic%/%prefix%
2023-12-17 21:40:51 [DEBUG] ip=IPv4Address('192.168.1.4') dn='Teleinfo Sonnaz' fn=['Teleinfo Sonnaz', None, None, None, None, None, None, None] hn='teleinfo' mac='78E36D0914D0' md='miniD1-teleinfo' ofln='Offline' onln='Online' state=['OFF', 'ON', 'TOGGLE', 'HOLD'] sw='13.3.0.1' t='teleinfo' ft='sonnaz/%topic%/%prefix%' tp=TopicPrefixes(cmnd='cmnd', stat='stat', tele='tele') rl=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] swc=[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1] btn=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] so={'4': 1, '11': 0, '13': 0, '17': 0, '20': 0, '30': 0, '68': 1, '73': 0, '82': 0, '114': 1, '117': 0} lk=0 lt_st=<LightType.NONE: 0> ver=1
2023-12-17 21:40:51 [INFO] DISCOVERY(NATIVE): Discovered topic=teleinfo with fulltopic=sonnaz/%topic%/%prefix%

barbudor avatar Dec 17 '23 20:12 barbudor

Restarting the devices to get the LWT back, still having the +/%topic%/%prefix%/ pattern, I get the 4 devices back but still error messages parsing the discovery payload for the ESP8266 devices

2023-12-17 21:49:30 [INFO] MQTT: Subscribed to tasmota/discovery/+/config, tele/+/#, stat/+/#, +/tele/#, +/stat/#, +/+/tele/#, +/+/stat/#
2023-12-17 21:49:30 [DEBUG] ip=IPv4Address('192.168.1.5') dn='Controleur Porte Garage 1' fn=['Controleur Porte Garage 1', None, None, None, None, None, None, None] hn='doorctr-garage1' mac='3C71BF3ADCC7' md='ESP8266' ofln='Offline' onln='Online' state=['OFF', 'ON', 'TOGGLE', 'HOLD'] sw='13.3.0.1' t='doorctr-garage1' ft='sonnaz/%topic%/%prefix%' tp=TopicPrefixes(cmnd='cmnd', stat='stat', tele='tele') rl=[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] swc=[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1] btn=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] so={'4': 1, '11': 0, '13': 0, '17': 0, '20': 0, '30': 0, '68': 0, '73': 0, '82': 0, '114': 0, '117': 0} lk=0 lt_st=<LightType.NONE: 0> ver=1
2023-12-17 21:49:30 [ERROR] Unable to parse Tasmota discovery message: {"ip":"192.168.1.5","dn":"Controleur Porte Garage 1","fn":["Controleur Porte Garage 1",null,null,null,null,null,null,null],"hn":"doorctr-garage1","mac":"3C71BF3ADCC7","md":"ESP8266","ty":0,"if":0,"ofln":"Offline","onln":"Online","state":["OFF","ON","TOGGLE","HOLD"],"sw":"13.3.0.1","t":"doorctr-garage1","ft":"sonnaz/%topic%/%prefix%","tp":["cmnd","stat","tele"],"rl":[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"swc":[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"swn":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"btn":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"so":{"4":1,"11":0,"13":0,"17":0,"20":0,"30":0,"68":0,"73":0,"82":0,"114":0,"117":0},"lk":0,"lt_st":0,"bat":0,"dslp":0,"sho":[],"sht":[],"ver":1}
2023-12-17 21:49:30 [DEBUG] ip=IPv4Address('192.168.1.6') dn='Prise Gateway' fn=['Prise Gateway', None, None, None, None, None, None, None] hn='skt-gateway' mac='2462AB34DBF0' md='Gosund SP111' ofln='Offline' onln='Online' state=['OFF', 'ON', 'TOGGLE', 'HOLD'] sw='13.3.0.1' t='skt-gateway' ft='sonnaz/%topic%/%prefix%' tp=TopicPrefixes(cmnd='cmnd', stat='stat', tele='tele') rl=[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] swc=[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1] btn=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] so={'4': 1, '11': 0, '13': 0, '17': 0, '20': 0, '30': 0, '68': 0, '73': 0, '82': 0, '114': 0, '117': 0} lk=0 lt_st=<LightType.NONE: 0> ver=1
2023-12-17 21:49:30 [ERROR] Unable to parse Tasmota discovery message: {"ip":"192.168.1.6","dn":"Prise Gateway","fn":["Prise Gateway",null,null,null,null,null,null,null],"hn":"skt-gateway","mac":"2462AB34DBF0","md":"Gosund SP111","ty":0,"if":0,"ofln":"Offline","onln":"Online","state":["OFF","ON","TOGGLE","HOLD"],"sw":"13.3.0.1","t":"skt-gateway","ft":"sonnaz/%topic%/%prefix%","tp":["cmnd","stat","tele"],"rl":[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"swc":[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"swn":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"btn":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"so":{"4":1,"11":0,"13":0,"17":0,"20":0,"30":0,"68":0,"73":0,"82":0,"114":0,"117":0},"lk":0,"lt_st":0,"bat":0,"dslp":0,"sho":[],"sht":[],"ver":1}
2023-12-17 21:49:30 [DEBUG] ip=IPv4Address('192.168.1.3') dn='Gateway (Sonnaz)' fn=['Unconfigured', None, None, None, None, None, None, None] hn='gateway' mac='B8F009CC8C5C' md='ESP32-DevKit' ofln='Offline' onln='Online' state=['OFF', 'ON', 'TOGGLE', 'HOLD'] sw='13.3.0.1' t='gateway' ft='sonnaz/%topic%/%prefix%' tp=TopicPrefixes(cmnd='cmnd', stat='stat', tele='tele') rl=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] swc=[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1] btn=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] so={'4': 1, '11': 0, '13': 0, '17': 0, '20': 0, '30': 0, '68': 0, '73': 0, '82': 0, '114': 0, '117': 0} lk=0 lt_st=<LightType.NONE: 0> ver=1
2023-12-17 21:49:30 [INFO] DISCOVERY(NATIVE): Discovered topic=gateway with fulltopic=sonnaz/%topic%/%prefix%
2023-12-17 21:49:30 [DEBUG] ip=IPv4Address('192.168.1.4') dn='Teleinfo Sonnaz' fn=['Teleinfo Sonnaz', None, None, None, None, None, None, None] hn='teleinfo' mac='78E36D0914D0' md='miniD1-teleinfo' ofln='Offline' onln='Online' state=['OFF', 'ON', 'TOGGLE', 'HOLD'] sw='13.3.0.1' t='teleinfo' ft='sonnaz/%topic%/%prefix%' tp=TopicPrefixes(cmnd='cmnd', stat='stat', tele='tele') rl=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] swc=[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1] btn=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] so={'4': 1, '11': 0, '13': 0, '17': 0, '20': 0, '30': 0, '68': 1, '73': 0, '82': 0, '114': 1, '117': 0} lk=0 lt_st=<LightType.NONE: 0> ver=1
2023-12-17 21:49:30 [INFO] DISCOVERY(NATIVE): Discovered topic=teleinfo with fulltopic=sonnaz/%topic%/%prefix%
2023-12-17 21:49:30 [DEBUG] MQTT: LWT message for teleinfo: Online
2023-12-17 21:49:30 [DEBUG] MQTT: LWT message for gateway: Online
2023-12-17 21:49:30 [INFO] DISCOVERY(LEGACY): LWT from an unknown device sonnaz/doorctr-garage1/tele/LWT
2023-12-17 21:49:30 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at sonnaz/doorctr-garage1/cmnd/FullTopic
2023-12-17 21:49:30 [INFO] DISCOVERY(LEGACY): LWT from an unknown device sonnaz/skt-gateway/tele/LWT
2023-12-17 21:49:30 [DEBUG] DISCOVERY(LEGACY): Asking an unknown device for FullTopic at sonnaz/skt-gateway/cmnd/FullTopic
2023-12-17 21:49:30 [DEBUG] DISCOVERY(LEGACY): topic sonnaz/doorctr-garage1/stat/FULLTOPIC is matched by fulltopic sonnaz/%topic%/%prefix%
2023-12-17 21:49:30 [INFO] DISCOVERY(LEGACY): Discovered topic=doorctr-garage1 with fulltopic=sonnaz/%topic%/%prefix%
2023-12-17 21:49:30 [DEBUG] DISCOVERY: Sending initial query to topic doorctr-garage1
2023-12-17 21:49:31 [DEBUG] DISCOVERY(LEGACY): topic sonnaz/skt-gateway/stat/FULLTOPIC is matched by fulltopic sonnaz/%topic%/%prefix%
2023-12-17 21:49:31 [INFO] DISCOVERY(LEGACY): Discovered topic=skt-gateway with fulltopic=sonnaz/%topic%/%prefix%
2023-12-17 21:49:31 [DEBUG] DISCOVERY: Sending initial query to topic skt-gateway

barbudor avatar Dec 17 '23 20:12 barbudor

Legacy discovery won't work without retained LWT.

As for the fetching: I don't see this issue.

Also I'm surprised you now have the same errors parsing some messages as I do have. I expected it to be somehow related with my oddly behaving broker, but not. Hmm.

jziolkowski avatar Dec 17 '23 20:12 jziolkowski

From your earlier posts I see that you have SetOption4 enabled (the response is coming from the /<cmnd name> topic, not /RESULT; I'll look into it.

jziolkowski avatar Dec 17 '23 20:12 jziolkowski

I don't see any differences in the discovery messages from ESP32 or ESP8266 except the ESP8266 are the only ones wiht a dash - in both the topic and the hostname

barbudor avatar Dec 17 '23 20:12 barbudor

The broker is flespi.io

barbudor avatar Dec 17 '23 20:12 barbudor

you have SetOption4

Indeed but that doesn't create a problem with hte same code on my home setup with mosquitto and a standard full topic

barbudor avatar Dec 17 '23 21:12 barbudor

you have SetOption4

Indeed but that doesn't create a problem with hte same code on my home setup with mosquitto and a standard full topic

Indeed it should not. The result is parsed later at this point; the matching of device is done earlier. Still, I don't see why you would have a problem with that.

Either way I don't have spare test devices here, I'll be able to try and mimic your setup tomorrow.

Right now I will just add options to TDM to control which discovery is being used.

jziolkowski avatar Dec 17 '23 21:12 jziolkowski

Upgrading home to get the discovery behave strangely After their upgrade and reboot, all devices appeared as Offline Restarting TDM solved that except for 1 device that remains displayed as Offline while it is not And the logs show TDM see the Online status A 2nd restart of TDM cleared the problem

barbudor avatar Dec 17 '23 21:12 barbudor