Weewx Engine Packet Conversion Mapping Issue

45 views
Skip to first unread message

Patrick Mendiuk

unread,
Apr 11, 2020, 3:20:37 PM4/11/20
to weewx-user
HI,
I have noticed some weird MQTT data from my Davis wind speed sensor.  The wind_speed value from the Davis packet data is not being published via MQTT.  I started adding some debug logging and in engine.py I noticed that wind_speed_raw is being mapped into windSpeed.  Here is the log output:

Apr 11 11:31:08 raspberrypi weewx[11331]: rtldavis: data: 11:31:08.118616 4005E6FFC1000032 64053 0 0 0 2 msg.ID=0
Apr 11 11:31:08 raspberrypi weewx[11331]: rtldavis: data_pkt: {'wind_speed': 2.2351944444444443, 'curr_cnt0': 64053, 'curr_cnt3': 0, 'curr_cnt2': 0, 'curr_cnt1': 0, 'wind_speed_raw': 5, 'channel': 1, 'bat_iss': 0, 'wind_speed_ec': 5.0, 'wind_dir': 318.55731225296444}
Apr 11 11:31:08 raspberrypi weewx[11331]: engine: event.packet: {'txBatteryStatus': 0, 'outTempBatteryStatus': 5, 'dateTime': 1586629868, 'windDir': 318.55731225296444, 'windSpeed': 2.2351944444444443, 'usUnits': 17}
Apr 11 11:31:08 raspberrypi weewx[11331]: engine: converted_packet: {'windDir': 318.55731225296444, 'windSpeed': 5.0, 'outTempBatteryStatus': 5, 'txBatteryStatus': 0, 'dateTime': 1586629868}
Apr 11 11:31:08 raspberrypi weewx[11331]: engine: converted_packet_unit: {'txBatteryStatus': 0, 'outTempBatteryStatus': 5, 'dateTime': 1586629868, 'windDir': 318.55731225296444, 'windSpeed': 5.0, 'usUnits': 1}
Apr 11 11:31:08 raspberrypi weewx[11331]: restx: MQTT: call record: {'txBatteryStatus': 0, 'outTempBatteryStatus': 5, 'maxSolarRad': None, 'dateTime': 1586629868, 'windDir': 318.55731225296444, 'windSpeed': 5.0, 'rainRate': 0, 'usUnits': 1}
Apr 11 11:31:08 raspberrypi weewx[11331]: restx: _datadict: {'txBatteryStatus': 0, 'outTempBatteryStatus': 5, 'maxSolarRad': None, 'dateTime': 1586629868, 'windDir': 318.55731225296444, 'windSpeed': 5.0, 'rainRate': 0, 'usUnits': 1}
Apr 11 11:31:08 raspberrypi weewx[11331]: restx: MQTT: get record: {'txBatteryStatus': 0, 'hourRain': 0.0, 'outTempBatteryStatus': 5, 'maxSolarRad': None, 'dateTime': 1586629868, 'windDir': 318.55731225296444, 'windSpeed': 5.0, 'rain24': 0.0, 'dayRain': 0.0, 'rainRate': 0, 'usUnits': 1}

The expected value is being written to the database and used in the html files.

Thanks,
Patrick


Rich Bell

unread,
Apr 11, 2020, 3:52:45 PM4/11/20
to weewx-user

Patrick,
I think this is due to unit conversions. The packet data is units METRICWX (usUnits: 17), which is m/s. The data in the MQTT payload is US (usUnits: 1), which is mph. 
Converting 2.2352 m/s * 2.237 = 5 mph.
rich

Patrick Mendiuk

unread,
Apr 11, 2020, 5:00:26 PM4/11/20
to weewx-user
Thanks Rich,
So I guess the rtldavis packet has mixed units and the wind speed in m/s is rounded to integer mph values.  The windSpeed data written to the database isn't rounded.  Do you have any idea which dictionary is being used?

Thanks,
Patrick

gjr80

unread,
Apr 11, 2020, 5:24:02 PM4/11/20
to weewx-user
Davis stations emit wind speed as integer mph values. So it’s not really a case of m/s being converted and rounded to the nearest mph value, rather it is the other way around. rtldavis is taking any integer mph value and converting it (precisely) to m/s and then later on when converting to mph the original integer mph value is returned.

Gary

Patrick Mendiuk

unread,
Apr 11, 2020, 6:40:45 PM4/11/20
to weewx-user
Thanks Gary,
The ultrasonic sensor resolution has tainted me.  I should have looked at the Davis specifications first :) 

Sounds like a good excuse to build a replacement for the ISS board.

Thanks,
Patrick
Reply all
Reply to author
Forward
0 new messages