Re: [weewx-user] wee_reports picks up extensions.py delay

2021-06-30 Thread Doug Jenkins
One thing you can do with the Raspberry Pi is to add a RealTimeClock (RTC) 
board. I use the RasClock 4.0 RTC for my Raspberry Pi to retain the system 
clock. This solves any time variances on my WeeWx data verses the system 
clock

On Wednesday, June 30, 2021 at 10:55:55 AM UTC-4 WindnFog wrote:

> That did the trick:
>
>
> Right after reboot:
>
>
> Weewx uptime: 0 days, 0 hours, 1 minute
>
> Server uptime: 0 days, 0 hours, 0 minutes
>
>
> After the script ran (I wrote it exactly as you suggested):
>
>
> Weewx uptime: 0 days, 0 hours, 4 minutes
>
> Server uptime: 0 days, 0 hours, 10 minutes
>
>
> - Paul VE1DX
>
>
> On 2021-06-29 6:35 p.m., vince wrote:
>
> On Tuesday, June 29, 2021 at 12:48:09 PM UTC-7 WindnFog wrote:
>
>> It's nitpicking, but if I reboot my Pi, the server uptime is always 
>> shorter than the weewx uptime.  I get things like:
>>
>> Weewx uptime:10 days, 1 hour, 38 minutes
>> Server uptime: 10 days, 1 hour, 36 minutes
>>
>
> It does seem like nitpicking perhaps.
> Is it really 'that' important to spend all this time worrying it ?
>
> I did a trial on my pi4 with the simulator and see the same thing.  The 
> weewx uptime is a minute more than the server uptime.  I'm guessing it has 
> something to do with the order the threads get their brains straight but I 
> didn't do much digging around.   If you want to look at the code, check out 
> bin/weewx/station.py
>
> If it bothers you that much, you could add a cron job that resets weewx a 
> few minutes after reboot.
> ref: https://www.tomshardware.com/how-to/run-script-at-boot-raspberry-pi
>
> Perhaps a simple bash script ala "sleep 300 && systemctl restart weewx" or 
> the like (untested).
>
> -- 
> You received this message because you are subscribed to a topic in the 
> Google Groups "weewx-user" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/weewx-user/kMMYGq5gC6E/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> weewx-user+...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/weewx-user/b8bc0592-65ac-4e9c-a7dc-2dedce87882cn%40googlegroups.com
>  
> 
> .
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/3342f952-1860-460e-a7b8-bbebb7fbn%40googlegroups.com.


Re: [weewx-user] wee_reports picks up extensions.py delay

2021-06-30 Thread Paul Dunphy

That did the trick:


Right after reboot:


Weewx uptime: 0 days, 0 hours, 1 minute

Server uptime: 0 days, 0 hours, 0 minutes


After the script ran (I wrote it exactly as you suggested):


Weewx uptime: 0 days, 0 hours, 4 minutes

Server uptime: 0 days, 0 hours, 10 minutes


- Paul VE1DX



On 2021-06-29 6:35 p.m., vince wrote:

On Tuesday, June 29, 2021 at 12:48:09 PM UTC-7 WindnFog wrote:

It's nitpicking, but if I reboot my Pi, the server uptime is
always shorter than the weewx uptime.  I get things like:

Weewx uptime:10 days, 1 hour, 38 minutes
Server uptime: 10 days, 1 hour, 36 minutes


It does seem like nitpicking perhaps.
Is it really 'that' important to spend all this time worrying it ?

I did a trial on my pi4 with the simulator and see the same thing. 
 The weewx uptime is a minute more than the server uptime.  I'm 
guessing it has something to do with the order the threads get their 
brains straight but I didn't do much digging around.   If you want to 
look at the code, check out bin/weewx/station.py


If it bothers you that much, you could add a cron job that resets 
weewx a few minutes after reboot.

ref: https://www.tomshardware.com/how-to/run-script-at-boot-raspberry-pi

Perhaps a simple bash script ala "sleep 300 && systemctl restart 
weewx" or the like (untested).


--
You received this message because you are subscribed to a topic in the 
Google Groups "weewx-user" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/weewx-user/kMMYGq5gC6E/unsubscribe 
.
To unsubscribe from this group and all its topics, send an email to 
weewx-user+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/b8bc0592-65ac-4e9c-a7dc-2dedce87882cn%40googlegroups.com 
.


--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/1a233fb0-b961-b797-b581-c4a114d2dce4%40gmail.com.


Re: [weewx-user] wee_reports picks up extensions.py delay

2021-06-29 Thread vince
FWIW, weewx in simulator mode in a Vagrant/VirtualBox VM of Rocky Linux 8.4 
shows the 'same' uptime for weewx and system, but the VM is running on my 
2012 MacBook Air which is much faster than a pi4 in every way, so I'm not 
certain it's a fair comparison.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/c7543703-9c32-421a-83cc-696ed8219ca1n%40googlegroups.com.


Re: [weewx-user] wee_reports picks up extensions.py delay

2021-06-29 Thread HRM Resident
Makes sense, Vince. Indeed it is a -1 on the 1-10 scale of importance.  I was 
thinking of something like the cron restart script, but I wanted to be sure I 
hadn’t missed something obvious.  weewx is a mature product, and it’s been my 
experience that there’s little that you guys have not encountered.  

Since it’s not unique to me, I will put together a sleepy bash script that 
gives it a kick 5-8 minutes after a reboot.  No doubt, I would be the only one 
who noticed it when looking at my website.  It’s a difference that makes no 
difference, but looking at a program that has been running a little longer than 
the server has was always a curiosity. 

That’ll give me something to do tomorrow. Thanks for confirming that you see it 
too on a Pi 4.  With 4 cores, the threads getting their timing wires crossed 
temporarily is probably as good an explanation as any.

- Paul VE1DX 

> On Jun 29, 2021, at 6:35 PM, vince  wrote:
> 
> On Tuesday, June 29, 2021 at 12:48:09 PM UTC-7 WindnFog wrote:
>> It's nitpicking, but if I reboot my Pi, the server uptime is always shorter 
>> than the weewx uptime.  I get things like:
>> 
>> Weewx uptime:10 days, 1 hour, 38 minutes
>> Server uptime: 10 days, 1 hour, 36 minutes
> 
> It does seem like nitpicking perhaps.
> Is it really 'that' important to spend all this time worrying it ?
> 
> I did a trial on my pi4 with the simulator and see the same thing.  The weewx 
> uptime is a minute more than the server uptime.  I'm guessing it has 
> something to do with the order the threads get their brains straight but I 
> didn't do much digging around.   If you want to look at the code, check out 
> bin/weewx/station.py
> 
> If it bothers you that much, you could add a cron job that resets weewx a few 
> minutes after reboot.
> ref: https://www.tomshardware.com/how-to/run-script-at-boot-raspberry-pi
> 
> Perhaps a simple bash script ala "sleep 300 && systemctl restart weewx" or 
> the like (untested).
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "weewx-user" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/weewx-user/kMMYGq5gC6E/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> weewx-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/weewx-user/b8bc0592-65ac-4e9c-a7dc-2dedce87882cn%40googlegroups.com.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/ABF8CCD4-BC7C-44E1-BA9F-CFB19B9F01DD%40gmail.com.


Re: [weewx-user] wee_reports picks up extensions.py delay

2021-06-29 Thread vince
On Tuesday, June 29, 2021 at 12:48:09 PM UTC-7 WindnFog wrote:

> It's nitpicking, but if I reboot my Pi, the server uptime is always 
> shorter than the weewx uptime.  I get things like:
>
> Weewx uptime:10 days, 1 hour, 38 minutes
> Server uptime: 10 days, 1 hour, 36 minutes
>

It does seem like nitpicking perhaps.
Is it really 'that' important to spend all this time worrying it ?

I did a trial on my pi4 with the simulator and see the same thing.  The 
weewx uptime is a minute more than the server uptime.  I'm guessing it has 
something to do with the order the threads get their brains straight but I 
didn't do much digging around.   If you want to look at the code, check out 
bin/weewx/station.py

If it bothers you that much, you could add a cron job that resets weewx a 
few minutes after reboot.
ref: https://www.tomshardware.com/how-to/run-script-at-boot-raspberry-pi

Perhaps a simple bash script ala "sleep 300 && systemctl restart weewx" or 
the like (untested).

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/b8bc0592-65ac-4e9c-a7dc-2dedce87882cn%40googlegroups.com.


Re: [weewx-user] wee_reports picks up extensions.py delay

2021-06-29 Thread WindnFog
How to do that?  I *honestly* searched the message board off and on for the 
last month, scoured the documentation, etc.  It's nitpicking, but if I 
reboot my Pi, the server uptime is always shorter than the weewx uptime.  I 
get things like:

Weewx uptime:10 days, 1 hour, 38 minutes
Server uptime: 10 days, 1 hour, 36 minutes

My workaround is, as soon as I can ssh in after boot, I run:

sudo /etc/init.d/weewx stop

Wait 4-5 minutes and run 

sudo /etc/init.d/weewx start

There has to be a better way . . . can one set a cron on that runs on boot, 
sleeps 5 minutes, and then starts weewx?  Is it waiting for ntp to set the 
time?  I dunno . . . 

- Paul VE1DX

On Saturday, February 27, 2021 at 12:09:39 PM UTC-4 tke...@gmail.com wrote:

> Unfortunately, wee_reports has to load extensions.py, because there might 
> be some user extensions in there, which it might need for the reports (for 
> example, an xtypes extension). So, whatever is in there, is going to get 
> executed.
>
> I no longer think an arbitrary 45 second sleep is such a good idea. The 
> engine already has something that causes it to wait until the time is 
> greater than the timestamp on weewx.conf, so that should give some measure 
> of protection against clock slew. But, the best way to approach the problem 
> is through systemd time synchronizations.
>
> If you really want to sleep, then it's probably best done with a WeeWX 
> extension that's bound to the STARTUP event.
>
>
>
> On Sat, Feb 27, 2021 at 7:56 AM WindnFog  wrote:
>
>> Here's an oddity.  To delay weewx from starting for 45 seconds after a 
>> reboot, I used Tom's 2019 suggestion of putting a delay of 45 in 
>> /usr/share/weewx/user/extensions.py . . . and this works well, except it 
>> also kicks in when you run wee_reports:
>>
>>
>>
>>
>>
>>
>>
>> *sudo wee_reports^CTraceback (most recent call last):  File 
>> "/usr/share/weewx/wee_reports", line 16, in import 
>> user.extensions  File "/usr/share/weewx/user/extensions.py", line 20, in 
>> time.sleep(45)KeyboardInterrupt*   <--- I ctrl-C'ed out of 
>> this after 25-30 seconds.
>>
>> Is there any way to change the code so that wee_reports doesn't execute 
>> the time.sleep(45) command?
>>
>> - Paul VE1DX
>>
>> -- 
>> 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/1c121d0d-e909-425e-b532-7d79fc2d9954n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/0ebbf740-3de8-40af-8ead-ca739dc6bb07n%40googlegroups.com.


Re: [weewx-user] wee_reports picks up extensions.py delay

2021-02-27 Thread Paul Dunphy
 Thanks for the quick reply, Tom.  This makes sense.  I had the 45 
seconds in there from some debugging 6-8 months ago and I really don't 
need it anymore.  Just removed it.


- Paul VE1DX

On 2021-02-27 12:09 p.m., Tom Keffer wrote:
Unfortunately, wee_reports has to load extensions.py, because there 
might be some user extensions in there, which it might need for the 
reports (for example, an xtypes extension). So, whatever is in there, 
is going to get executed.


I no longer think an arbitrary 45 second sleep is such a good idea. 
The engine already has something that causes it to wait until the time 
is greater than the timestamp on weewx.conf, so that should give some 
measure of protection against clock slew. But, the best way to 
approach the problem is through systemd time synchronizations.


If you really want to sleep, then it's probably best done with a WeeWX 
extension that's bound to the STARTUP event.




On Sat, Feb 27, 2021 at 7:56 AM WindnFog > wrote:


Here's an oddity.  To delay weewx from starting for 45 seconds
after a reboot, I used Tom's 2019 suggestion of putting a delay of
45 in /usr/share/weewx/user/extensions.py . . . and this works
well, except it also kicks in when you run wee_reports:

*sudo wee_reports
^CTraceback (most recent call last):
  File "/usr/share/weewx/wee_reports", line 16, in 
    import user.extensions
  File "/usr/share/weewx/user/extensions.py", line 20, in 
    time.sleep(45)
KeyboardInterrupt*   <--- I ctrl-C'ed out of this after 25-30 seconds.

Is there any way to change the code so that wee_reports doesn't
execute the time.sleep(45) command?

- Paul VE1DX
-- 
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+unsubscr...@googlegroups.com
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/weewx-user/1c121d0d-e909-425e-b532-7d79fc2d9954n%40googlegroups.com

.

--
You received this message because you are subscribed to a topic in the 
Google Groups "weewx-user" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/weewx-user/kMMYGq5gC6E/unsubscribe 
.
To unsubscribe from this group and all its topics, send an email to 
weewx-user+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEDqK-0aNM6SjaHYgx9eiAR465rTUotYYe6pJ-05-%3De0zQ%40mail.gmail.com 
.


--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/b9d0931c-5878-7ddf-8698-6c66e7ef61ae%40gmail.com.


Re: [weewx-user] wee_reports picks up extensions.py delay

2021-02-27 Thread Tom Keffer
Unfortunately, wee_reports has to load extensions.py, because there might
be some user extensions in there, which it might need for the reports (for
example, an xtypes extension). So, whatever is in there, is going to get
executed.

I no longer think an arbitrary 45 second sleep is such a good idea. The
engine already has something that causes it to wait until the time is
greater than the timestamp on weewx.conf, so that should give some measure
of protection against clock slew. But, the best way to approach the problem
is through systemd time synchronizations.

If you really want to sleep, then it's probably best done with a WeeWX
extension that's bound to the STARTUP event.



On Sat, Feb 27, 2021 at 7:56 AM WindnFog  wrote:

> Here's an oddity.  To delay weewx from starting for 45 seconds after a
> reboot, I used Tom's 2019 suggestion of putting a delay of 45 in
> /usr/share/weewx/user/extensions.py . . . and this works well, except it
> also kicks in when you run wee_reports:
>
>
>
>
>
>
>
> *sudo wee_reports^CTraceback (most recent call last):  File
> "/usr/share/weewx/wee_reports", line 16, in import
> user.extensions  File "/usr/share/weewx/user/extensions.py", line 20, in
> time.sleep(45)KeyboardInterrupt*   <--- I ctrl-C'ed out of
> this after 25-30 seconds.
>
> Is there any way to change the code so that wee_reports doesn't execute
> the time.sleep(45) command?
>
> - Paul VE1DX
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/1c121d0d-e909-425e-b532-7d79fc2d9954n%40googlegroups.com
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEDqK-0aNM6SjaHYgx9eiAR465rTUotYYe6pJ-05-%3De0zQ%40mail.gmail.com.


[weewx-user] wee_reports picks up extensions.py delay

2021-02-27 Thread WindnFog
Here's an oddity.  To delay weewx from starting for 45 seconds after a 
reboot, I used Tom's 2019 suggestion of putting a delay of 45 in 
/usr/share/weewx/user/extensions.py . . . and this works well, except it 
also kicks in when you run wee_reports:







*sudo wee_reports^CTraceback (most recent call last):  File 
"/usr/share/weewx/wee_reports", line 16, in import 
user.extensions  File "/usr/share/weewx/user/extensions.py", line 20, in 
time.sleep(45)KeyboardInterrupt*   <--- I ctrl-C'ed out of this 
after 25-30 seconds.

Is there any way to change the code so that wee_reports doesn't execute the 
time.sleep(45) command?

- Paul VE1DX

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/1c121d0d-e909-425e-b532-7d79fc2d9954n%40googlegroups.com.