WeeWX-MQTTSubscribe - Filter unwanted devices

132 views
Skip to first unread message

bryan...@gmail.com

unread,
Nov 16, 2022, 12:48:36 PM11/16/22
to weewx-user
I'm currently running Weewx 4.9.1 and using WeeWX-MQTTSubscribe to capture data from 2 separate RTL SDR's.  One of the RTL-SDR devices is listening on 433.92 and is picking up weather data from a couple nearby weather stations.  One of the weather stations I'm listening to has a bad wind sensor, so I do not want the wind data from that station, the other station has good wind data so I do want that data.  These two stations are from the same manufacturer and fall under the same device decoding protocol ( [40] Acurite 592TXR Temp/Humidity, 5n1 Weather Station, 6045 Lightning, 899 Rain, 3N1, Atlas).

The other RTL-SDR is listening on 915.00 in order to pick up pressure data from another sensor.

When using 
`rtl_433 -F json -M utc -R 40 | mosquitto_pub -t weather/radio -h localhost -l`

I receive all packets from both stations and pass that to the WeeWX-MQTTSubscribe driver where I have set up the various fields and map them to weewx.  For example, the wind data:

 [[topics]]
        unit_system = US
        [[[weather/radio]]]

... snip ...
                [[[[wind_avg_km_h]]]]
                name = windSpeed

                [[[[wind_dir_deg]]]]
                name = windDir

... snip ...

since both stations emit, for example, 'wind_avg_km_h', I don't have a way to filter out one of them (the bad one) so I end up getting some garbage data in the mix with good data.

My question is this: since these two stations are the same 'device decoding protocol' (40) is there a way to differentiate between the json data coming from the one vs the other?  The both have different [[[[id]]]] fields, the one I want has an ID of 3522 and the one I don't want wind data from is ID 2849. 

Essentially I want to keep data from both devices but exclude just the wind data from one of them.

Thanks much for any help you all can provide.

Bryan

vince

unread,
Nov 16, 2022, 12:58:08 PM11/16/22
to weewx-user
Add ignore=true to the ones you want to.....ignore...

        [[[ecowitt/loop]]]
            [[[[outTemp_F]]]]
                name = extraTemp1
                units = degree_F
            [[[[extraTemp5_F]]]] 
                name = extraTemp5
                units = degree_F
            [[[[dateTime]]]]
                ignore = True
            [[[[usUnits]]]]
                ignore = True

Bryan Parke

unread,
Nov 16, 2022, 1:06:05 PM11/16/22
to weewx...@googlegroups.com
Thanks for the reply, however, if I ignore it, it will ignore it entirely, not just for the one with bad data.  Maybe you didn't see that part of my question.  2 stations are reporting weather data with the same field name wind_avg_km_h  which I map to windSpeed.  One of the stations, with ID 2849 has a bad wind sensor so I want to ignore only the wind data from that station, but want to continue to receive and map the wind data from the other station with ID 3522.

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/yzk4qXDa87o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/08d74afd-f68a-4f0a-a808-666498b6b4d2n%40googlegroups.com.

bell...@gmail.com

unread,
Nov 16, 2022, 1:15:36 PM11/16/22
to weewx-user
I use ''rtl_433 -F mqtt://localhost:1883' and it publishes directly to the following topics:
     rtl_433/<hostname>/devices[/type][/model][/subtype][/channel][/id]
     rtl_433/<hostname>/events
     rtl_433/<hostname>/states
I then subscribe to 'rtl_433/<hostname>/devices[/type][/model][/subtype][/channel][/id]' as 'type = individual'.

If you want/need to continue piping to mosquitto_pub, look at https://github.com/bellrichm/WeeWX-MQTTSubscribe/wiki/Configuring-additional-options#msg_id_field. Then you can use the 'ignore' option with the appended 'id'.

rich

vince

unread,
Nov 16, 2022, 1:30:38 PM11/16/22
to weewx-user
On Wednesday, November 16, 2022 at 10:06:05 AM UTC-8 bryan...@gmail.com wrote:
Thanks for the reply, however, if I ignore it, it will ignore it entirely, not just for the one with bad data.  Maybe you didn't see that part of my question.  2 stations are reporting weather data with the same field name wind_avg_km_h  which I map to windSpeed.  One of the stations, with ID 2849 has a bad wind sensor so I want to ignore only the wind data from that station, but want to continue to receive and map the wind data from the other station with ID 3522.

No, I read your question.  

What I did here was publish to a different topic from each station. That made it easy to ignore the one I wanted to.

For me, it was something like "weather/radio/12345678" for device id 12345678, as an example.   Each device publishing to MQTT used its unique device id to publish to a device-specific topic.  Then I'd subscribe to only the ones I wanted.

Bryan Parke

unread,
Nov 16, 2022, 1:33:51 PM11/16/22
to weewx...@googlegroups.com
This is brilliant! Thank you!  I'll give it a shot.

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/yzk4qXDa87o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.

Bryan Parke

unread,
Nov 16, 2022, 3:17:25 PM11/16/22
to weewx...@googlegroups.com
Thanks again.  My mistake was using this:

rtl_433 -F json -M utc -d:00000002 -f 915.00M | mosquitto_pub -t weather/radio -h localhost -l

instead of this:

rtl_433 -F "mqtt://localhost:1883,devices=rtl_433[/id]"

Now I'm seeing each separate device as its own topic whereas before they were all landing in weather/radio and I didn't have (or know) a way to filter.  Now I can just ignore anything with device ID 2849 for the wind data.

Thanks again!
Bryan

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/yzk4qXDa87o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages