Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use wildcards in Autodiscovery patterns? #254

Open
sammyke007 opened this issue Dec 14, 2023 · 68 comments
Open

Use wildcards in Autodiscovery patterns? #254

sammyke007 opened this issue Dec 14, 2023 · 68 comments
Assignees

Comments

@sammyke007
Copy link

sammyke007 commented Dec 14, 2023

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%/).

@jziolkowski
Copy link
Owner

That kinda makes sense. Let me test something

@jziolkowski
Copy link
Owner

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
Copy link
Owner

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

@barbudor
Copy link
Contributor

Why not using the standard + MQTT wildcard ?

@jziolkowski
Copy link
Owner

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

@jziolkowski
Copy link
Owner

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.

@sammyke007
Copy link
Author

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

@barbudor
Copy link
Contributor

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
Copy link
Contributor

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

image

@jziolkowski
Copy link
Owner

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
Copy link
Owner

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
Copy link
Owner

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.

@barbudor
Copy link
Contributor

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

@sammyke007
Copy link
Author

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

@jziolkowski
Copy link
Owner

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

@jziolkowski
Copy link
Owner

Pushed a fix.

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

@barbudor
Copy link
Contributor

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

@jziolkowski
Copy link
Owner

Argh I omitted - in regex 🤦‍♂️

@jziolkowski
Copy link
Owner

Pushed

@jziolkowski
Copy link
Owner

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

@barbudor
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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

@jziolkowski
Copy link
Owner

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
Copy link
Owner

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.

@barbudor
Copy link
Contributor

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
Copy link
Contributor

The broker is flespi.io

@barbudor
Copy link
Contributor

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

@jziolkowski
Copy link
Owner

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.

@barbudor
Copy link
Contributor

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
Copy link
Contributor

But still empty columns

@jziolkowski
Copy link
Owner

as for the patterns missing trailing /: do they include the / in the dialog? I don't see such shenanigans in my setup, topics are replaced as expected

@jziolkowski
Copy link
Owner

I've added some simple tests for this parser, you can try some topics and see what happens

@barbudor
Copy link
Contributor

barbudor commented Dec 18, 2023

In the 1st case, I didn't add the pattern
It was infered by TDM by parsing the discovery topic which doesn't not include the ending / : "ft": "sonnaz/%topic%/%prefix%",
And when manually adding the pattern, yes actually I forgot the ending /
So indeed better to be prepared for both cases

Did you pushed anything ?
The branch doesn't seems to have any new commit since 20:00

leaving for today...

@jziolkowski
Copy link
Owner

No, I'm back to drawing board. Yes, I will ensure that all patterns have the trailing / added or kept.

I noticed that I'm using two different matching functions in separate places, I will rework the message/topic coming from the broker to have some methods included. Most likely tomorrow.

@jziolkowski
Copy link
Owner

jziolkowski commented Dec 20, 2023

Ok, there's progress. I refactored quite a lot of how messages and devices interact from TDM point of view. That triggered more refactoring of the general processing of incoming messages.

Also I've "accidentally" fixed #95, so that's nice.

No commit at the moment, some stuff still not working.

@jziolkowski
Copy link
Owner

jziolkowski commented Dec 21, 2023

I just pushed a commit. Beware: this is a huge WIP. For now all I ask you to test is the initial discovery process and any report errors that might appear. --debug would be helpful. There are still Online/Offline issues and the data received is 99% not represented visually in TDM yet

@barbudor
Copy link
Contributor

On the cloud broker, still some / missing as with no pattern defined, it tries to subscribe to sonnaz/+/tele+ in tdmngr.py:362

2023-12-21 21:27:18 [INFO] MQTT: Subscribed to tasmota/discovery/+/config, tele/#, stat/#, +/tele/#, +/stat/#
2023-12-21 21:27:18 [DEBUG] ip=IPv4Address('192.168.1.5') dn='Porte Garage 1 [Sonnaz]' fn=['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
Traceback (most recent call last):
  File "D:\Projets\repos\tdm\tdmgr.py", line 362, in mqtt_message
    self.mqtt.subscribe([(sub_topic, 0)])
  File "D:\Projets\repos\tdm\util\mqtt.py", line 223, in subscribe
    self.m_client.subscribe(path)
  File "C:\Users\Jean-Michel\AppData\Local\Programs\Python\Python310\lib\site-packages\paho\mqtt\client.py", line 1491, in subscribe
    raise ValueError('Invalid subscription filter.')
ValueError: Invalid subscription filter.

Same with pattern defined

On my home broker (standard FT), without patterns, it starts but there is a lot of errors such as:

2023-12-21 21:32:04 [ERROR] PROCESSING: No processor for endpoint GPIOS
2023-12-21 21:32:04 [ERROR] PROCESSING: No processor for endpoint MARGINS
2023-12-21 21:32:05 [ERROR] PROCESSING: No processor for endpoint GPIOS
2023-12-21 21:32:05 [ERROR] PROCESSING: No processor for endpoint COMMAND
2023-12-21 21:32:05 [ERROR] PROCESSING: No processor for endpoint MARGINS

Devices are listed, but as Offline and all columns are empty

@jziolkowski
Copy link
Owner

Ah I forgot about fixing the missing trailing /

The processing errors are expected for now. Also SetOption4 is not supported yet :P (temporarily)

@jziolkowski
Copy link
Owner

pushed fix for missing trailing /

@barbudor
Copy link
Contributor

Hello @jziolkowski
Any progress on this one ?

@jziolkowski
Copy link
Owner

yes-ish :D I got frustrated with it so I spent some time refactoring and repackaging the project to have complete up-to date automatic release automation. I will rebase the discovery branch on top of that new layout and back to work.

However I've decided to postpone native tasmota discovery, as the feature creep is huge as is. So I'll make the wildcards work, and will tackle native disco later. Stay tuned ;)

