Problem with units

259 views
Skip to first unread message

kludo

unread,
Feb 13, 2022, 10:14:14 AM2/13/22
to weewx-user
Hello all,

I have updated this weekend to WeeWX version 4.6.2. Actually everything works as usual, but in my photovoltaic data no units are displayed anymore. I have changed the assignment in the units.py as follows "signal1" : "group_energy", but without success.

Who knows advice?

gjr80

unread,
Feb 13, 2022, 7:58:29 PM2/13/22
to weewx-user
Making changes to units.py  is a poor approach to dealing with problems and should be avoided, at best your changes will not survive a WeeWX upgrade; at worst your changes could unknowingly cause problems elsewhere with WeeWX.

If you wish to assign an observation type to a unit group this is best done through the user/extensions.py file. user/extensions.py is intended for users to add code that is to be run during the WeeWX startup and allows user changes to the WeeWX environment to be made in a safe manner. Files in the user directory are protected during a WeeWX upgrade and will not be overwritten. I suggest you revert your changes to units.py and try adding the following to user/extensions.py (untested):

import weewx.units
weewx.units.obs_group_dict['signal1'] = 'group_energy'

Save extensions.py and restart WeeWX. Does that fix your problem?

Gary

Graham Eddy

unread,
Feb 13, 2022, 8:06:00 PM2/13/22
to weewx...@googlegroups.com
at risk of hijacking this thread, there is only one copy of user/extensions.py, used in all instances of weewx (if you are running multiple instances off same code base). is there an easy way to distinguish instances from within user/extensions.py?
 Graham Eddy 

--
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 on the web visit https://groups.google.com/d/msgid/weewx-user/d826d917-602e-48cb-ab18-9a59d8d655a5n%40googlegroups.com.

gjr80

unread,
Feb 13, 2022, 8:16:17 PM2/13/22
to weewx-user
On Monday, 14 February 2022 at 11:06:00 UTC+10 graha...@gmail.com wrote:
at risk of hijacking this thread, there is only one copy of user/extensions.py, used in all instances of weewx (if you are running multiple instances off same code base). is there an easy way to distinguish instances from within user/extensions.py?
 Graham Eddy 


No. You need to find an alternate approach (perhaps a user controlled driver or service) if you are running a multi-instance install and the application of extensions.py to each instance causes problems.

Gary

kludo

unread,
Feb 14, 2022, 1:18:53 PM2/14/22
to weewx-user
Hi Gary, unfortunately your tip did not work. "signal1" still has no unit. Before the update it still did. 

gjr80

unread,
Feb 14, 2022, 3:48:48 PM2/14/22
to weewx-user
I see now there have been some changes have been introduced in WeeWX v4.6.x to how default labelling and formatting of observation types is determined and it appears that group_energy/watt_hour may have fallen through the cracks. I think we can work around the issue in your case by adding some additional lines to user/extensions.py:

weewx.units.default_unit_format_dict['watt_hour'] = '%.1f'
weewx.units.default_unit_label_dict['watt_hour'] = u' Wh'

Again you will need to restart WeeWX for the changes to take effect and hopefully the first report cycle should add you missing units/formatting.

Gary       

kludo

unread,
Feb 15, 2022, 12:22:11 PM2/15/22
to weewx-user
Hi Gary,

this was the solution for my unit problem. Thanks for your help, also for the hint about using the extensions.py

Many greetings
Udo

Dani Talens

unread,
Feb 28, 2022, 4:11:09 AM2/28/22
to weewx-user
Hi, 

I have a similar error but with lightning_strike_count. I use Belchertown 1.3.b1 skin.

Feb 28 09:58:24 minipc weewx[4152094] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weewx/reportengine.py", line 197, in run
Feb 28 09:58:24 minipc weewx[4152094] ERROR weewx.reportengine:         ****      obj.start()
Feb 28 09:58:24 minipc weewx[4152094] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weewx/reportengine.py", line 378, in start
Feb 28 09:58:24 minipc weewx[4152094] ERROR weewx.reportengine:         ****      self.run()
Feb 28 09:58:24 minipc weewx[4152094] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/user/belchertown.py", line 2714, in run
Feb 28 09:58:24 minipc weewx[4152094] ERROR weewx.reportengine:         ****      series_data = self.get_observation_data(
Feb 28 09:58:24 minipc weewx[4152094] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/user/belchertown.py", line 3726, in get_observation_data
Feb 28 09:58:24 minipc weewx[4152094] ERROR weewx.reportengine:         ****      usage_round = int(
Feb 28 09:58:24 minipc weewx[4152094] ERROR weewx.reportengine:         ****  ValueError: invalid literal for int() with base 10: '%'
Feb 28 09:58:24 minipc weewx[4152094] ERROR weewx.reportengine:         ****  Generator terminated

If you comment on [[[lightning_strike_count]]] entry in graph.conf file, this error disappears.

El dia dimarts, 15 de febrer de 2022 a les 18:22:11 UTC+1, udo.kl...@gmail.com va escriure:

Tom Keffer

unread,
Mar 30, 2022, 9:07:42 AM3/30/22
to weewx-user
Looks like a Belchertown problem. It's pretty similar to this post: https://groups.google.com/g/weewx-user/c/VfpSRxNQits/m/8AlH4dv0AwAJ

--
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.

James Taylor

unread,
Mar 31, 2022, 6:15:43 PM3/31/22
to weewx-user
This has been fixed in a commit to the belchertown code today (31st March).

This was due to the commit which means that count is now specified as %d in units.py.  This broke the Belchertown code for working out the rounding value on graphs as it was expecting a %.xf response  - https://github.com/weewx/weewx/commit/9a388867399a3453b437722f7bb727c87cb853f8.
Reply all
Reply to author
Forward
0 new messages