Trying to use only DHT22/AM2302 Sensor Data for Indoor Reporting

108 views
Skip to first unread message

tho...@gmail.com

unread,
Jul 25, 2021, 6:00:37 PM7/25/21
to weewx-user
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.

    tho...@gmail.com

    unread,
    Jul 26, 2021, 7:20:13 AM7/26/21
    to weewx-user
    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.

    gjr80

    unread,
    Jul 26, 2021, 5:23:03 PM7/26/21
    to weewx-user
    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 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

    Reply all
    Reply to author
    Forward
    0 new messages