OK, just so I'm understanding this. This starts at the bottom of the __init__. col_press and col_temp are strings read from my [BMP280] section of weewx.conf that contain where the data should go, like "barometer" and "extraTemp1". And I divide the corrected pressure by 100 because it's in Pascals, which are 100 mbar/hPa.
self.bind(weewx.NEW_LOOP_PACKET, self.new_loop_packet) def new_loop_packet(self, event) sensor_init() raw_pres, raw_temp = read_raw_data() pres_Pa, temp_C = calibrate_raw_data(raw_pres, raw_temp) pres_tuple = weewx.units.convertStd((pres_Pa/100, "mbar", "group_pressure"), packet['usUnits']) temp_tuple = weewx.units.convertStd((temp_C, "degree_C", "group_temperature"), packet['usUnits']) event.record[col_pres] = pres_tuple.value event.record[col_temp] = temp_tuple.value On Friday, April 7, 2017 at 9:11:02 AM UTC-4, Tom Keffer wrote: > > I am new to Python and objects, really, since it's been over twenty years >> since I wrote anything. What it looks like to me, for the service, is that >> weewx is going to create an instance of the class I define in the service >> file and call the function that's bound to my chosen event, right? >> >> > That's correct. > > > >> And if I go with NEW_LOOP_PACKET rather than NEW_ARCHIVE_RECORD, do I >> still need to make sure it gets included in the archive record, or will >> that happen automatically? Or do I bind to both? >> > > Just add your new observations to the LOOP packet. > > LOOP packets are compiled by the "accumulators". They keep track of mins, > maxes, sums, and counts. These are then used to turn the stream of LOOP > packets into archive records. > > What actually happens depends on whether the user is using software or > hardware record generation. If software, at the end of an archive interval, > all the observation types are extracted out of the accumulators and turned > into an archive record. If hardware, the actual archive record comes from > the console, however, starting with v3.7.0, this record gets augmented by > any additional types that can be extracted out of the accumulators. So, > your new types will get included that way. > > Either way, if it's in the LOOP packet, you're good. > > -tk > >