Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timezone with half an hour? #2684

Closed
OmgImAlexis opened this issue May 10, 2018 · 9 comments
Closed

Timezone with half an hour? #2684

OmgImAlexis opened this issue May 10, 2018 · 9 comments

Comments

@OmgImAlexis
Copy link

Is there currently any way to set a timezone with 30 min increments?
I live in South Australia which uses +930/+1030 depending on DST.

@Jason2866
Copy link
Collaborator

See #1192

@OmgImAlexis
Copy link
Author

OmgImAlexis commented May 11, 2018

I tried that and it doesn't seem to be working.
The current time should be 9:52AM on the 11th of May 2018.

02:21:28 MQT: home/alexis/dht/LWT = Online (retained)
02:21:28 MQT: home/alexis/dht/cmnd/POWER = 
02:21:28 MQT: Subscribe to home/alexis/dht/cmnd/#
02:21:28 MQT: home/alexis/dht/INFO1 = {"Module":"Generic","Version":"5.13.1a","FallbackTopic":"DVES_114FF8","GroupTopic":"sonoffs"}
02:21:28 MQT: home/alexis/dht/INFO2 = {"WebServerMode":"Admin","Hostname":"sensor-4088","IPAddress":"192.168.2.10"}
02:21:28 MQT: home/alexis/dht/INFO3 = {"RestartReason":"External System"}
02:21:36 MQT: home/alexis/dht/STATE = {"Time":"2018-05-11T02:21:36","Uptime":"0T00:00:13","Vcc":3.065,"Wifi":{"AP":1,"SSId":"Bella","RSSI":96,"APMac":"C8:BC:C8:DC:2C:5A"}}
02:21:36 DHT: Received 02, 5D, 00, 96, F5 =? F5
02:21:36 MQT: home/alexis/dht/SENSOR = {"Time":"2018-05-11T02:21:36","AM2301":{"Temperature":15.0,"Humidity":60.5},"TempUnit":"C"} (retained)
02:21:48 WIF: Checking connection...
02:21:48 WIF: Connected
02:21:51 CMD: timezone
02:21:51 RSL: Received Topic /timezone, Data Size 0, Data 
02:21:51 RSL: Group 0, Index 1, Command TIMEZONE, Data 
02:21:51 MQT: home/alexis/dht/RESULT = {"Timezone":99}

@ascillato
Copy link
Contributor

ascillato commented May 11, 2018

Hi,

I tested your case and works without problems.

I just change on user_config.h file the following:

// -- Time - Start Daylight Saving Time and timezone offset from UTC in minutes
#define TIME_DST  South, First, Sun, Oct, 2, +630

// -- Time - Start Standard Time and timezone offset from UTC in minutes
#define TIME_STD  South, First, Sun, Apr, 3, +570

I compile it and flash to a Sonoff.

Then, on the console I write timezone 99.

Console Output:

00:00:02 WIF: Intentando conectar...
00:00:03 WIF: Probando conección...
00:00:03 WIF: Conectado
00:00:03 HTP: Servidor web activo en sonoff-1757 con dirección IP 192.168.1.2
00:00:03 KNX: Iniciar
00:00:03 HTP: Consola
00:00:04 RSL: INFO1 = {"Module":"Generic","Version":"5.13.1a","FallbackTopic":"DVES_F7A6DD","GroupTopic":"sonoffs"}
00:00:04 RSL: INFO2 = {"WebServerMode":"Admin","Hostname":"sonoff-1757","IPAddress":"192.168.1.2"}
00:00:04 RSL: INFO3 = {"RestartReason":"External System"}
00:00:06 RSL: RESULT = {"POWER":"OFF"}
00:00:06 RSL: POWER = OFF
00:00:10 APP: (UTC) Fri May 11 03:22:00 2018, (DST) Sun Oct 07 02:00:00 2018, (STD) Sun Apr 01 03:00:00 2018
13:52:03 RSL: STATE = {"Time":"2018-05-11T13:52:03","Uptime":"0T00:00:12","Vcc":2.785,"POWER":"OFF","Wifi":{"AP":1,"SSId":"NetWireless","RSSI":70,"APMac":"18:D6:C7:80:38:2C"}}
13:52:16 WIF: Probando conección...
13:52:16 WIF: Conectado

Time checked also using the website https://24timezones.com/

Your location has UTC +10h 30m, so if UTC=03:22:00, your time=13:52:00

Your DST is +10h30m = +630minutes

Please, use the above settings on the file user_config.h

Hope this solve your issue.

@OmgImAlexis
Copy link
Author

Okay that's the issue. I was adding +9.5 not +930. My bad.

@OmgImAlexis
Copy link
Author

So I still can't get this to work.

I'm not currently in DST time yet when I change TIME_STD nothing happens but if I change TIME_DST the time updates.

Even if I set the TIME_STD to 0 it won't change.

// -- Time - Start Daylight Saving Time and timezone offset from UTC in minutes
#define TIME_DST  South, First, Sun, Oct, 2, +570

// -- Time - Start Standard Time and timezone offset from UTC in minutes
#define TIME_STD  South, First, Sun, Apr, 3, +510

@OmgImAlexis OmgImAlexis reopened this May 11, 2018
@OmgImAlexis
Copy link
Author

OmgImAlexis commented May 11, 2018

My timezone is +930 normally with +1030 in DST. I'm also in the southern hemisphere.

According to Wikipedia my DST starts on the first Sunday in October and ends on the first Sunday in April.

@ascillato
Copy link
Contributor

ascillato commented May 12, 2018

Hi,

You are right! It is giving wrong time for you.

Looking at https://24timezones.com/world_directory/time_in_adelaide.php:

image

  • We can make the following config:
// -- Time - Start Daylight Saving Time and timezone offset from UTC in minutes
#define TIME_DST  South, First, Sun, Oct, 2, +630     // ( 630 minutes / 60 minutes ) = +10.5 hours

// -- Time - Start Standard Time and timezone offset from UTC in minutes
#define TIME_STD  South, First, Sun, Apr, 3, +570      // ( 570 minutes / 60 minutes ) = +9.5 hours

Results in:

00:00:06 APP: (UTC) Sat May 12 00:21:06 2018, (DST) Sun Oct 07 02:00:00 2018, (STD) Sun Apr 01 03:00:00 2018
10:51:12 RSL: STATE = {"Time":"2018-05-12T10:51:12","Uptime":"0T00:00:12","Vcc":2.788,"POWER":"OFF","Wifi":{"AP":1,"SSId":"NetWireless","RSSI":36,"APMac":"18:D6:C7:80:38:2C"}}
10:51:47 WIF: Checking connection...
10:51:47 WIF: Connected

UTC (00:21) + STD (+9.5hs) = 09:51

But it is resulting in 10:51. That is wrong. It is using DST instead of STD. Should be using STD (starting on 1 APR)


Let's test another country from the Southern Hemisphere:
As Argentina don't use DST and STD, I can not put that as example but looking at Chile, they have DST and STD.

image

  • We can make the following config:
// -- Time - Start Daylight Saving Time and timezone offset from UTC in minutes
#define TIME_DST  South, Second, Sun, Aug, 0, -180     // ( 180 minutes / 60 minutes ) = -3 hours

// -- Time - Start Standard Time and timezone offset from UTC in minutes
#define TIME_STD  South, Second, Sun, May, 0, -240      // ( 240 minutes / 60 minutes ) = -4 hours

Results in:

00:00:06 APP: (UTC) Sat May 12 01:51:06 2018, (DST) Sun Aug 12 00:00:00 2018, (STD) Sun May 13 00:00:00 2018
22:51:14 RSL: STATE = {"Time":"2018-05-11T22:51:14","Uptime":"0T00:00:14","Vcc":2.784,"POWER":"OFF","Wifi":{"AP":1,"SSId":"NetWireless","RSSI":60,"APMac":"18:D6:C7:80:38:2C"}}
22:51:27 WIF: Checking connection...
22:51:27 WIF: Connected

