How to change unit group for a field

38 views
Skip to first unread message

peterq...@gmail.com

unread,
May 15, 2021, 2:00:29 PM5/15/21
to weewx-user
Hi,

I've built my own air quality meter and I'm hooking it up to Weewx. I'm abusing the leafTemp1 and leafTemp2 fields to store PM2.5 and PM10 values. I've customized the Acurite driver to put these into the database. I have several other non-standard sensors that I added years ago to this driver and I'm planning on forking the driver as soon as I've done this particular customization. That's not the problem.

The problem I'm having is that there's a conversion going on between degC and degF for my data that's not a temperature. I can't find where the fields declare what unit group they are part of. I can't find it in the documentation or through a quick look in the codebase.

I suppose what I should do is use the new tools to add 2 new fields and remove the 2 leafTemp fields that I don't think I'd ever use, but I think it would be easiest to just re-use the leafTemp fields if I change the unit group.

Worst come to worst, I have a super klugy solution of doing a degF to degC conversion in the driver before I save the data, but that's too much a hack even for me.

peterq...@gmail.com

unread,
May 15, 2021, 2:08:55 PM5/15/21
to weewx-user
Hmm. I took another look at the code and I see there's a dictionary in units.py. I don't really want to modify the core code if I can avoid it. Is there a way to override the obs_group_dict? 

I also see that there are already PM2.5 and PM10 variables defined in group_concentration. I'll take another look at using these rather than rolling my own.

peterq...@gmail.com

unread,
May 15, 2021, 2:48:33 PM5/15/21
to weewx-user
I'm being an idiot. It's no sweat to add a new field to database and mucking around changing the units on existing field is pointless. I've added new fields.

No need for a response.

Reply all
Reply to author
Forward
0 new messages