bellrichm / WeeWX-MQTTSubscribe

A WeeWX service and driver that receives data from MQTT.
GNU General Public License v3.0
52 stars 13 forks source link

5 Minute Record Ignored rc2 #145

Closed gary-hammer closed 2 years ago

gary-hammer commented 2 years ago

I setup a fresh server as the WiFiLogger2 dev finally created a new build that allegedly uses proper null values, etc. I have weewx 4.6.0b7 and rc2 of your driver installed. To test, I simply pointed the driver at my existing weewx server's mosquitto instance. I subscribed to the /weather/loop topic All is fine until what I think is the archive time when I get errors from the driver.

I am also not seeing outdoor temp, wind, etc. Only have Outside Humidity, Rain Rate, UV Index, Inside Humidity, and Transmitter Battery showing on the Seasons report.

Should I be using weather/loop as json or will I need to configure each subtopic? See the attached file, gerror.txt gerror.txt

bellrichm commented 2 years ago

I would agree that the messages being ignored are probably archive records mixed in with the loop packets. That check was added because someone else had the same issue and it was causing havoc. I believe they stopped publishing the archive records with their loop data.

As for the missing data, set debug=1 and restart WeeWX. Let it run for at least one archive period. The log will be huge, but it will show what MQTTSubscribe is receiving and how it is processing it.

rich

bellrichm commented 2 years ago

Ah, looks like you need to rename the incoming fields. For example, inside temperature is coming in as inTemp_F and WeeWX expects inTemp. Looks like anything with units has it appended.

LOOP: 2022-01-17 11:46:31 EST (1642437991) 'altimeter': 'None', 'appTemp': 'None', 'appTemp_F': '33.858463474945', 'barometer': 'None', 'barometer_inHg': '29.056', 'cloudbase': 'None', 'cloudbase_foot': '910.4963683247005', 'consBatteryVoltage_volt': '4.68', 'dateTime': '1642437991.0', 'dayET': '0.002', 'dayRain_in': '0.59', 'dewpoint': 'None', 'ET': 'None', 'extraAlarm1': '0.0', 'extraAlarm2': '0.0', 'extraAlarm3': '0.0', 'extraAlarm4': '0.0', 'extraAlarm5': '0.0', 'extraAlarm6': '0.0', 'extraAlarm7': '0.0', 'extraAlarm8': '0.0', 'forecastIcon': '7.0', 'forecastRule': '172.0', 'heatindex': 'None', 'hourRain_in': '0.11999999999999998', 'humidex': 'None', 'humidex_F': '39.4', 'inDewpoint': 'None', 'inDewpoint_F': '39.5272024650873', 'inHumidity': '31.0', 'insideAlarm': '0.0', 'inTemp_F': '71.8', 'leafWet4': '0.0', 'maxSolarRad': '397.4926116165748', 'maxSolarRad_Wpm2': '397.5643120937566', 'monthET': '0.28', 'monthRain_in': '1.06', 'outHumidity': '92.0', 'outsideAlarm1': '0.0', 'outsideAlarm2': '0.0', 'outTemp_F': '39.4', 'pressure': 'None', 'radiation_Wpm2': '139.0', 'rain24_in': '0.5800000000000003', 'rain_in': '0.0', 'rainAlarm': '0.0', 'rainRate': '0.0', 'rainRate_inch_per_hour': '0.09', 'soilLeafAlarm1': '0.0', 'soilLeafAlarm2': '0.0', 'soilLeafAlarm3': '0.0', 'soilLeafAlarm4': '0.0', 'stormRain_in': '0.59', 'stormStart': '1642395600.0', 'sunrise': '1642421700.0', 'sunset': '1642455900.0', 'txBatteryStatus': '0.0', 'usUnits': '1.0', 'UV': '0.8', 'windchill': 'None', 'windDir': 'None', 'windGust_mph': '12.0', 'windGustDir': 'None', 'windrun': 'None', 'windSpeed10_mph': '3.0', 'windSpeed_mph': '5.0', 'yearET': '0.28', 'yearRain_in': '1.06'

gary-hammer commented 2 years ago

Thanks for the quick reply. So, the wifilogger2 MQTT export did not send anything to my mosquitto server. To get things ready if it does send, I'm attempting to configure using my production server mosquitto server. That is where my production weewx writes data for my website's use. I tried using a keyword setup with no luck. If the received data has this: "outTemp_F": "33.9", "rain_in": "0.0" what would pick outTemp_F

This is what I tried: (the formatting on github is not correct, my file is)

 unit_system = US
        [[[weather/loop]]]
        ignore = true
        [[[[outTemp_F]]]]
                     ignore = false    # opt back in for this field
                     name = outTemp

It was not successful:

weewx[22593] ERROR user.MQTTSubscribe: (Driver) MessageCallbackProvider on_message_keyword failed to find data in: topic=weather/loop and payload=b'{"dateTime": "1642471898.0", "usUnits": "1.0", "outTemp_F": "33.9", "rain_in": "0.0", "rainRate_inch_per_hour": "0.0", "barometer_inHg": "29.224", "radiation_Wpm2": "0.0", "inTemp_F": "72.3", "inHumidity": "30.0", "outHumidity": "81.0", "windSpeed_mph": "3.0", "windGust_mph": "11.0", "windGustDir": "302.0", "windDir": "333.0", "UV": "0.0", "appTemp_F": "28.180609711484486", "cloudbase_foot": "1609.5592578248302", "humidex_F": "33.9", "inDewpoint_F": "39.119299770921", "maxSolarRad_Wpm2": "0.0", "hourRain_in": "0.0", "rain24_in": "0.72", "dayRain_in": "0.72", "windSpeed10_mph": "5.4", "stormRain_in": "0.72", "dayET": "0.014", "trendIcon": "60.0", "windSpeed2": "5.8", "windGust10": "12.0", "windGustDir10": "292.0", "dewpoint_F": "29.0", "heatindex_F": "34.0", "windchill_F": "29.0", "THSW_F": "27.0", "rain15": "0.0", "bar_reduction": "0.002", "bar_calibration": "0.002", "pressure_raw": "28.756", "pressure_inHg": "28.756", "altimeter_inHg": "29.206", "stormStart": "1642395600.0"}'

bellrichm commented 2 years ago

You definitely want 'type=json'. Keep the rest of the config snippet you have posted. rich

gary-hammer commented 2 years ago

Thanks for the pointer. I forgot flatten_delimiter = "," With that, works a treat using the MQTT feed from my main weewx machine. WiFiLogger2 feed? Well, it seems that there is no output from the device so far. Maybe next year...