And a copy to the group, seeing as I didn't pay attention before. The proposed doc changes have been done. Pull request has been initiated.
On 6 March 2018 at 09:51, Glenn McKechnie wrote: > > > > On 6 March 2018 at 00:15, Thomas Keffer wrote: > >> Let's back up a step: it's not clear to me what the goal here is. I >> assume to write an extension that can be installed using wee_extension? >> > > Correct. The extension (service) is written. It needs some finishing touches, and this is one of them. > If so, users.extensions is not really the best place to put unit >> extensions for the reasons you have discovered. The installer would have to >> parse the file, adding what it needs >> > Agreed. This was the sticking point, how to get those additional units incorporated into weewx, and for use by the new service, without stomping in areas it doesn't need to. That section of the docs <http://weewx.com/docs/customizing.htm#customizing_units> states that adding them to the user/extensions.py file was one method, and I understood that perhaps weewx.conf was the newer alternative. > Instead, it's usually done by whatever driver, service, or search-list >> extension you are writing. If you have none, then just introduce a skeletal >> service to do the job. It would be so skeletal it would not even bind to >> any events. Its sole job is to set up the units. >> > >> For example, >> >> *user.urad.py <http://user.urad.py>:* >> import weewx.engine >> # uRADMon >> weewx.units.obs_group_dict['uvolt'] = 'group_volt' >> weewx.units.obs_group_dict['ucpm'] = 'group_sievert' >> weewx.units.obs_group_dict['uvoc'] = 'group_ppm' >> > [...] > weewx.units.default_unit_label_dict['microgram'] = ' \xc2\xb5g/m\xc2\xb3' >> >> class LoadURad(weewx.engine.StdService): >> pass >> >> >> Now add user.urad.LoadURad to the list of services to be run. It doesn't >> really matter where, but let's add it to the data_services. >> >> [Engine] >> >> [[Services]] >> > [...] > data_services = user.urad.LoadURad >> > > [...] > Now when the WeeWX engine starts up, it will load the service and, with >> it, your unit extensions, making them ready to use. >> > > So simple. That's it - concept has been applied, manual additions deleted, images deleted, weewx restarted - done. The new units are showing up in the fresh images just as they did using extensions.py before, and that's what I was after. This is what I couldn't glean from the documentation. That the 'new observation type' described there could be called from within the service, rather than being added to extensions.py (which is possibly obvious to those with a better understanding of python, or maybe reading skills?) In fact, what you've described above would seem to be step 5 <http://weewx.com/docs/customizing.htm#Creating_a_new_unit_group> . Have I just volunteered for a pull request? OTOH, if I've completely misunderstood your question, then I apologize. >> Please clarify and let's try again. >> > Hopefully I didn't confuse you too much, and that I haven't done it again. :-) > > >> -tk >> >> On Sun, Mar 4, 2018 at 8:30 PM, Glenn McKechnie wrote: >> >>> Hi All, >>> >>> >>> >> > Cheers Glenn rorpi - read only raspberry pi & various weewx addons https://github.com/glennmckechnie >
