-
Notifications
You must be signed in to change notification settings - Fork 96
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
rtl4332mqtt support for multiple devices? #9
Comments
Hi Ian. However, it looks like one of the repos I based the add-on on does use multiple sensors (albeit very similar binary door/window sensors). Chris mentions that his solution is working with HA. { Good luck with any changes you make. |
Thank you for the pointers, James. I'll give it a try and keep you posted and also reach out to HA community if I get stuck. Not a big investment for one more of those sensors anyhow. If I find something useful, I'll definitely submit a PR. |
I've been looking into this and have a working (albeit non-elegant) solution by editing the shell script. There are a few challenges when dealing with multiple sensors. The HA options assumes just one sensor, so would need to be updated to support multiples sensor protocols being passed. However different protocols have different json payloads and therefore you want to publish each sensor to a different mqtt topic, so really an array of protocols and mqtt topics need to be set. It gets a bit more difficult however as the json output of rtl_433 weirdly does not include the protocol number. Therefore you have to parse the model string in the json to determine which device the payload refers to and therefore which mqtt topic to publish to. The end result of this is that I have a working solution with some hardcoded values but which is not general purpose. The key changes are as follows:
Then in HA you simply have a number of mqtt sensors as appropriate triggered from the relevant topics. |
Thanks for the detailed response. Hope this helps @ianfiske |
Yes please feel free to use |
I have several devices of the same model so I tried a more general approach. If there is a model or id in the message, it will be appended to the message's path, replacing spaces with underscores. So
will send the message to Setting
in I know very little bash, so you might want to have a good look at the changes first, but it works for me: #11 |
Here is an alternative if you have for example PIR sensors that sends like 50 messages in a row when there is motion. This do loop will make the mqtt pub lag as it needs to loop each line.
|
First, thank you for the awesome rtl4332mqtt addon! I'm using it with an Ambient Weather F007TH Thermo-Hygrometer outdoors and it works great on our farm. I'm thinking of adding more sensors, but wanted to check if you know how easy it will be to adapt the rtl4332mqtt.sh script to handle multiple sensors before I go and makes the purchase. I suppose the mqtt sensor would need to somehow parse the single event steam into multiple sensors... or, rtl4332mqtt.sh could be modified to push events to multiple mqtt topics. I'm curious about your thoughts on this.
The text was updated successfully, but these errors were encountered: