-
Notifications
You must be signed in to change notification settings - Fork 84
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
Comments
That kinda makes sense. Let me test something |
Ok so tests are very promising! It was easier that I assumed. Will you be able to test a TDM version from a branch? |
here is the branch: https://github.com/jziolkowski/tdm/tree/autodiscovery 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 |
Why not using the standard |
I did consider that, yes. For now it's a proof of concept |
I've updated the branch. Now it's expected to use |
I'll test tomorrow! What a fast fix, tnx! |
Hi @jziolkowski So I did some test with one of my MQTT broker where I'm using I have 4 devices : With the latest version and using pattern to Logs:
I believe the With the version just before the last commit (when hte wildcard was Let me know if you want more tests |
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. |
Oh wait, indeed there is a replacement.
Need to have a look again. |
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. |
As usual, regex save the world until they break it 🤣 |
This noob is meanwhile looking how to compile an exe from source. It's easier to use python I guess? |
Yes, get the python code and run it in a virtualenv |
Pushed a fix. As the old adage goes "You have a problem. You try fixing it with regex. Now you have two problems." |
Hi @jziolkowski Just pulled your latest commit
|
Argh I omitted - in regex 🤦♂️ |
Pushed |
another push; I reverted the regex to simply ignore chars that are not valid in topics as per mqtt spec |
Detection o fthe 4 devices is now ok but still nothing more than "fetching module name" |
I have upgraded the 4 units with a firmware including TASMOTA_DISCOVERY Only 2 devices detected (strangely the ESP32 based ones), module name fetched but only that. Ohter columns remains empty Logs: Note the
|
Restarting the devices to get the LWT back, still having the
|
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. |
From your earlier posts I see that you have SetOption4 enabled (the response is coming from the |
I don't see any differences in the discovery messages from ESP32 or ESP8266 except the ESP8266 are the only ones wiht a dash |
The broker is flespi.io |
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. |
Upgrading home to get the discovery behave strangely |
But still empty columns |
as for the patterns missing trailing |
I've added some simple tests for this parser, you can try some topics and see what happens |
In the 1st case, I didn't add the pattern Did you pushed anything ? leaving for today... |
No, I'm back to drawing board. Yes, I will ensure that all patterns have the trailing 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. |
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. |
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. |
On the cloud broker, still some
Same with pattern defined On my home broker (standard FT), without patterns, it starts but there is a lot of errors such as:
Devices are listed, but as Offline and all columns are empty |
Ah I forgot about fixing the missing trailing / The processing errors are expected for now. Also SetOption4 is not supported yet :P (temporarily) |
pushed fix for missing trailing / |
Hello @jziolkowski |
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 ;) |
@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. |
@sammyke007 any updates? I'd appreciate some response |
I'll test tomorrow. I've been very busy with a big project, sorry... |
Ok... tomorrow was 3 weeks ago, but it's still incredibly busy at work. |
Yes. Or you can do pip install . and then do tdmgr Should work |
That's easier, tnx. Default config, only broker set up:
|
Ok, then in your autodiscovery patterns dialog you need to add |
I've added
|
Second run it crashed on: Third run is running without error. |
Weird, it should not crash like that. Does the logfile show what was the error payload? |
Also, does all your devices have this |
I was planning to use |
any more crashes? |
Seems to be stable over here! |
Thanks. I'll do some final touches then, merge and release |
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%/).
The text was updated successfully, but these errors were encountered: