Which version of the Bootstrap skin are you using? The current version 
doesn't even have 410 lines in gaugeengine.py. Anyway, Tom is right, the 
skin has a section [[StringFormats]] in Bootstrap/skin.conf where you need 
to specify 

    [[StringFormats]]
        #
        # This section sets the string formatting for each type of unit.
        #
        micro_sievert_hour   = %.2f

Since I am the leading maintainer of the bootstrap skin now,  I probably 
should find a way to do this in another, probably more weewx-like way or at 
least just log the error without terminating. The python part is still kind 
of hard for me :)

Consider upgrading to the latest version of the skin, I added some nice 
looking interactive charts and gauges, as well as the possibility feeding 
chart and gauges with live weather data. Here is how it looks like in 
action: https://www.kainzbauer.net/weather/Rif/
[email protected] schrieb am Donnerstag, 5. Januar 2023 um 21:06:19 UTC+1:

> Thanks Tom!
>
> Possible to write example, how to use weewx to lookup a string format for 
> new units?
>
> Thanks
>
> 2023 m. sausio 3 d., antradienis 21:40:49 UTC+2 [email protected] rašė:
>
>> My best guess: instead of using weewx to look up a string format for your 
>> new unit, the extension gaugeengine is doing its own lookup. So it is 
>> unaware of the new unit. It also is not providing a fallback, hence the 
>> error.
>>
>> On Tue, Jan 3, 2023 at 8:01 AM [email protected] <[email protected]> wrote:
>>
>>> Hello, 
>>>
>>> I will be highly appreciated if someone point me what is wrong when I 
>>> adding new observation.
>>>
>>> Contents of extensions.py as following:
>>>
>>> weewx.units.obs_group_dict['ion_rad'] = 'group_radex'
>>> weewx.units.obs_group_dict['cpm'] = 'group_counter'
>>> weewx.units.USUnits['group_radex'] = 'micro_sievert_hour'
>>> weewx.units.USUnits['group_counter'] = 'cpm'
>>> weewx.units.MetricUnits['group_radex'] = 'micro_sievert_hour'
>>> weewx.units.MetricUnits['group_counter'] = 'cpm'
>>> weewx.units.default_unit_format_dict['micro_sievert_hour'] = '%.2f'
>>> weewx.units.default_unit_format_dict['cpm']  = '%.0f'
>>> weewx.units.default_unit_label_dict['micro_sievert_hour'] = ' µSv/h'
>>> weewx.units.default_unit_label_dict['cpm']  = ' CPM'
>>>
>>> Error:
>>>
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine: Caught 
>>> unrecoverable exception in generator 'user.gaugeengine.GaugeGenerator'
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****  'micro_sievert_hour'
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****  Traceback (most recent call last):
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****    File "/usr/share/weewx/weewx/reportengine.py", line 197, in run
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****      obj.start()
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****    File "/usr/share/weewx/weewx/reportengine.py", line 385, in start
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****      self.run()
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****    File "/usr/share/weewx/user/gaugeengine.py", line 121, in run
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****      self.gen_gauges()
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****    File "/usr/share/weewx/user/gaugeengine.py", line 224, in 
>>> gen_gauges
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****      ret = self.gen_gauge(gauge, plot_options, img_file)
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****    File "/usr/share/weewx/user/gaugeengine.py", line 410, in 
>>> gen_gauge
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****      label_format = self.units_dict['StringFormats'][target_unit]
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****    File "/usr/lib/python3/dist-packages/configobj.py", line 554, in 
>>> __getitem__
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****      val = dict.__getitem__(self, key)
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****  KeyError: 'micro_sievert_hour'
>>> Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:       
>>>   ****  Generator terminated
>>>
>>> Many Thanks!
>>>
>>> -- 
>>> 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 [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/weewx-user/069dc394-5a77-49b9-ab0e-78219e1456a2n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/weewx-user/069dc394-5a77-49b9-ab0e-78219e1456a2n%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/166316ca-f5dd-49fa-9459-be29601c9f0cn%40googlegroups.com.

Reply via email to