I guess, there is an entry in weewx.units.conversionDict missing. Both VWC 
and the unit the driver provides need to be present there, as well as a 
formula to convert between them.

bgra...@umw.edu schrieb am Donnerstag, 7. November 2024 um 15:46:48 UTC+1:

> Thanks for the reply, Tom. I am only using US units but have added METRIC 
> and METRICWX as you suggested (see below). However, when I run wee_reports, 
> I get the same error as listed before.
>
> import locale
> # 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, '')
>
> import weewx.units
>
> # https://www.weewx.com/docs/5.0/custom/units/#creating-a-new-unit-group
>
>
> # Specify what group our observation type belongs to
> weewx.units.obs_group_dict['signal1'] = 'group_cpm'
> weewx.units.obs_group_dict['signal2'] = 'group_sievert'
> weewx.units.obs_group_dict['soilMoist1'] = 'group_moisture'
>
> # Specify what unit is used to measure cpm & microsievert in the three 
> standard unit systems used by weewx.
> weewx.units.USUnits['group_cpm'] = 'cpm'
> weewx.units.MetricUnits['group_cpm'] = 'cpm'
> weewx.units.MetricWXUnits['group_cpm'] = 'cpm'
> weewx.units.MetricUnits['group_moisture'] =  'VWC'
> weewx.units.MetricWXUnits['group_moisture'] =  'VWC'
> weewx.units.USUnits['group_moisture'] =  'VWC'
> weewx.units.USUnits['group_sievert'] = 'uSv'
>
>
> # Specify what formats and labels to use for cpm & microsievert
> weewx.units.default_unit_format_dict[' cpm'] = '%.0f'
> weewx.units.default_unit_label_dict[' cpm']  = ' cpm'
> weewx.units.default_unit_format_dict['microsievert'] = '%.2f'
> weewx.units.default_unit_label_dict['microsievert']  = 'uSv'
> weewx.units.default_unit_format_dict['VWC'] = '%.1f'
> weewx.units.default_unit_label_dict['VWC'] = ' VWC'
> On Wednesday, November 6, 2024 at 8:02:10 PM UTC-5 Tom Keffer wrote:
>
>> You've indicated that group_moisture is to be measured in VWC, but only 
>> for the US measurements. For METRIC and METRICWX, it will still be in 
>> centibar.
>>
>> I think what's happening is that weewx is trying to convert from whatever 
>> it has (probably centibar) to VWC, but does not know how.
>>
>> Are you using METRIC and/or METRICWX anywhere? In particular, in the plot?
>>
>>
>>
>> On Wed, Nov 6, 2024 at 1:47 PM bgra...@umw.edu <bgra...@umw.edu> wrote:
>>
>>> I am using a Seeed S2105 soil moist/temp sensor on a VP2 with weewx 
>>> 4.10.2. I'm attempting to change the units from "cb" to "VWC" as the sensor 
>>> data displays a percentage VWC.
>>>
>>> My additions to extensions.py are as follows:
>>>
>>> # Specify what group our observation type belongs to
>>> weewx.units.obs_group_dict['signal1'] = 'group_cpm'
>>> weewx.units.obs_group_dict['signal2'] = 'group_sievert'
>>> *weewx.units.obs_group_dict['soilMoist1'] = 'group_moisture'*
>>>
>>> # Specify what unit is used to measure cpm & microsievert in the three 
>>> standard unit systems used by weewx.
>>> weewx.units.USUnits['group_cpm'] = 'cpm'
>>> weewx.units.MetricUnits['group_cpm'] = 'cpm'
>>> weewx.units.MetricWXUnits['group_cpm'] = 'cpm'
>>> weewx.units.USUnits['group_sievert'] = 'uSv'
>>> *weewx.units.USUnits['group_moisture'] =  'VWC'*
>>>
>>> # Specify what formats and labels to use for cpm & microsievert
>>> weewx.units.default_unit_format_dict[' cpm'] = '%.0f'
>>> weewx.units.default_unit_label_dict[' cpm']  = ' cpm'
>>> weewx.units.default_unit_format_dict['microsievert'] = '%.2f'
>>> weewx.units.default_unit_label_dict['microsievert']  = 'uSv'
>>> weewx.units.default_unit_format_dict['VWC'] = '%.1f'
>>> *weewx.units.default_unit_label_dict['VWC'] = ' VWC'*
>>>
>>> The error I get when running "wee_reports" is:
>>>
>>> sudo ./wee_reports
>>> Generating as of last timestamp in the database.
>>> Using configuration file /home/weewx/weewx.conf
>>> Traceback (most recent call last):
>>>   File "/home/weewx/bin/weewx/reportengine.py", line 197, in run
>>>     obj.start()
>>>   File "/home/weewx/bin/weewx/reportengine.py", line 385, in start
>>>     self.run()
>>>   File "/home/weewx/bin/weewx/imagegenerator.py", line 42, in run
>>>     self.gen_images(self.gen_ts)
>>>   File "/home/weewx/bin/weewx/imagegenerator.py", line 107, in gen_images
>>>     plot = self.gen_plot(plotgen_ts,
>>>   File "/home/weewx/bin/weewx/imagegenerator.py", line 279, in gen_plot
>>>     new_data_vec_t = self.converter.convert(data_vec_t)
>>>   File "/home/weewx/bin/weewx/units.py", line 919, in convert
>>>     new_val_t = convert(val_t, new_unit_type)
>>>   File "/home/weewx/bin/weewx/units.py", line 1454, in convert
>>>     conversion_func = conversionDict[val_t[1]][target_unit]
>>> KeyError: 'VWC'
>>>
>>> I know I'm missing a step somewhere but can't seem to find it. I'm still 
>>> showing on the Standard skin:
>>>
>>> Soil Moisture (VWC)  26 cb at 16:00 
>>> Soil Temperature 62.4°F at 16:00 
>>> Soil Conductivity (dSm) 0.010000 at 16:00
>>>
>>> Thanks in advance of any suggestions.
>>> Cheers,
>>> Bob
>>> http://grattans.org/wx
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "weewx-user" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to weewx-user+...@googlegroups.com.
>>> To view this discussion visit 
>>> https://groups.google.com/d/msgid/weewx-user/6ad8b5fb-5cc7-4643-876a-6e78151da225n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/weewx-user/6ad8b5fb-5cc7-4643-876a-6e78151da225n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/weewx-user/627ab47c-552b-4cb1-9290-b267d74cf8aen%40googlegroups.com.

Reply via email to