The preferred approach for handling such issues is to do the conversion in 
the code (presumably a WeeWX service) that adds the obs concerned to the 
loop packet or archive record. More specifically, if you have an obs whose 
units are/maybe different to other obs of the same type/group then you 
should check the usUnits field in the packet/record concerned and convert 
the obs value as necessary before adding the converted value to the 
packet/record. This way you maintain unit integrity of the packet/archive. 
Otherwise you risk some other service processing the mixed unit 
packet/record before your unit conversion occurs and resulting in incorrect 
output or worse still you may pollute your database.

I had a quick look and found this code 
<https://gitlab.com/wjcarpenter/bme280wx/-/blob/master/bin/user/bme280wx.py> 
that implements a WeeWX service to add BME280 data to WeeWX loop packets. 
Not saying this is a good or bad example, but if you have a look at the 
new_loop_packet() method you will see how the usUnits field can be used to 
check what unit system is being used in the packet and conversions can be 
done accordingly.

Gary

On Monday, 26 July 2021 at 21:20:13 UTC+10 [email protected] wrote:

> Update: The sensor was reporting with the simulator.  My report was set to 
> US units and the sensor reports C so I used the Calibrate section of 
> Weewx.conf to convert the temp to F.  it appears to be working now.
>
> Not sure if that was the best option.
>
> On Sunday, July 25, 2021 at 6:00:37 PM UTC-4 [email protected] wrote:
>
>> Greetings,
>>
>> I'm trying to make a small indoor temperature/humidity station that will 
>> generate a report online.
>>
>>    - I have an RPi 3 with a DHT22/AM2302 using GPIO22.
>>    - Weewx is running with the Simulator station_type.
>>    - Reports are being generated with NGINX serving them.
>>    - 
>>    - sudo tail -f /var/log/syslog generates the following:
>>
>> Jul 25 17:28:39  /weewxd: extrasensors: found humidity value of 
>> 41.400001525878906 %
>>
>>    
>> Jul 25 17:28:39  /weewxd: extrasensors: found temperature value of 
>> 24.299999237060547 C
>>
>>    - 
>>    - I used eyesnz/weewx_pi_sensors
>>
>> So, Weewx is getting the data, but I'm not sure how to get it into the 
>> reporting.  I don't have a physical weather sensor and all I want is the 
>> indoor temp/humidity.  I'm guessing I need to use some other device/driver 
>> set up than the simulator.  I've seen posts with people using 
>> additional/replacement sensors (like the DHT22) but not only using the 
>> DHT22.
>>
>> I'm hoping this is a quick-stupid answer.
>>
>> Thanks again!
>> Thom K.
>>
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/weewx-user/f36b532c-40d9-4ee6-a2d4-94c99263a2f9n%40googlegroups.com.

Reply via email to