@jziolkowski
Copy link
Owner

@sammyke007 @barbudor I've just pushed a few big commits. Please test.

I've removed native discovery (separate task)

Reworked 90% of message processing (some places might be still missing, it's WIP) but most should work.

Refactored a lot. Cool stuff.

@jziolkowski
Copy link
Owner

@sammyke007 any updates? I'd appreciate some response

@sammyke007
Copy link
Author

I'll test tomorrow. I've been very busy with a big project, sorry...

@sammyke007
Copy link
Author

Ok... tomorrow was 3 weeks ago, but it's still incredibly busy at work.
I've tried running the latest commit, but things have changed.
python tdmgr.py is not working anymore, is it .\tdmgr\run.py now?

@jziolkowski
Copy link
Owner

Yes. Or you can do

pip install .

and then do

tdmgr

Should work

@sammyke007
Copy link
Author

sammyke007 commented Feb 8, 2024

That's easier, tnx.
Still the autodiscovery branch?

Default config, only broker set up:

2024-02-08 21:46:39 [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
2024-02-08 21:46:40 [INFO] MQTT: Subscribed to tasmota/discovery/+/config, tele/#, stat/#, +/tele/#, +/stat/#
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/zolder_3dprinter/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/badkamer_main/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/badkamer_spiegel/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/badkamer_ventilatie/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/berging_main/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/overloop_zolder_main/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/dressing_main/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/living_eetkamer_vast/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/garage_main/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/slk_fran_main/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/garage_bovenste_stekkerblok/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/keuken_aanrecht/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/garage_poort/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/berging_server/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/slk_ouders_main/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/slk_vic_main/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/tuin_achterdeur/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/tuin_schuifraam/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/tuin_tuinhuis_extern/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/wc_main/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/tuin_zijgevel/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/zolder_main/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/keuken_microgolf/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/keuken_oven/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/keuken_koelkast/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/keuken_vaatwasser/LWT
2024-02-08 21:46:40 [INFO] DISCOVERY(LEGACY): LWT from an unknown device tele/tasmota/garage_wasmachine/LWT

@jziolkowski
Copy link
Owner

Ok, then in your autodiscovery patterns dialog you need to add %prefix%/tasmota/%topic%/ or %prefix%/+/%topic%/ and it should pick the devices. Or whatever else pattern you also use that needed the wildcard in the first place.

@sammyke007
Copy link
Author

I've added %prefix%/tasmota/%topic%/ indeed.
It started discovering devices but crashed with:

2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=garage_bovenste_stekkerblok with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=tuin_achterdeur with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=badkamer_spiegel with fulltopic=%prefix%/tasmota/%topic%/2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=tuin_zijgevel with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=garage_poort with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=garage_wasmachine with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=keuken_microgolf with fulltopic=%prefix%/tasmota/%topic%/2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=berging_main with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=slk_ouders_main with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=dressing_main with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=keuken_koelkast with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=zolder_3dprinter with fulltopic=%prefix%/tasmota/%topic%/2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=tuin_tuinhuis_extern with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=slk_fran_main with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=zolder_main with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=badkamer_main with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=overloop_zolder_main with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=berging_server with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=garage_main with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=tuin_schuifraam with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=keuken_vaatwasser with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=badkamer_ventilatie with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=keuken_aanrecht with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=wc_main with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=keuken_oven with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:27 [INFO] DISCOVERY(LEGACY): Discovered topic=living_eetkamer_vast with fulltopic=%prefix%/tasmota/%topic%/
2024-02-08 22:00:28 [INFO] DISCOVERY(LEGACY): Discovered topic=slk_vic_main with fulltopic=%prefix%/tasmota/%topic%/
Traceback (most recent call last):
  File "C:\Users\verdo\AppData\Local\Programs\Python\Python312\Lib\site-packages\tdmgr\GUI\dialogs\main.py", line 391, in mqtt_message
    device.process_message(msg)
  File "C:\Users\verdo\AppData\Local\Programs\Python\Python312\Lib\site-packages\tdmgr\util\__init__.py", line 306, in process_message
    self.process_sensor(msg.payload)
  File "C:\Users\verdo\AppData\Local\Programs\Python\Python312\Lib\site-packages\tdmgr\util\__init__.py", line 289, in process_sensor
    sensor_data = json.loads(payload)
                  ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\verdo\AppData\Local\Programs\Python\Python312\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\verdo\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\verdo\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
               ^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Expecting ':' delimiter: line 1 column 100 (char 99)

@sammyke007
Copy link
Author

sammyke007 commented Feb 8, 2024

Second run it crashed on:
json.decoder.JSONDecodeError: Invalid control character at: line 1 column 44 (char 43)

Third run is running without error.

@jziolkowski
Copy link
Owner

Weird, it should not crash like that. Does the logfile show what was the error payload?

@jziolkowski
Copy link
Owner

Also, does all your devices have this tasmota part, or do you have multiple different types? Because if not, then you didn't need wildcards in the first place :D

@sammyke007
Copy link
Author

I was planning to use %prefix%/tasmota/"room" (wildcard)/%topic%/ so it would look like %prefix%/tasmota/+/%topic%/, but because that would raise problems with TDM, I've included the room names in the topics...

@jziolkowski
Copy link
Owner

any more crashes?

@sammyke007
Copy link
Author

Seems to be stable over here!

@jziolkowski
Copy link
Owner

Thanks. I'll do some final touches then, merge and release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants