Weewx tag to show last time it rained

213 views
Skip to first unread message

Maarten van der Hoeven

unread,
Jun 3, 2020, 4:14:29 AM6/3/20
to weewx-user
Hi,

What would be the weewx tag to show the date&time the last time is has rained?

I have a feeling I need to do some scripting/programming to retrieve this. Or am I overlooking a nifty tag?

Remy Lavabre

unread,
Jun 3, 2020, 5:11:52 AM6/3/20
to weewx-user
Hi,

Just do that (simple) :

-1/  git clone wee_extension --install=/tmp/extensions/lastrain /tmp/extensions/lastrain
-2/ sudo wee_extension --install=/tmp/extensions/lastrain
-3/ sudo /etc/init.d/weewx stop
-4/ sudo /etc/init.d/weewx start
-5/ Enjoy ! ;-)

Maarten van der Hoeven

unread,
Jun 3, 2020, 6:13:55 AM6/3/20
to weewx-user
Thanks. Are we talking about this extension to install?




Op woensdag 3 juni 2020 11:11:52 UTC+2 schreef Remy Lavabre:

Remy Lavabre

unread,
Jun 3, 2020, 6:38:05 AM6/3/20
to weewx-user
Yes !
And it is working perfectly !

NanoG5Kite

unread,
Jun 3, 2020, 6:59:13 AM6/3/20
to weewx-user
Got this installed and working too - many thanks for the hint.


As Weewx beginner - is there any way to get the two Last Rain Values displayed in the Belchertown Homeskin?

last rain N/A
time since last rain: N/A

Thanks,

Matthias

Remy Lavabre

