Hi All,

http://weewx.com/docs/customizing.htm#customizing_units

I've reread the docs above and I've succesfully added what I need (as
per the attachment) and integrated them into weewx using
user/extension.py
Because they ran to more than a couple of extra lines I added them to
their own file and have sourced that from user/extensions.py using
import user.extensions_urad .   The separate page seemed a tidier way
of packaging them up, whether for an install or uninstall.

The question is, how to reference them once they are transferred via
wee_extension? I have the service written and installable, I can copy
this new file 'extensions_urad.py' file over. But how do I add the
required import statement, other than manually of course. This step
alludes me.

Is this within the scope of wee_extension?
What have I missed, or what's a work around, or an alternative?

The weewx doc linked above suggests that there may be another way,
where these can be included with weewx.conf - but also mentions that
this feature is on the todo list.

For context, it's for generating the following page...
http://203.213.243.61/weewx/uradmon/index.html

using one of these...
https://www.uradmonitor.com/products/?sel=4

Cheers
 Glenn

rorpi - read only raspberry pi & various weewx addons
https://github.com/glennmckechnie
#
#    Copyright (c) 2009-2015 Tom Keffer <[email protected]>
#
#    See the file LICENSE.txt for your full rights.
#

"""User extensions module

This module is imported from the main executable, so anything put here will be
executed before anything else happens. This makes it a good place to put user
extensions.
called from  user/extensions.py with
import user.extension_urad
"""

import locale
import weewx.units
# This will use the locale specified by the environment variable 'LANG'
# Other options are possible. See:
# http://docs.python.org/2/library/locale.html#locale.setlocale
locale.setlocale(locale.LC_ALL, '')

# 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.obs_group_dict['uco2'] = 'group_ppm'
weewx.units.obs_group_dict['uch2o'] = 'group_ppm'
weewx.units.obs_group_dict['upm25'] = 'group_mgram'
weewx.units.obs_group_dict['uptime'] = 'group_elapsed'
weewx.units.obs_group_dict['upres'] = 'group_pressure'
weewx.units.obs_group_dict['utemp'] = 'group_temperature'
weewx.units.obs_group_dict['uhum'] = 'group_percent'

# USUnits would be ????
weewx.units.USUnits['group_sievert'] = 'microsievert'
weewx.units.USUnits['group_ppm'] = 'ppm'
weewx.units.USUnits['group_mgram'] = 'microgram'
weewx.units.MetricUnits['group_sievert'] = 'microsievert'
weewx.units.MetricUnits['group_ppm'] = 'ppm'
weewx.units.MetricUnits['group_mgram'] = 'microgram'
weewx.units.MetricWXUnits['group_sievert'] = 'microsievert'
weewx.units.MetricWXUnits['group_ppm'] = 'ppm'
weewx.units.MetricWXUnits['group_mgram'] = 'microgram'

weewx.units.default_unit_format_dict['microsievert'] = '%.0f'
weewx.units.default_unit_format_dict['ppm'] = '%.1f'
weewx.units.default_unit_format_dict['microgram'] = '%.0f'

weewx.units.default_unit_label_dict['microsievert'] = ' \xc2\xb5Sv/h'
weewx.units.default_unit_label_dict['ppm'] = ' ppm'
weewx.units.default_unit_label_dict['microgram'] = ' \xc2\xb5g/m\xc2\xb3'

Reply via email to