Hi Guys (and Gals, of course!),

I have a Qingping AirMonitor Lite that can be set up to emit MQTT messages. 
 Great!  It took a while with many trials and errors, but it is now 
functioning, and mosquitto_sub shows a typical message:
qingping/MAC/up 
{"type":"17","id":1756,"need_ack":0,"mac":"MAC","timestamp":1764173842,"sensorData":[{"timestamp":{"value":1764173700},"temperature":{"value":22.56},"humidity":{"value":45.07},"co2":{"value":635},"pm25":{"value":1},"pm10":{"value":3},"battery":{"value":100}}]}

The topic is "qingping/MAC/up" and the message is clearly formatted as 
json.  So, now to get the relevant data points (pm25, pm10, co2 at a 
minimum) into weewx.  It looks to me like Rich Bell's  WeeWX-MQTTSubscribe 
could work, but I'm stymied by the (too?) many layers of the json.  Why the 
Qingping folks didn't just code the message as 
{"type":"17","pm25":1,"co2":635 ...} I don't know.  Anyway, type=17 is what 
I need to parse.  There are other types, but they just contain 
configuration data (such as wifi SSID, etc).  I *think* I need something 
along the lines of:

[MQTTSubscribeService]    
    [[message_callback]]
        # The 'type' of the message content.
        type = json
    [[topics]]
        # The WeeWX unit_system of the incoming data.
        unit_system = METRIC
        # The topic(s) of interest.
        [[[qingping/MAC/up]]]
            # This identifies a field, 'type', whose value is appended to 
every field in the current MQTT message.
            # For additional information see, 
https://github.com/bellrichm/WeeWX-MQTTSubscribe/wiki/Configuring-additional-options#msg_id_field
            msg_id_field = type
          [[[[sensorData_17]]]]

But then I don't know how to continue.  Do I just keep "punching" down and 
do something like
             [[[[[pm25]]]]]
               [[[[[[value]]]]]]]
                  name = pm2_5
or something similar or something completely different?

TIA!!!!
Bob

-- 
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 visit 
https://groups.google.com/d/msgid/weewx-user/d125bb30-32d1-44bc-939a-2041ebf209c9n%40googlegroups.com.

Reply via email to