wee_import from Weather underground twice a day

135 views
Skip to first unread message

sc.lep...@gmail.com

unread,
Nov 15, 2020, 9:08:24 AM11/15/20
to weewx-user
Hello
I want to import twice a day ( for example 12h00 and  00h00) my data from Weather Underground.

I want to write a script shell  to put it in a crontab.

first question :
 I use this  : 
wee_import --config=/home/weewx/FROGGIT.conf --import-config=/home/weewx/wu-FROGGIT.conf --date=2020-11-14

For midday  : .....    - -date is it possible to put - - date =2020-11-14T12:00 ?
For midnight : .....    - - from=2020-11-14T12:00   - -to=2020-11-14:23:59


Snd question  : I must answer by "y" to proceed  import , is is possible to overwrite this ?

And if you want to see results , it 's here  :

Thanks a lot , best regards  
Stephane 

sc.lep...@gmail.com

unread,
Nov 15, 2020, 10:11:16 AM11/15/20
to weewx-user
For the first question  I ve my own answer  : 
2 scripts bash 

For night and morning  : 
#!/bin/bash  
date_debut_jour_heure=`date +"%Y-%m-%dT00:00"` ;
date_fin_jour_heure=`date +"%Y-%m-%dT12:00"` ;

echo $date_debut_jour_heure;
echo $date_fin_jour_heure;

/home/pi/weewx-4.2.0/bin/wee_import --config=/home/weewx/FROGGIT.conf --import-config=/home/weewx/wu-FROGGIT.conf --from=$date_debut_jour_heure --to=$date_fin_jour_heure --dry-run


For afternoon and evening  : 

#!/bin/bash
date_debut_jour_heure=`date +"%Y-%m-%dT12:00"` ;
date_fin_jour_heure=`date +"%Y-%m-%dT23:59"` ;

echo $date_debut_jour_heure;
echo $date_fin_jour_heure;

/home/pi/weewx-4.2.0/bin/wee_import --config=/home/weewx/FROGGIT.conf --import-config=/home/weewx/wu-FROGGIT.conf --from=$date_debut_jour_heure --to=$date_fin_jour_heure --dry-run



But how to suppress Y/N answer ? 

thanks

gjr80

unread,
Nov 17, 2020, 2:37:56 AM11/17/20
to weewx-user
Hi,

There is presently no support in wee_import for suppressing/bypassing/automatically answering the y/n prompt in wee_import, we never envisioned wee_import being used in that manner. Implementing something like the --no-prompt command line option in wee_config should be possible and fairly straightforward to add. Let me do some homework.

Gary

sc.lep...@gmail.com

unread,
Nov 19, 2020, 11:54:44 AM11/19/20
to weewx-user
Hi Gary, Thanks a lot for your answer  ...
there is option - - dry-run  so if you can implemente  - - no-prompt it will be very good 
Stephane

gjr80

unread,
Nov 21, 2020, 8:36:44 PM11/21/20
to weewx-user
Stephane,

I have implemented a --no-prompt command line option for wee_import. --no-prompt will cause 'y' to be automatically accepted for all y/n prompts. To use it you just add it to your existing command line, eg:

$ /home/weewx/bin/wee_import --import-config=/var/tmp/wu.conf --date=2020-11-15 --no-prompt

Since you are using WeeWX v4.2.0 you can try out the --no-prompt capable wee_import as follows (the following assumes you have WeeWX installed in the directory /home/pi/weewx-4.2.0):

1. move aside your existing wee_import and weeimport.py:
$ cp /home/pi/weewx-4.2.0/bin/wee_import /home/pi/weewx-4.2.0/bin/wee_import_orig
$ cp /home/pi/weewx-4.2.0/bin/weeimport/weeimport.py /home/pi/weewx-4.2.0/bin/weeimport/weeimport_orig.py

2. download the updated wee_import and weeimport.py from github:

3. run wee_import with the --help action to see the revised usage:
$ /home/pi/weewx-4.2.0/bin/wee_import --help

4. run wee_import with --no-prompt, I suggest you try running wee_import with --no-prompt interactively from the command line before setting your cron script to use it.

Please let me know how you go, if successful I will arrange for --no-prompt to be included in the 4.3.0 release.

Gary

sc.lep...@gmail.com

unread,
Dec 19, 2020, 6:04:35 AM12/19/20
to weewx-user
Hello  Gary,
 Sorry  for my non answer ! I dont see  it  , 
I m trying this as soon as possible and   will give a feed back
Thanks a lot for this  !
Best regards
stéphane


sc.lep...@gmail.com

unread,
Dec 19, 2020, 6:36:25 AM12/19/20
to weewx-user
Hello back Gary  ! 

I try it and its good  ! 

My script is working  with no prompt  !


root@raspberrypi:/home/pi/Froggit# ./recup_wu.sh
Using WeeWX configuration file /home/weewx/FROGGIT.conf
Starting wee_import...
Observation history for Weather Underground station 'IPONTS4' will be imported.
Using database binding 'wx_binding', which is bound to database 'weewx-FROGGIT.sdb'
Destination table 'archive' unit system is '0x01' (US).
Missing derived observations will be calculated.
Observations timestamped after 2020-12-18 00:00:00 CET (1608246000) and up to and
including 2020-12-19 00:00:00 CET (1608332400) will be imported.
Starting import ...
Records covering multiple periods have been identified for import.
Period 1 ...
Unique records processed: 271; Last timestamp: 2020-12-18 22:34:52 CET (1608327292)
Period 2 ...
Period 2 - no records identified for import.
Calculating missing derived observations ...
Processing record: 271; Last record: 2020-12-19 00:00:00 CET (1608332400)
Recalculating daily summaries...

Finished recalculating daily summaries
Finished calculating missing derived observations
Finished import
271 records were processed and 271 unique records imported in 9.11 seconds.
Those records with a timestamp already in the archive will not have been
imported. Confirm successful import in the WeeWX log file.


Just a little detail   your versionning  : 

root@raspberrypi:/home/pi# /home/pi/weewx-4.2.0/bin/wee_import --version
Using WeeWX configuration file /home/pi/weewx-4.2.0/weewx.conf
wee_import version: 0.5
root@raspberrypi:/home/pi#



Thanks a lot !
Best regards 
Stéphane

gjr80

unread,
Dec 19, 2020, 4:12:15 PM12/19/20
to weewx-user
Thank you for the feedback Stéphane, wee_import --no-prompt will be included in the 4.3.0 release.

Gary
Reply all
Reply to author
Forward
0 new messages