Issues with Tweet timings

16 views
Skip to first unread message

pco...@suremail.gg

unread,
Jun 19, 2021, 3:14:54 PM6/19/21
to py...@googlegroups.com
Hi Jim and the group,

After setting up a new SD card with the latest pywws, my Tweets are going out, but one hour behind.
They're due to go out each hour, on the hour, which they are doing, but one hour behind.

The date & time in the Pi is correct (typing DATE in at the command prompt) and the base station date and time are correct.

I'm clearly missing something, but I cannot work out what.

Any thoughts as to where to look?

Kind regards

Phil Cooper
Guernsey

Jim Easterbrook

unread,
Jun 20, 2021, 4:34:50 AM6/20/21
to 'pcooper@suremail.gg' via pywws
On 19/06/2021 20:14, 'pco...@suremail.gg' via pywws wrote:
>
> After setting up a new SD card with the latest pywws, my Tweets are going out, but one hour behind.
> They're due to go out each hour, on the hour, which they are doing, but one hour behind.
>
> The date & time in the Pi is correct (typing DATE in at the command prompt) and the base station date and time are correct.
>
> I'm clearly missing something, but I cannot work out what.
>
> Any thoughts as to where to look?

Check the timezone (the output of 'date' should contain it, e.g. "Sun 20
Jun 09:32:58 BST 2021").

Check your tweet template has a #timezone local# directive.

--
Jim Easterbrook <http://www.jim-easterbrook.me.uk/>

pco...@suremail.gg

unread,
Jun 20, 2021, 8:55:59 AM6/20/21
to py...@googlegroups.com
Hi Jim,

And thanks for the response.

Typing DATE into the command line produces the correct display, just your format shows.

In the Tweet template for Tweet.txt it shows the following:

#hourly#
#timezone local#
#roundtime True#
#calc "(data['idx'] + timedelta(minutes=10)).replace(minute=0)" "%H:00 %Z:"#
Temp: #temp_out "%.1f°C" "-"#
,
Wind: #wind_dir "%s, " "" "winddir_text(x)"#
#wind_ave "%.0f kts (ave), " "" "wind_kn(x)"#
#wind_gust "%.0f kts (gust)" "" "wind_kn(x)"#
,
Humidity: #hum_out "%d%%"#
,
Rain (hourly) #rain "%.1f mm"#
,
Pressure: #rel_pressure "%.0f hPa, "#
#pressure_trend "%s" "" "pressure_trend_text(x)"#

So it does have the timezone local set.

I can't find anything else to check...

Regards

Phil Cooper

--
You received this message because you are subscribed to the Google Groups "pywws" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pywws+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pywws/b8cca5c5-544f-cbc2-bb8b-6954075b95c8%40jim-easterbrook.me.uk.


Tony Gilbert

unread,
Jun 20, 2021, 9:31:29 AM6/20/21
to py...@googlegroups.com
Well I'm pretty sure it won't be this,  but just in case ...

Is it possible that you are checking DATE and tz as - say - the pi user, but running pywws as the pywws user (or some similar pair) where the tz is set differently?

Cheers
Tony

pco...@suremail.gg

unread,
Jun 20, 2021, 9:39:10 AM6/20/21
to py...@googlegroups.com
Hi Tony,

I don't think so, but where/how to check that?

I've checked the base station for time & date, and it shows the TZ as 0, which is what I would expect.

Cheers

Phil Cooper

Cheers
Tony

> https://groups.google.com/d/msgid/pywws/1624193757.92223875%40webmail.sure.com
> .
>

--
You received this message because you are subscribed to the Google Groups "pywws" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pywws+un...@googlegroups.com.

To view this discussion on the web, visit https://groups.google.com/d/msgid/pywws/CAAjkP6dN_2vrvLYWtO-Hb-PpLH8t9QGEL7cTWaG17reO66_vDA%40mail.gmail.com.


polc1410

unread,
Jun 20, 2021, 10:10:26 AM6/20/21
to pywws
I may be wrong, but I think that what you are describing is "normal".

You are tweeting ON THE HOUR.  So at 9am exactly, the code is run.  The code calls the last hour of weather data.

It looks like you are adding 10 minutes to your idx data (its been a while since i messed with my templates so forgive me if I'm wrong.  But then replacing the minutes with a 00.  So if the data is from 08:55 it will become 09:05 and report as 09:00 which I guess is where you are aiming.  If however, your last data point was saved at 08:49, this will now be 08:59 and print as 08:00 making it appear an hour behind.

The solutions are either to reduce the logging interval to be less than 10 minutes OR increase the 10 minutes to say 30 minutes.

pco...@suremail.gg

unread,
Jun 20, 2021, 12:01:22 PM6/20/21
to py...@googlegroups.com
Hello (name?)

OK, I can see that may cause some issues, so I have changed it to 00 to see what happens on the next hour.

It may well be that my WiFi connection is busy when it goes to Tweet, so there could be a delay between assembling the Tweet and it getting posted.

The idea was to Tweet the weather for the PAST hour, on the hour, so at - say - 0900, it would Tweet at 0900 with a time stamp of 0900, not 0800.

Will test this out and see what happens.

Thanks for the pointer

Regards

Phil

-----Original Message-----
From: "polc1410" <goo...@wittongilbert.free-online.co.uk>
Sent: Sunday, 20 June, 2021 15:10
To: "pywws" <py...@googlegroups.com>
Subject: Re: [pywws] Issues with Tweet timings

--

You received this message because you are subscribed to the Google Groups "pywws" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pywws+un...@googlegroups.com.

To view this discussion on the web, visit https://groups.google.com/d/msgid/pywws/1dc627b8-0c89-48d7-8a4d-4ffeea0990d4n%40googlegroups.com.


pco...@suremail.gg

unread,
Jun 20, 2021, 1:05:02 PM6/20/21
to py...@googlegroups.com
Hi all,

I've just done a python -m pywws.timezone command at around 17:56BST, and this is the result:
Local time zone: Europe/London
UTC time: 2021-06-20 16:56:05
Local time: 2021-06-20 17:56:05+01:00 (BST)

most recent 9am 2021-06-20 08:00:00 UTC
most recent 9pm 2021-06-19 20:00:00 UTC

Convert local to UTC around DST transition
2021-03-28 00:15:00 -> 2021-03-28 00:15:00
2021-03-28 01:15:00 -> 2021-03-28 01:15:00
2021-03-28 02:15:00 -> 2021-03-28 01:15:00
2021-03-28 03:15:00 -> 2021-03-28 02:15:00

Convert UTC to local around DST transition
2021-03-27 23:15:00 -> 2021-03-27 23:15:00+00:00 (GMT)
2021-03-28 00:15:00 -> 2021-03-28 00:15:00+00:00 (GMT)
2021-03-28 01:15:00 -> 2021-03-28 02:15:00+01:00 (BST)
2021-03-28 02:15:00 -> 2021-03-28 03:15:00+01:00 (BST)

Convert local to UTC around DST transition
2020-10-24 23:15:00 -> 2020-10-24 22:15:00
2020-10-25 00:15:00 -> 2020-10-24 23:15:00
2020-10-25 01:15:00 -> 2020-10-25 01:15:00
2020-10-25 02:15:00 -> 2020-10-25 02:15:00

Convert UTC to local around DST transition
2020-10-24 23:15:00 -> 2020-10-25 00:15:00+01:00 (BST)
2020-10-25 00:15:00 -> 2020-10-25 01:15:00+01:00 (BST)
2020-10-25 01:15:00 -> 2020-10-25 01:15:00+00:00 (GMT)
2020-10-25 02:15:00 -> 2020-10-25 02:15:00+00:00 (GMT)
==========================
Is there anything in that which may point to the hour out?

Cheers

Phil Cooper


-----Original Message-----
From: "Jim Easterbrook" <j...@jim-easterbrook.me.uk>
Sent: Sunday, 20 June, 2021 09:35

To: "'pco...@suremail.gg' via pywws" <py...@googlegroups.com>
Subject: Re: [pywws] Issues with Tweet timings

--

You received this message because you are subscribed to the Google Groups "pywws" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pywws+un...@googlegroups.com.

To view this discussion on the web, visit https://groups.google.com/d/msgid/pywws/b8cca5c5-544f-cbc2-bb8b-6954075b95c8%40jim-easterbrook.me.uk.


polc1410

unread,
Jun 20, 2021, 4:02:01 PM6/20/21
to pywws
On Sunday, 20 June 2021 at 18:05:02 UTC+1 pco...@suremail.gg wrote:

I've just done a python -m pywws.timezone command at around 17:56BST, and this is the result:
Local time zone: Europe/London
UTC time: 2021-06-20 16:56:05
Local time: 2021-06-20 17:56:05+01:00 (BST)


I think that all looks fine.

What would be useful would be:

tail ~/weather/data/hourly/2021/2021-06/2021-06-20.txt

(obviously change the path as necessary and the date)

Along with the tweet that was produced

gu0sup

unread,
Jun 20, 2021, 5:26:55 PM6/20/21
to py...@googlegroups.com

Hello,

 

I’ll try that tomorrow when I have some more time, and then let you know the result.

 

Thanks

 

Phil

 

 

From: py...@googlegroups.com [mailto:py...@googlegroups.com] On Behalf Of polc1410
Sent: 20 June 2021 21:02
To: pywws
Subject: Re: [pywws] Issues with Tweet timings

 

 

On Sunday, 20 June 2021 at 18:05:02 UTC+1 pco...@suremail.gg wrote:

--

You received this message because you are subscribed to the Google Groups "pywws" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pywws+un...@googlegroups.com.

pco...@suremail.gg

unread,
Jun 21, 2021, 6:26:00 AM6/21/21
to py...@googlegroups.com, py...@googlegroups.com
Hi all,

OK, the problem is solved!

In conversation with my son (@BtonWeatherPi), who runs the same setup, we discovered that my weather station was reporting the weather at 38 minutes past each hour.
Therefore, the line that has this:


#calc "(data['idx'] + timedelta(minutes=10)).replace(minute=0)" "%H:00 %Z:"#

was adding 10 minutes to the recorded time (xx:38) and adding 10 minutes, which was still short of the next hour.

He suggested changing that to:
#calc "(data['idx'] + timedelta(minutes=25)).replace(minute=0)" "%H:00 %Z:"#
which takes it past the next hour, and I can report that it is now Tweeting on the correct hour! (@GSY_Weather)

Thanks to all for the suggestions....

Jim, maybe something to add on your page as something to check?

Cheers all

Phil Cooper

Hello,

Thanks

Phil

tail ~/weather/data/hourly/2021/2021-06/2021-06-20.txt

To view this discussion on the web, visit https://groups.google.com/d/msgid/pywws/663e9ab8-416e-451a-947a-edb915be7eean%40googlegroups.com <https://groups.google.com/d/msgid/pywws/663e9ab8-416e-451a-947a-edb915be7eean%40googlegroups.com?utm_medium=email&utm_source=footer> .

--
You received this message because you are subscribed to the Google Groups "pywws" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pywws+un...@googlegroups.com.

To view this discussion on the web, visit https://groups.google.com/d/msgid/pywws/003001d7661a%24fd4158a0%24f7c409e0%24%40suremail.gg.


Jim Easterbrook

unread,
Jun 21, 2021, 6:37:48 AM6/21/21
to 'pcooper@suremail.gg' via pywws
On 21/06/2021 11:25, 'pco...@suremail.gg' via pywws wrote:
>
> OK, the problem is solved!
>
> In conversation with my son (@BtonWeatherPi), who runs the same setup, we discovered that my weather station was reporting the weather at 38 minutes past each hour.

Have you set the station logging interval to 5 minutes, as recommended
in the documentation?
https://pywws.readthedocs.io/en/latest/guides/getstarted.html#set-the-weather-station-logging-interval

pco...@suremail.gg

unread,
Jun 21, 2021, 12:51:47 PM6/21/21
to py...@googlegroups.com
Hi Jim,

Well, I thought it was, but looking at the raw data, it appears to only be logging half-hourly, so I have issued the command again.

I will see what happens now.

Kind regards
Phil Cooper

-----Original Message-----
From: "Jim Easterbrook" <j...@jim-easterbrook.me.uk>
Sent: Monday, 21 June, 2021 11:38
To: "'pco...@suremail.gg' via pywws" <py...@googlegroups.com>

--

You received this message because you are subscribed to the Google Groups "pywws" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pywws+un...@googlegroups.com.

To view this discussion on the web, visit https://groups.google.com/d/msgid/pywws/005fe840-6c1a-9f76-f934-2499eb90c17a%40jim-easterbrook.me.uk.


Reply all
Reply to author
Forward
0 new messages