Closed mattmon closed 3 years ago
I have not used MQTT and have not looked at it. My guess is that MQTT is adding the units or group to the name. If that’s not it, I have no other ideas.
I publish with my own system (https://github.com/chaunceygardiner/weewx-loopdata) and the plugin simply wouldn’t work if these names were wrong.
If you figure out that the purple plugin is not performing to spec, please let me know.
John
On Dec 26, 2020, at 1:04 PM, mattmon notifications@github.com wrote:
I am using weewx-mqtt in combination with weewx-purple and have discovered an issue where XTYPE data being published via mqtt has a malformed observation type. A portion of the string seems to get appended twice.
Both pm2_5_aqi_color and pm2_5_aqi get PUB'd as pm2_5_aqi_color_aqi_color and pm2_5_aqi_aqi, respectively.
Here's an example of wonky JSON in the MQTT payload:
{"windDir": "16.0", "windSpeed_mph": "4.0", "rain_total": "4.59", "dateTime": "1609015510.0", "usUnits": "1.0", "pressure_inHg": "25.849665157875002", "pm1_0_microgram_per_meter_cubed": "0.0", "pm2_5_microgram_per_meter_cubed": "3.1105549999999997", "pm10_0_microgram_per_meter_cubed": "0.15", "pm2_5_aqi_aqi": "12.916666666666668", "pm2_5_aqi_color_aqi_color": "32768.0", "altimeter_inHg": "30.041006323276555", "rainRate_inch_per_hour": "0.0", "hourRain_in": "0.0", "rain24_in": "0.0", "dayRain_in": "0.0"}
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Looking at this further, the MQTT payload does appear to add the units. For example, rainRate_inch_per_hour.
For pm2_5_aqi, the unit is aqi. For pm2_5_aqi_color, the unit is aqi_color.
This explains the names you are seeing.
The following code from the extension explains why. Note the units of aqi and aqi_color.
weewx.units.USUnits['air_quality_index'] = 'aqi' weewx.units.MetricUnits['air_quality_index'] = 'aqi' weewx.units.MetricWXUnits['air_quality_index'] = 'aqi'
weewx.units.USUnits['air_quality_color'] = 'aqi_color' weewx.units.MetricUnits['air_quality_color'] = 'aqi_color' weewx.units.MetricWXUnits['air_quality_color'] = 'aqi_color'
weewx.units.default_unit_label_dict['pm2_5_aqi'] = ' AQI' weewx.units.default_unit_label_dict['pm2_5_aqi_color'] = ' RGB'
weewx.units.default_unit_format_dict['aqi'] = '%d' weewx.units.default_unit_format_dict['aqi_color'] = '%d'
weewx.units.obs_group_dict['pm2_5_aqi'] = 'air_quality_index' weewx.units.obs_group_dict['pm2_5_aqi_color'] = 'air_quality_color'
Thanks for looking into this, appreciate the additional info.
I am using weewx-mqtt in combination with weewx-purple and have discovered an issue where XTYPE data being published via mqtt has a malformed observation type. A portion of the string seems to get appended twice.
Both
pm2_5_aqi_color
andpm2_5_aqi
get PUB'd aspm2_5_aqi_color_aqi_color
andpm2_5_aqi_aqi
, respectively.Here's an example of wonky JSON in the MQTT payload:
{"windDir": "16.0", "windSpeed_mph": "4.0", "rain_total": "4.59", "dateTime": "1609015510.0", "usUnits": "1.0", "pressure_inHg": "25.849665157875002", "pm1_0_microgram_per_meter_cubed": "0.0", "pm2_5_microgram_per_meter_cubed": "3.1105549999999997", "pm10_0_microgram_per_meter_cubed": "0.15", "pm2_5_aqi_aqi": "12.916666666666668", "pm2_5_aqi_color_aqi_color": "32768.0", "altimeter_inHg": "30.041006323276555", "rainRate_inch_per_hour": "0.0", "hourRain_in": "0.0", "rain24_in": "0.0", "dayRain_in": "0.0"}