UTC (01:51) + DST (-3hs) = 22:51

And it is correct. Chile is using DST now.

So, @arendst can you look at this?

ascillato added a commit to ascillato/Tasmota_KNX that referenced this issue May 13, 2018
Fix issue arendst#2684 DST and STD times for Southern Hemisphere
@ascillato
Copy link
Contributor

ascillato commented May 13, 2018

Today Chile changed from DST to STD. But testing Tasmota on a Sonoff stays on DST. Is not correct.

Found that the code that checks for DST and STD for Southern Hemisphere had a bug on RTCSecond() routine in support.ino file

Made the PR #2714 to fix this.

Tested new code with settings for Australia, Chile and Netherlands and works fine.


Chile Example, Tasmota's console:

Sonoff without the proposed fix:

23:59:34 WIF: Probando conección...
23:59:34 WIF: Conectado
23:59:56 WIF: Probando conección...
23:59:56 WIF: Conectado
00:00:18 WIF: Probando conección...
00:00:18 WIF: Conectado
00:00:41 WIF: Probando conección...
00:00:41 WIF: Conectado
00:00:50 RSL: STATE = {"Time":"2018-05-13T00:00:50","Uptime":"0T00:43:47","Vcc":2.784,"POWER":"OFF","Wifi":{"AP":1,"SSId":"NetWireless","RSSI":56,"APMac":"18:D6:C7:80:38:2C"}}
00:01:03 WIF: Probando conección...
00:01:03 WIF: Conectado
00:01:24 WIF: Probando conección...
00:01:24 WIF: Conectado
00:01:42 APP: (UTC) Sun May 13 03:01:42 2018, (DST) Sun Aug 12 00:00:00 2018, (STD) Sun May 13 00:00:00 2018
00:01:46 WIF: Probando conección...
00:01:46 WIF: Conectado
00:02:01 RSL: UPTIME = {"Time":"2018-05-13T00:02:01","Uptime":"0T00:44:58"}
00:02:08 WIF: Probando conección...
00:02:08 WIF: Conectado

Another Sonoff with the proposed fix:

(time equal to https://24timezones.com/world_directory/time_in_santiago.php)

23:59:37 WIF: Probando conección...
23:59:37 WIF: Conectado
23:59:59 WIF: Probando conección...
23:59:59 WIF: Conectado
23:00:13 MQT: tele/living/STATE = {"Time":"2018-05-12T23:00:13","Uptime":"0T00:43:38","Vcc":2.696,"POWER":"OFF","Wifi":{"AP":2,"SSId":"NetWireless","RSSI":62,"APMac":"18:D6:C7:80:38:2C"}}
23:00:20 WIF: Probando conección...
23:00:20 WIF: Conectado
23:00:42 WIF: Probando conección...
23:00:42 WIF: Conectado
23:01:04 WIF: Probando conección...
23:01:04 WIF: Conectado
23:01:25 WIF: Probando conección...
23:01:25 WIF: Conectado
23:01:42 APP: (UTC) Sun May 13 03:01:42 2018, (DST) Sun Aug 12 00:00:00 2018, (STD) Sun May 13 00:00:00 2018
23:01:47 WIF: Probando conección...
23:01:47 WIF: Conectado
23:02:00 MQT: tele/living/UPTIME = {"Time":"2018-05-12T23:02:00","Uptime":"0T00:45:25"}
23:02:09 WIF: Probando conección...
23:02:09 WIF: Conectado

@ascillato
Copy link
Contributor

Hi @OmgImAlexis

The fix was applied. Please, test it again.

And if the problem is solved for you, please close this issue. Thanks.

curzon01 pushed a commit to curzon01/Tasmota that referenced this issue Sep 7, 2018
Fix issue arendst#2684 DST and STD times for Southern Hemisphere
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants