-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[rtl_433_mqtt_hass.py] Topic prefix with slashes #2697
Comments
Just by guessing I changed the topicprefix line to this;
And it looks much better. What did I break? |
That seems the correct fix. The script expects the default prefix of |
All of the Fineoffset-WH sensors (Telldus) now work. I have a Prologue-TH (Biltema) that doesn't. The topic for the Prologue becomes
The real topic should be
But where does that /9/3 come from? Probably from my missing knowledge of split() :) |
I'm having the same issue with a Norgo energymeter.
This one is apparently named Norgo-NGE101-1-167, but the topic used to publish is /clan/house/rtl_433/events/Norgo-NGE101/167 note missing /1/ |
As I read it the change above is not a general fix; it is just adapting to the prefixes in use by @haraldhh. I think we need to either document rules for prefix, to make the script figure out the prefix, or to have a way to configure it. So really this issue is awaiting a high-quality PR. |
I publish my mqtt data using a prefix in the form of /clan/house, so rtl_433 devices go into /clan/house/rtl_433/devices[/id] and events into /clan/house/rtl_433/events[/model][/id]. I'm running rtl_433_mqtt_hass.py to try to autoconfigure devices into HA, but I'm having problems with the configuration messages having missing paths in the topic.
In the configuration message I get the following topic;
/clan/devices/Fineoffset-WH2/135
I would like it to be like;
/clan/house/rtl_433/devices/Fineoffset-WH2/135
Looking at the code, I see this on line 487;
topicprefix = "/".join(msg.topic.split("/", 2)[:2])
I'm not that used to coding, especially Python but to my Perl-eyes this looks like it's omitting stuff from the topic-string. Am I right, and could I fix this somehow so I could get my measurements to show up in HA?
Thanks
The text was updated successfully, but these errors were encountered: