gjr80 / weewx-realtime_gauge-data

Near realtime support for updating of SteelSeries Weather Gauges by WeeWX
GNU General Public License v3.0
9 stars 5 forks source link

problem with extra unit conversion #22

Closed PeterQuinn925 closed 3 years ago

PeterQuinn925 commented 3 years ago

Hi,

I'm trying to use the rtgd extension and I'm getting what appears to be double conversion. I am using the Acurite driver that I've customized to use an external temp sensor. The temp data works fine with weewx except it the degF value gets converted as if it's degC to degF in the gauges when I enable rtgd. Where do I set the conversion? I've changed line 374 to be Degree_F and it didn't make a difference. I also tried changing most places the code calls for Degree_C to Degree_F and it also didn't fix it.

gjr80 commented 3 years ago

Hi,

Provided the data in incoming packets/records is consistent with the usUnits field in each packet/record then unit conversion should work as expected. The units used in gauge-data.txt for each unit group is set in the [[Groups]] stanza under [RealtimeGaugeData] in weewx.conf, eg temperature is set to F as follows:

[RealtimeGaugeData]
    ....
    [[Groups]]
        ....
        group_temperature = degree_F

What exactly is the problem, is the double conversion applying to your extra temperature field only or to all temperature fields? Does it apply to other unit groups as well, eg pressure, speed?

To give us some idea of what data is going in to RTGD and what is coming out can you edit weewx.conf and set debug = 3. Save weewx.conf and restart WeeWX. Let WeeWX run for a few loop packets (note we only need a few loop packets, no archive records - the log is going to be very chatty). Paste a copy of the log from startup through until a couple of loop packets have been processed. The log will include the loop packets that are being received, not sure if we get the output in the log as well, so just in case can you post a copy of the generated gauge-data.txt as well please.

PeterQuinn925 commented 3 years ago

I re-downloaded the code and enabled it in weewx.conf. It's working great now. I think what happened is that I broke it when I was trying to fix a previous problem where I was always getting 32 on the gauge. I fixed my custom acurite driver and also changed degree_C to degree_F in the rtgd.py code. I should have updated my driver and tested it before changing anything else. I thought I did that, but apparently not. Thanks for your help.

PeterQuinn925 commented 3 years ago

Well. I spoke too soon. It's now showing 0 in the gauge again. I'll turn debug to 3 and see if there are any clues there

PeterQuinn925 commented 3 years ago

user.rtgd: created cached loop packet: contains the correct outtemp user.rtgd: received loop packet: does not contain an outtemp at all. I has the extratemp1 which has the acurite sensor data. user.rtgd: queued loop packet: does not contain any temp data.

In my custom acurite driver, I use extraTemp1 for the acurite thermometer and outTemp for my sensor.

Do I have to do something different to get the "received loop packet" to get the temp? Can I change it so it just uses the last value?

raw log snippet: Dec 26 14:04:17 raspi3 weewx[28141] DEBUG weewx.manager: Daily summary version is 2 Dec 26 14:04:17 raspi3 weewx[28141] DEBUG weewx.drivers.acurite: Found station at bus= device= Dec 26 14:04:17 raspi3 weewx[28141] DEBUG user.rtgd: queued loop packet: {'dateTime': 1609020258, 'channel': 3, 'sensor_id': 718, 'rssi': 3, 'sensor_batt ery': 0, 'windSpeed': 0.0, 'extraTemp1': 63.5, 'outHumidity': 61, 'pressure': 30.07149284921875, 'inTemp': 69.80000000000001, 'outTempBatteryStatus': 0, 'rxCheckPercent': 100.0, 'usUnits': 1, 'altimeter': 30.220545105295255, 'maxSolarRad': 316.1666084142918, 'rainRate': 0.0, 'windDir': None} Dec 26 14:04:17 raspi3 weewx[28141] DEBUG weewx.drivers.acurite: next read in 18 seconds Dec 26 14:04:18 raspi3 weewx[28141] DEBUG user.rtgd: windrose data calculated: [6.4, 11.9, 4.3, 5.9, 12.5, 6.0, 3.6, 28.4, 48.8, 223.1, 553.8, 494.3, 149 .9, 36.4, 15.3, 4.0] Dec 26 14:04:18 raspi3 weewx[28141] DEBUG user.rtgd: received loop packet: {'dateTime': 1609020258, 'channel': 3, 'sensor_id': 718, 'rssi': 3, 'sensor_ba ttery': 0, 'windSpeed': 0.0, 'extraTemp1': 63.5, 'outHumidity': 61, 'pressure': 30.07149284921875, 'inTemp': 69.80000000000001, 'outTempBatteryStatus': 0 , 'rxCheckPercent': 100.0, 'usUnits': 1, 'altimeter': 30.220545105295255, 'maxSolarRad': 316.1666084142918, 'rainRate': 0.0, 'windDir': None} Dec 26 14:04:18 raspi3 weewx[28141] DEBUG user.rtgd: created cached loop packet: {'dateTime': 1609020258, 'usUnits': 1, 'cloudbase': None, 'windDir': 112 .5, 'windrun': None, 'inHumidity': None, 'outHumidity': 61, 'barometer': 30.212090168303735, 'radiation': None, 'rain': 0.0, 'rainRate': 0.0, 'windSpeed' : 0.0, 'appTemp': None, 'dewpoint': 46.285872326024375, 'heatindex': 59.0052522, 'humidex': None, 'inTemp': 69.80000000000001, 'outTemp': 60.462502, 'win dchill': 60.462502, 'UV': None, 'channel': 3, 'sensor_id': 718, 'rssi': 3, 'sensor_battery': 0, 'extraTemp1': 63.5, 'pressure': 30.07149284921875, 'outTe mpBatteryStatus': 0, 'rxCheckPercent': 100.0, 'altimeter': 30.220545105295255, 'maxSolarRad': 316.1666084142918} Dec 26 14:04:36 raspi3 weewx[28141] DEBUG weewx.drivers.acurite: Found station at bus= device= Dec 26 14:04:36 raspi3 weewx[28141] DEBUG user.rtgd: queued loop packet: {'dateTime': 1609020276, 'channel': 3, 'sensor_id': 718, 'rssi': 3, 'sensor_batt ery': 0, 'windSpeed': 2.678862142244647, 'windDir': 292.5, 'rain_total': 9.8806, 'rain': None, 'outTempBatteryStatus': 0, 'rxCheckPercent': 100.0, 'usUni ts': 1, 'maxSolarRad': 315.5954931189258, 'rainRate': 0.0} Dec 26 14:04:36 raspi3 weewx[28141] DEBUG user.rtgd: received loop packet: {'dateTime': 1609020276, 'channel': 3, 'sensor_id': 718, 'rssi': 3, 'sensor_ba ttery': 0, 'windSpeed': 2.678862142244647, 'windDir': 292.5, 'rain_total': 9.8806, 'rain': None, 'outTempBatteryStatus': 0, 'rxCheckPercent': 100.0, 'usU nits': 1, 'maxSolarRad': 315.5954931189258, 'rainRate': 0.0} Dec 26 14:04:36 raspi3 weewx[28141] DEBUG weewx.drivers.acurite: next read in 18 seconds Dec 26 14:04:36 raspi3 weewx[28141] DEBUG user.rtgd: created cached loop packet: {'dateTime': 1609020276, 'usUnits': 1, 'cloudbase': None, 'windDir': 292 .5, 'windrun': None, 'inHumidity': None, 'outHumidity': 61, 'barometer': 30.212090168303735, 'radiation': None, 'rain': 0.0, 'rainRate': 0.0, 'windSpeed' : 2.678862142244647, 'appTemp': None, 'dewpoint': 46.285872326024375, 'heatindex': 59.0052522, 'humidex': None, 'inTemp': 69.80000000000001, 'outTemp': 6 0.462502, 'windchill': 60.462502, 'UV': None, 'channel': 3, 'sensor_id': 718, 'rssi': 3, 'sensor_battery': 0, 'extraTemp1': 63.5, 'pressure': 30.07149284 921875, 'outTempBatteryStatus': 0, 'rxCheckPercent': 100.0, 'altimeter': 30.220545105295255, 'maxSolarRad': 315.5954931189258, 'rain_total': 9.8806} Dec 26 14:04:54 raspi3 weewx[28141] DEBUG weewx.drivers.acurite: Found station at bus= device= Dec 26 14:04:54 raspi3 weewx[28141] DEBUG user.rtgd: queued loop packet: {'dateTime': 1609020294, 'channel': 3, 'sensor_id': 718, 'rssi': 3, 'sensor_batt ery': 0, 'windSpeed': 3.193234493643357, 'extraTemp1': 63.9, 'outHumidity': 60, 'outTempBatteryStatus': 0, 'rxCheckPercent': 100.0, 'usUnits': 1, 'maxSol arRad': 315.0231279693176, 'rainRate': 0.0, 'windDir': None} Dec 26 14:04:54 raspi3 weewx[28141] DEBUG user.rtgd: received loop packet: {'dateTime': 1609020294, 'channel': 3, 'sensor_id': 718, 'rssi': 3, 'sensor_ba ttery': 0, 'windSpeed': 3.193234493643357, 'extraTemp1': 63.9, 'outHumidity': 60, 'outTempBatteryStatus': 0, 'rxCheckPercent': 100.0, 'usUnits': 1, 'maxS olarRad': 315.0231279693176, 'rainRate': 0.0, 'windDir': None} Dec 26 14:04:54 raspi3 weewx[28141] DEBUG weewx.drivers.acurite: next read in 18 seconds Dec 26 14:04:54 raspi3 weewx[28141] DEBUG user.rtgd: created cached loop packet: {'dateTime': 1609020294, 'usUnits': 1, 'cloudbase': None, 'windDir': 292 .5, 'windrun': None, 'inHumidity': None, 'outHumidity': 60, 'barometer': 30.212090168303735, 'radiation': None, 'rain': 0.0, 'rainRate': 0.0, 'windSpeed' : 3.193234493643357, 'appTemp': None, 'dewpoint': 46.285872326024375, 'heatindex': 59.0052522, 'humidex': None, 'inTemp': 69.80000000000001, 'outTemp': 6 0.462502, 'windchill': 60.462502, 'UV': None, 'channel': 3, 'sensor_id': 718, 'rssi': 3, 'sensor_battery': 0, 'extraTemp1': 63.9, 'pressure': 30.07149284 921875, 'outTempBatteryStatus': 0, 'rxCheckPercent': 100.0, 'altimeter': 30.220545105295255, 'maxSolarRad': 315.0231279693176, 'rain_total': 9.8806} Dec 26 14:05:12 raspi3 weewx[28141] DEBUG weewx.drivers.acurite: Found station at bus= device= Dec 26 14:05:12 raspi3 weewx[28141] DEBUG user.rtgd: queued loop packet: {'dateTime': 1609020312, 'channel': 3, 'sensor_id': 718, 'rssi': 3, 'sensor_batt ery': 0, 'windSpeed': 3.193234493643357, 'extraTemp1': 63.9, 'outHumidity': 60, 'outTempBatteryStatus': 0, 'rxCheckPercent': 100.0, 'usUnits': 1, 'maxSol arRad': 314.44958240482083, 'rainRate': 0.0, 'windDir': None} Dec 26 14:05:12 raspi3 weewx[28141] DEBUG user.rtgd: received loop packet: {'dateTime': 1609020312, 'channel': 3, 'sensor_id': 718, 'rssi': 3, 'sensor_ba ttery': 0, 'windSpeed': 3.193234493643357, 'extraTemp1': 63.9, 'outHumidity': 60, 'outTempBatteryStatus': 0, 'rxCheckPercent': 100.0, 'usUnits': 1, 'maxS olarRad': 314.44958240482083, 'rainRate': 0.0, 'windDir': None} Dec 26 14:05:12 raspi3 weewx[28141] DEBUG weewx.drivers.acurite: next read in 6 seconds Dec 26 14:05:12 raspi3 weewx[28141] DEBUG user.rtgd: created cached loop packet: {'dateTime': 1609020312, 'usUnits': 1, 'cloudbase': None, 'windDir': 292 .5, 'windrun': None, 'inHumidity': None, 'outHumidity': 60, 'barometer': 30.212090168303735, 'radiation': None, 'rain': 0.0, 'rainRate': 0.0, 'windSpeed' : 3.193234493643357, 'appTemp': None, 'dewpoint': 46.285872326024375, 'heatindex': 59.0052522, 'humidex': None, 'inTemp': 69.80000000000001, 'outTemp': 6 0.462502, 'windchill': 60.462502, 'UV': None, 'channel': 3, 'sensor_id': 718, 'rssi': 3, 'sensor_battery': 0, 'extraTemp1': 63.9, 'pressure': 30.07149284 921875, 'outTempBatteryStatus': 0, 'rxCheckPercent': 100.0, 'altimeter': 30.220545105295255, 'maxSolarRad': 314.44958240482083, 'rain_total': 9.8806} Dec 26 14:05:18 raspi3 weewx[28141] DEBUG weewx.drivers.acurite: Found station at bus= device= Dec 26 14:05:18 raspi3 weewx[28141] DEBUG user.rtgd: queued loop packet: {'dateTime': 1609020318, 'pressure': 30.07149284921875, 'inTemp': 69.80000000000 001, 'usUnits': 1, 'altimeter': 30.220545105295255, 'maxSolarRad': 314.2581078514302, 'rainRate': 0.0} Dec 26 14:05:18 raspi3 weewx[28141] DEBUG user.rtgd: received loop packet: {'dateTime': 1609020318, 'pressure': 30.07149284921875, 'inTemp': 69.800000000 00001, 'usUnits': 1, 'altimeter': 30.220545105295255, 'maxSolarRad': 314.2581078514302, 'rainRate': 0.0} Dec 26 14:05:18 raspi3 weewx[28141] DEBUG weewx.drivers.acurite: next read in 12 seconds Dec 26 14:05:18 raspi3 weewx[28141] DEBUG user.rtgd: created cached loop packet: {'dateTime': 1609020318, 'usUnits': 1, 'cloudbase': None, 'windDir': 292 .5, 'windrun': None, 'inHumidity': None, 'outHumidity': 60, 'barometer': 30.212090168303735, 'radiation': None, 'rain': 0.0, 'rainRate': 0.0, 'windSpeed' : 3.193234493643357, 'appTemp': None, 'dewpoint': 46.285872326024375, 'heatindex': 59.0052522, 'humidex': None, 'inTemp': 69.80000000000001, 'outTemp': 6 0.462502, 'windchill': 60.462502, 'UV': None, 'channel': 3, 'sensor_id': 718, 'rssi': 3, 'sensor_battery': 0, 'extraTemp1': 63.9, 'pressure': 30.07149284

PeterQuinn925 commented 3 years ago

I think the problem was in my driver - I converted the temp to degC before pushing it out and it seems to work. I was wrong last time, so I'll let it run a bit before declaring victory, but it looks like it was all on my end.

gjr80 commented 3 years ago

OK, that goes back to my earlier comment about needing data in loop packets that is consistent with the usUnits field in the packet. I gather the issue here is temperatures. What you need to do is look at the loop packet as emitted by the driver. If the usUnits field is 1 then all temperatures need to be in F, if its 16 or 17 they all need to all be in C. If one or more is not then you will have unit problems elsewhere (usually in the archive and display). Some times you will need to do unit conversion in the driver for one or more fields to get consistent units rather than accepting and emitting the raw sensor data.

Ideally checking for unit consistency is best done by looking at the raw packet from the driver, some drivers have debug settings to log the emitted packet, otherwise you can generally get by by running WeeWX directly.

At the end of the day you must keep the data in all fields consistent with the usUnits value.