unread,
Jun 3, 2020, 7:55:33 AM6/3/20
to weewx-user
Yes if course !
Go go your skin (etc/weewx/skin/your_skin and edit the good file (sudo nano your_file, normaly *.tmpl), look how it works and had jour values.
It is realy possible !
Good work !

Pat

unread,
Jun 3, 2020, 8:11:27 AM6/3/20
to weewx-user
Where on the skin would you display this info? Just curious

Maarten van der Hoeven

unread,
Jun 8, 2020, 2:57:14 AM6/8/20
to weewx-user
Well, speaking for me, I would like to show this information (last time it rained) using a tag, and put it in index_hook_after_station_info.inc The tag is $time_since_last_rain.

Having done that (putting the tag in that inc-file), it throws an error NameMapper.NotFound while the generator is doing its thing. Looking at the html the skin lastrain produces, it shows the correct last datetime it rained. I guess (in my own words) it's the case that calculated variables in one skin can not be used in another skin? Is this true?

Jun  8 08:53:18 weewx weewx[99172] INFO weewx.cheetahgenerator: Generated 8 files for report SeasonsReport in 1.24 seconds
Jun  8 08:53:19 weewx weewx[99172] INFO weewx.imagegenerator: Generated 15 images for report SeasonsReport in 0.41 seconds
Jun  8 08:53:19 weewx weewx[99172] INFO weewx.reportengine: Copied 5 files to /var/www/html/weewx
Jun  8 08:53:19 weewx weewx[99172] INFO weewx.restx: MQTT: Published record 2020-06-08 08:53:19 CEST (1591599199)
Jun  8 08:53:19 weewx weewx[99172] message repeated 2 times: [ INFO weewx.restx: MQTT: Published record 2020-06-08 08:53:19 CEST (1591599199)]
Jun  8 08:53:20 weewx weewx[99172] ERROR weewx.cheetahgenerator: Generate failed with exception '<class 'NameMapper.NotFound'>'
Jun  8 08:53:20 weewx weewx[99172] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/Belchertown/index.html.tmpl
Jun  8 08:53:20 weewx weewx[99172] ERROR weewx.cheetahgenerator: **** Reason: cannot find 'time_since_last_rain'
Jun  8 08:53:20 weewx weewx[99172] ERROR weewx.cheetahgenerator: ****  Traceback (most recent call last):
Jun  8 08:53:20 weewx weewx[99172] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 322, in generate
Jun  8 08:53:20 weewx weewx[99172] ERROR weewx.cheetahgenerator: ****      unicode_string = compiled_template.respond()
Jun  8 08:53:20 weewx weewx[99172] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_Belchertown_index_html_tmpl.py", line 1261, in respond
Jun  8 08:53:20 weewx weewx[99172] ERROR weewx.cheetahgenerator: ****    File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 1708, in _handleCheetahInclude
Jun  8 08:53:20 weewx weewx[99172] ERROR weewx.cheetahgenerator: ****      self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
Jun  8 08:53:20 weewx weewx[99172] ERROR weewx.cheetahgenerator: ****    File "cheetah__etc_weewx_skins_Belchertown_index_hook_after_station_info_inc_1591599200_376662_26334.py", line 90, in respond
Jun  8 08:53:20 weewx weewx[99172] ERROR weewx.cheetahgenerator: ****  NameMapper.NotFound: cannot find 'time_since_last_rain'
Jun  8 08:53:20 weewx weewx[99172] INFO weewx.restx: MQTT: Published record 2020-06-08 08:53:21 CEST (1591599201)
Jun  8 08:53:21 weewx weewx[99172] INFO weewx.cheetahgenerator: Generated 10 files for report Belchertown in 1.86 seconds


Op woensdag 3 juni 2020 14:11:27 UTC+2 schreef Pat:

gjr80

unread,
Jun 8, 2020, 4:59:17 AM6/8/20
to weewx-user
When you extend the search list using a search list extension it is done on a skin-by-skin basis. Have a look in the skin config file for the skin that does work with the search list extension, under [CheetahGenerator] you should find a setting search_list_extensions that is set to a comma separated list of items (there may only be one item), something like:

search_list_extensions = user.apple.a_search_list, user.orange.another_search_list

One of the items will be for your last rain extension (hint the search list name (eg a_search_list) is the same as the class name for the search list extension in the search list .py file (eg user/apple.py)).

To use a search list extension in another skin you need to add the search_list_extensions setting (if not already there) under [CheetahGenerator] in the skin config file for the other skin and set it to use search list extension concerned. If there are already entries against search_list_extensions just add you search list to the list with a commma. For example to use the a_search_list search list extension you would simply add the following line:

search_list_extensions = user.apple.a_search_list

No need to restart WeeWX.

Gary

Maarten van der Hoeven

unread,
Jun 8, 2020, 7:27:21 AM6/8/20
to weewx-user
Thanks Gary, for the pointer. This makes sense. In fact, it is working now! Adding user.lastrain.getRainTags to the existing search_list_extentions in the skin.conf of Belchertown.

Now moving it to the weewx.conf, to make it less vulnerable to skin-changes of Belchertown.



Op maandag 8 juni 2020 10:59:17 UTC+2 schreef gjr80:

Mikael Fredriksson

unread,
Jun 22, 2020, 1:17:44 PM6/22/20
to weewx-user
Hi! Just installed this extension. Works perfectly. Just want to change the language in "days", "hours", and "minutes" in $time_since_last_rain tag. Where do I make this change?

regards Mikael

didier....@gmail.com

unread,
Jun 26, 2020, 4:00:23 AM6/26/20
to weewx-user
Hi
Could you write a small recap tuto to explain the different actions and modifications, I would like install this interesting functionnality and I am not an expert in Linux and weewx...
Is it possible to include this in the Belchertown development git?
Many thanks

didier....@gmail.com

unread,
Jul 9, 2020, 12:57:47 PM7/9/20
to weewx-user

Hi
I have installed the extension and modify the conf file, but I have not the file index-hook-after-station-info.inc, and I don't know how to write it. Is it possible to have a copy of this file with the 2 parameters last_rain and time_since_last_rain?

Many thanks
Didier
Reply all
Reply to author
Forward
0 new messages