Weewx - Belchertown and 24 hour time format

470 views
Skip to first unread message

barry winch

unread,
May 4, 2022, 2:47:20 PM5/4/22
to weewx-user
Hi all, I'm new to all this configurtion stuff after using a Vantage Pro 2 and Ambient s/w for the last 15+ years! I now have a Weatherflow Tempest using Weewx with the Belchertown skin on a RPi4. So far I have pretty much persuded it to do what I want with the exception of displaying tome in the 24 hour format. Regardless of all the changes I have made it insists on displaying any time in the AM / PM format i.e. 2:20:00PM instead of 14:20. 

From what I have read I need to make changes in:
[Belchertown]
[[[[TimeFormats]]]]
     day =          %HH:MM
      week =      %HH:MM on %A (what is the %A)::
      etc.
      etc.

I have tried various combinations of %H:%M  %HH:%MM  %h:%m, all with no effect. Can some one point me in the right direction to fix this. Weefx has been restarted after each attempt to fix this!wxt

Also, while on the subject of time, the time is posted to the data on my web page, but I can see no sign of it if I open up /var/www/html/weewx/index.html with my browser, is this normal?

Thanks for any help that can be given

vince

unread,
May 4, 2022, 3:22:06 PM5/4/22
to weewx-user
For time formats, the weewx customization guide points you to the python date/time formatting options (link) saying %A is the day of the week (ie, Monday).  The Belchertown docs (link) do read a little differently, pointing to the moment.js way to select a time format, and his example in skin.conf really confuses me completely.

See if "day = HH:MM" works perhaps....
(untested)

It's not clear where you're editing things though.  The number of [[[[ ]]]] pairs looks possibly wrong, which can break things.

barry winch

unread,
May 4, 2022, 4:34:06 PM5/4/22
to weewx-user
Thanks for the pointer to more reference material Vince. Being new at this I have been gathering as much info as possible, unfortunately I miss some, and others are contradictory. I have no idea where the 4 [[[[ came from, probably one of my desperate cut and paste attempts!
I think the safest path now is to sort out all my notes and start from scratch with a new install, at least it gives me practice playing with Linux.
Barry

vince

unread,
May 4, 2022, 4:49:14 PM5/4/22
to weewx-user
naaah - no need to do a full install.  You're close enough that this one is just tweaking something (TBD) into the right config file (TBD).

barry winch

unread,
May 5, 2022, 8:32:09 AM5/5/22
to weewx-user
Well, just for the "fun" of it, I did a complete re-install of Linux and Weewx (at the moment the computer is only being used to play with Weewx). From a clean install I am still not able to change to the 24hr format for Weewx. Not that it should matter, but Linux is set to the 24hr format. The 4 [[[[ that surround TimeFormats has come up in the clean install, so I guess it was nothing I did!!  Immediately before  [[[[TimeFormats]]]] in the weewx.conf is [[[[Groups]]]] and any changes I make there are actioned. It's not the end of the world that the time is in the 12 hr format, it's now become a battle of (old) man against machine! If anyone has the 24hr time format running ok could they post the relevant parts of their config file??

Barry

Pierre-Yves

unread,
May 5, 2022, 10:06:21 AM5/5/22
to weewx-user
Hi Barry,

I live in France and use the 24h format. Weewx is installed on a Pi4.

Below, the relevant part of the skin.conf file located in the Belchertown skin folder. When I installed the Belchertown skin few years ago, I didn't do any modification to have the right format.

[Units]
    # This section is for managing the selection and formatting of units.

    [[Groups]]
        #...
       
    [[StringFormats]]
        # ...

    [[Labels]]
        # ...

    [[TimeFormats]]
        # This section sets the string format to be used for each time scale.
        # The values below will work in every locale, but may not look
        # particularly attractive. See the Customization Guide for alternatives.

        day        = %X
        week       = %X (%A)
        month      = %x %X
        year       = %x %X
        rainyear   = %x %X
        current    = %x %X
        ephem_day  = %X
        ephem_year = %x %X

Pierre-Yves

barry winch

unread,
May 5, 2022, 10:27:50 AM5/5/22
to weewx-user
Thanks Pierre-Yves, that is exactly what I have on my Pi4! Have you made any changes to weewx.conf in the TimeFormats section?

Barry

Pierre-Yves

unread,
May 5, 2022, 10:43:58 AM5/5/22
to weewx-user
Here is the TimeFormats of my weewx.conf :

[[[[TimeFormats]]]]
                # day        = %H:%M
                # week       = %H:%M on %A
                # month      = %d-%b-%Y %H:%M
                # year       = %d-%b-%Y %H:%M
                # rainyear   = %d-%b-%Y %H:%M
                # current    = %d-%b-%Y %H:%M
                # ephem_day  = %H:%M
                # ephem_year = %d-%b-%Y %H:%M
                # The following line is used to keep the above lines indented properly.
                # It can be ignored.
                unused = unused
I don't have made any changes compare to the original one.

PY

barry winch

unread,
May 5, 2022, 7:19:15 PM5/5/22
to weewx-user
Many Thanks, again that is exactly the same as mine. Time to look elsewhere!

Barry

gjr80

unread,
May 5, 2022, 8:05:24 PM5/5/22
to weewx-user
The problem you have with a skin such as Belchertown that relies on a mix of HTML and Javascript is that you are now no longer simply using WeeWX tags and formatting to generate the displayed data, but you likely have Javascript formatting to deal with as well. Chances are that changing WeeWX formatting, particularly for date-time data, will not give you what you want.

I don't use the Belchertown skins but looking in some of the templates pointed me to these settings in the Belchertown skin.conf [Labels] [[Generic]] (circa line 590):

# moment.js default labels formats
time_earthquake = "LLL"
time_last_updated = "LL, LTS"
time_snapshot_records_today_header = "dddd, LL"
time_snapshot_records_month_header = "MMMM YYYY"
time_sunrise = "LT"
time_sunset = "LT"
time_forecast_alert_expires = "LLL"
time_forecast_date = "ddd M/DD"
time_forecast_time = "ddd LT" # must be {day} {time} format
time_forecast_last_updated = "LLL"
time_records_page_full_date = "LLL"
time_records_page_month_day_year = "LL"
time_records_page_rainfall_range_begin = "MMMM DD"
time_records_page_rainfall_range_end = "LL"

To change the 'Last Updated' date-time on main page you need to change the time_last_updated setting. I suspect you will find that "LL LTS" is a locale based format which may or may not give you a 24 hour time format depending on your systems locale. If you google 'formatting date and time with moment.js' you should find some useful information, it looks like something like 'D MMMM YYYY HH:mm:ss' may be a good starting point. Try changing that setting though you will need to wait for the next report cycle to see the effect of your changes.  

Gary
Message has been deleted
Message has been deleted
Message has been deleted

gjr80

unread,
May 7, 2022, 3:06:15 AM5/7/22
to weewx-user
Barry's reply was caught up again by the Google-groups spaminator. Even when I release the posts they show up as deleted so I have posted the first below (sans some formatting):

Gary

Thanks Gary, just got around to reading your post after an accelerated course in how to mess things up on Linux!! I am still not totally sure how Linux handles all the Date formatting as on first install the system clock t the bottom is in 24hr format, but every thing else displays as 12 hr. I finally solved the issue (I think) with the following Linux command

sudo localectl set-locale LC_TIME=en_GB.UTF-8

My locale was set as Canada where the 12hr format is more common, by changing the TIME part to GB it then uses 24hr. I am sure there are many good reasons I shouldn't do it this way but.........

Mind you, I haven't found a way to return to the 12hr format (not that I want to). I would have thought that 

sudo localectl set-locale LC_TIME=en_CA.UTF-8 would work, but it doesn't!

gjr80

unread,
May 7, 2022, 3:20:31 AM5/7/22
to weewx-user
Barry,

Unfortunately the Google groups spam checker leaves a bit to be desired. If seems to mark some folks replies as spam for no apparent (to us) reason. When a post is marked as spam the group managers/owners don't get notified there are posts awaiting checking/release unless we happen to view the group in a browser and notice the pending posts. And to cap it all off when we do release a post that was marked as spam it is often shown as deleted (well that is what happens to me 90% of the time, Tom seems to have more success). Enough Google complaining.

Changing the locale may have given you the 24 hour time format you seek but I think you will find that changing locales to somewhere where you are not may solve one problem but create a number of others (not necessarily WeeWX related). The Belchertown skin appears to use a number of locale based formats  (as does WeeWX) to give usable date-time formats for most users around the world. When you want something different a half way decent skin will give you the ability to alter the formats in weewx.conf or skin.conf which is exactly what the Belchertown skin does. It might take a bit of playing around but I would try and persist with your correct locale and tweak the date and time formats in the Belchertown skin.conf to get what you want.

Gary
Message has been deleted

gjr80

unread,
May 7, 2022, 7:11:19 PM5/7/22
to weewx-user
Seems it got you again...

Re: Weewx - Belchertown and 24 hour time format
Hi Gary, thanks for dragging me out of the sin bin. The locale change seemed to work for a while, then the format defaulted back to 12 hr. One problem that is causing confusion is the fact that it takes 3 or 4 cycles for the change to take effect. I have now moved on to the skins.conf and your suggestion of   'D MMMM YYYY HH:mm:ss' was a good starting point. I now have the Last Updated in 24hr format!

Barry

gjr80

unread,
May 7, 2022, 7:30:21 PM5/7/22
to weewx-user
Barry,

Just a note on how long you have to wait for changes to take effect. WeeWX 'generates' skin output at the end of each archive period. So if you have an archive period of five minutes that means skin output is generated every five minutes, you won't see skin output more frequently than your archive period. WeeWX also generates some skin output less frequently than every archive period, typically you see this for plots with aggregates but can also be applied to templates. For example in the Seasons skin year plots by default use a 24 hour aggregate so those plots are generated every 24 hours, month plots use a 3 hour aggregate so they are generated every three hours. Day plots have no aggregate so they are generated every archive periods. Some templates based output may also be generated less frequently, but in Seasons they are all generated every archive period. One handy tool for forcing WeeWX to re-generate a template or plot on the next archive period (regardless of how often it is normally generated) is to delete the generated file on the WeeWX machine. One common use is if you tweak plot settings you may decide to delete all plot files to force them all to be re-generated at the end of the next archive period. You can also use the wee_reports utility to generate reports on demand. This is useful for testing.

Gary

Karen K

unread,
May 8, 2022, 12:36:44 PM5/8/22
to weewx-user
Regarding Belchertown skin and Javascript time formatting: This sometimes depends on the settings of the computer, where the page is displayed. Not on the settings of the server that hosts the pages or WeeWX. 
Message has been deleted
Message has been deleted

gjr80

unread,
May 9, 2022, 4:52:28 PM5/9/22
to weewx-user

Re: Weewx - Belchertown and 24 hour time format
OK, problem sorted! This was done by following Gary's advice and modifying the TIME portion of Belchertown/skin.conf. 

One problem down, now to get the forecast display working!

Barry

gjr80

unread,
May 9, 2022, 4:56:25 PM5/9/22
to weewx-user
Re: Weewx - Belchertown and 24 hour time format
Test, let's see if this one gets deleted.
Barry

Not quite deleted Barry, your post was quarantined but shows in the thread as 'Deleted'. Unfortunately when I release it from quarantine it is not added to the thread.

Gary

gjr80

unread,
May 9, 2022, 5:01:39 PM5/9/22
to weewx-user
True to a certain extent; by default the Belchertown skin uses a number of JavaScript locale based date-time formats (LLL, LL, LT, LTS etc) and these formats are  based on the system locale. However, when you use non-locale based formats (MMM, YYYY etc) in skin.conf [Labels] [[Generic]] the resulting date-time formats are for all intents and purposes system independent.

Gary

Barry

unread,
May 12, 2022, 9:30:27 AM5/12/22
to weewx-user
Thanks again Gary, any clue as to why my posts get quarantined? Is it something to do with the content, length etc or is it just on the whim of Google. It's frustrating as I'd like to try and get some help on including the forecast on my Web page (now, with help, I have got other parts working).

Barry

gjr80

unread,
May 12, 2022, 3:20:44 PM5/12/22
to weewx-user
Barry,

I have no idea. Since I have been a group manager I have not seen one quarantined post that actually was spam, all have been legitimate. I just looked at the weewx-user group settings and the spam settings are as relaxed as we can make them. Interestingly, there is a setting for notifying users by email if their post is quarantined as spam, that setting is enabled for weewx-user but clearly is not being applied.

I have no idea what is likely triggering the spam filter, perhaps others with wider Google groups knowledge have some idea. I don't know if there is any difference in handling email based or web page based posts, nor do I know if including the previous posts in a reply (the default) has an effect (for brevity purposes I often delete/trim post history from my replies). I only post via web page and have had only one of my posts go to quarantine, fortunately it was relatively short so I just reworded the text and re-posted and it went through fine the second time.

My advice would be to keep at it, start a new thread and keep your posts as succinct as possible. We will eventually see quarantined posts and deal with them.

Gary

Barry

unread,
May 12, 2022, 6:30:12 PM5/12/22
to weewx-user
Thanks Gary, the last message stayed, so I'll plod on. I probably should start a new topic, but I don't want to tempt fate!
 Now looking for some assistance with installing a Weather Forecast display on the Belchertown skin. Again I have looked through various posts and sites but haven't found a definitive install process that works here.

I am running Linux Mint on a dedicated Intel NUC for the moment, I'll move it across to a RPi when I have the basics working.
This is what I’ve done so far:

Got the “stock” BelcherTown skin. Weewx and WeatherFlow-UDP all playing nicely together and uploading data to my weather page.
Setup PSW account and got an API key
Setup forwarding to PSW
     [[PWSWeather]
        enable = true
        station = STRANDHERDMEADOWS
        password = xxxxxxxxxxxxxxxxx
Data is being sent to PWS OK.
 
Setup Aeris weather account and got both the ID and Secret key.

Downloaded the forecast extension “weewx-forecast-master.zip” from  https://github.com/matthewwall/weewx-forecast
Then installed it
sudo wee_extension --install weewx-forecast-master.zip            

There were no errors on install.

When I then restarted weewx  it seems to go through a cycle of data collection and then syslog gets a whole slew of messages:

May 12 18:07:18 linux /weewxd: weatherflowudp: MainThread: raw packet: {'serial_number': 'ST-00062106', 'type': 'rapid_wind', 'hub_sn': 'HB-00071538', 'ob': [1652393236, 1.24, 196]}
May 12 18:07:18 linux weewx[545399] INFO weewx.manager: Added record 2022-05-12 18:07:00 EDT (1652393220) to database 'weewx.sdb'
May 12 18:07:18 linux weewx[545399] INFO weewx.manager: Added record 2022-05-12 18:07:00 EDT (1652393220) to daily summary in 'weewx.sdb'
May 12 18:07:18 linux weewx[545399] INFO weewx.engine: Main loop exiting. Shutting engine down.
May 12 18:07:18 linux weewx[545399] CRITICAL __main__: Caught unrecoverable exception:
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****  '>' not supported between instances of 'float' and 'NoneType'
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****  Traceback (most recent call last):
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 214, in run
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****      self.dispatchEvent(weewx.Event(weewx.CHECK_LOOP, packet=packet))
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 245, in dispatchEvent
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****      callback(event)
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 634, in check_loop
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****      raise BreakLoop
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****  weewx.engine.BreakLoop
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****  During handling of the above exception, another exception occurred:
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****  Traceback (most recent call last):
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 650, in post_loop
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****      self._catchup(self.engine.console.genArchiveRecords)
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 697, in _catchup
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****      for record in generator(lastgood_ts):
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/drivers/__init__.py", line 30, in genArchiveRecords
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****      raise NotImplementedError("Method 'genArchiveRecords' not implemented")
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****  NotImplementedError: Method 'genArchiveRecords' not implemented
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****  During handling of the above exception, another exception occurred:
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****  Traceback (most recent call last):
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****    File "/usr/share/weewx/weewxd", line 153, in main
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****      engine.run()
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 221, in run
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****      self.dispatchEvent(weewx.Event(weewx.POST_LOOP))
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 245, in dispatchEvent
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****      callback(event)
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 652, in post_loop
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****      self._software_catchup()
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 715, in _software_catchup
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****      self.engine.dispatchEvent(weewx.Event(weewx.NEW_ARCHIVE_RECORD,
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 245, in dispatchEvent
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****      callback(event)
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****    File "/usr/share/weewx/user/forecast.py", line 1212, in update_forecast
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****      elif time.time() - self.interval > self.last_ts:
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****  TypeError: '>' not supported between instances of 'float' and 'NoneType'
May 12 18:07:18 linux weewx[545399] CRITICAL __main__:     ****  Exiting.

 Anyone any thoughts on what the problem may be, I have never done any programming with Python, which is where the errors appear to be coming from. Even better, is there an idiots guide to installing the forecast capability out there.

Many thanks,
Barry



gjr80

unread,
May 12, 2022, 6:40:25 PM5/12/22
to weewx-user
Barry,

I don't use the forecast extension but it has had some issues for a while now. If you have a search through the forums you should find some threads that will provide links to one or maybe two forks of Matthews repo that have been working. Not sure whether they continue to work or not.

Gary

Barry

unread,
May 12, 2022, 8:09:27 PM5/12/22
to weewx-user
Thanks, Gary. I'll try posting this in its own thread now that things seem to be a little more stable.

Barry
Reply all
Reply to author
Forward
0 new messages