I don't know if this is the simplest, this is what I did.

I bought a sensor like this one:
https://www.amazon.com/Precision-Quality-Detection-Sensors-Digital/dp/B07KNTZZW9
SDS011 with USB interface

I found some python code online and modified it to read the sensor every 5
minutes and send the data out via MQTT. This is running on a old Raspberry
Pi 2 in my backyard.

I have another Raspbery PI running mosquitto as the MQTT broker, though
this easily could be the same machine as is running Weewx.

On the machine running Weewx, I wrote another tiny piece of python that
subscribes to the MQTT messages and when it gets one, it writes the data to
a file.
I modified my Weewx driver to look for that file and put the data in the
PM10 and PM2_5 fields. Then, everything else in Weewx is normal.

You can find the code for the service that stuffs the data from MQTT into a
file here: https://github.com/PeterQuinn925/weewx_skin in the MQTT_sensor.py
The code for that talks to the sensor is in the aq-sensor folder.

Like I said, I don't know if this is the simplest, but it's working for me.
There's probably a more official way to do it with MQTT, that doesn't
require mucking with the driver. I had already modified the heck out of
mine, so it was the easiest for me.



On Fri, Aug 12, 2022 at 11:41 AM Yves Martin <[email protected]> wrote:

> Hi, I'm using weewx since a couple of years now and I will be happy to add
> some sensors for the air quality. What is the simplest way and device to
> use for this?
>
> YMartin.com/meteo
>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/139ac3f4-8aff-47e2-9f93-10cb76a6b82cn%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/139ac3f4-8aff-47e2-9f93-10cb76a6b82cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Peter Quinn
(415)794-2264

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAA1SM211%2BUv47tNL6Ca1DE%2B%3DUevhsOUUA4-hSwLRVTbjgmxxiA%40mail.gmail.com.

Reply via email to