Is that iOs or Android?
Android
I just tested it on IOS same results
@Ze_Pico we use Nick Gammon’s SunriseSunset sketch. Nice and simple plus Nick G is an Arduino god.
If I get some time, no pun intended, I will look at your tz offset anomaly. Is it just +12 hours that has the error? My understanding is that there are something like 25 tz hours in a day ranging from -11 to +14, rather than -12 to +12.
@Costas
yes, TZ range is from +14 to -12 in this sketch ,and the problem is in -negative Region.
Start at sunset
Stop at sunrise
Time zone: Pacific/Kiritimati
Time zone offset: 14 Hour(s) ---> Positive TZ (+14)
Day 1 is selected
Day 7 is selected
Start at sunset
Stop at sunrise
Time zone: US/Samoa
Time zone offset: 1193035 Hour(s) ---> Negative TZ (-12)
Day 1 is selected
Day 7 is selected
also in Nick Gammon’s Sunrise Sunset sketch 4 inputs are required and they all affect the result.
/* TimeLord Object Initialization */
myLord.TimeZone(TIMEZONE * 60);
myLord.Position(LATITUDE, LONGITUDE);
myLord.DstRules(3,2,11,1,60); // DST Rules for USA
byte today[] = { 0, 0, 12, 6, 3, 2017 }; // store today's date (at noon) in an array for TimeLord to use
/* second 0, minute 1, hour 2, day 3, month 4, year 5 */
about your sketch with Sunrise and Sunset I got same result for all Time Zones.
" Motor STARTED at 1193046:28"
" Motor STOPPED at 1193046:28"
Checked schedule at: 23:59:48
ToDAY Is : 06/03/2017
Schedule ACTIVE today
Time zone: Europe/Nicosia ---> here Nicosia in Europe
Time zone offset: 2 Hour(s)
Day 1 is selected
Day 7 is selected
Motor STARTED at 1193046:28
Motor STOPPED at 1193046:28
Checked schedule at: 00:08:47
ToDAY Is : 07/03/2017
Schedule ACTIVE today
Time zone: Asia/Nicosia ---> here Nicosia in Asia
Time zone offset: 2 Hour(s)
Day 1 is selected
Day 2 is selected
Day 7 is selected
Motor STARTED at 1193046:28
Motor STOPPED at 1193046:28
but a few posts back GMT-12 looked ok and the problem was GMT+12?
@Costas
That’s what you see on your serial printer for this region but actually on BLYNK application
Time Zone is “(GMT+12:00)Etc/GMT-12”
Start at sunset
Stop at sunrise
Time zone: Etc/GMT-12
Time zone offset: 12 Hour(s)
Day 6 is selected
Day 7 is selected
Start at sunset
Stop at sunrise
Time zone: Etc/GMT+12
Time zone offset: 1193034 Hour(s)
Day 6 is selected
Day 7 is selected
@Dmitriy all time behind GMT looks to give some “overflow” for tz offset. Happens with / without sunset / sunrise selected. First entry is for GMT +14 which is fine but can’t find any GMT -X that shows correct offset. My overlfow is different to @Ze_Pico because I’m using an ESP not an Arduino.
Start at sunrise
Stop at sunset
Time zone: Pacific/Kiritimati
Time zone offset: 50400
Day 1 is selected
Day 7 is selected
Start at sunrise
Stop at sunset
Time zone: US/Samoa
Time zone offset: 4294927696
Day 1 is selected
Day 7 is selected
Start at sunrise
Stop at sunset
Time zone: Etc/GMT+12
Time zone offset: 4294924096
Day 1 is selected
Day 7 is selected
Start at sunrise
Stop at sunset
Time zone: America/Scoresbysund
Time zone offset: 4294963696
Day 1 is selected
Day 7 is selected
Start at sunrise
Stop at sunset
Time zone: America/Argentina/Salta
Time zone offset: 4294956496
Day 1 is selected
Day 7 is selected
Start at sunrise
Stop at sunset
Time zone: Brazil/West
Time zone offset: 4294952896
Day 1 is selected
Day 7 is selected
Thanks, We’ll check.
@Ze_Pico not sure why you are showing offset in hours when I see offset in seconds.
Any ideas @Dmitriy ?
@Costas
I’m using ESP8266 too.
the difference is that i divided by 3600 to get it in hours
Time zone: Pacific/Kiritimati
Time zone offset: 50400/3600 =14
@Ze_Pico Ah, ok. The temporary fix for seconds is:
Brazil = 4294952896
Mnus 2 to the power 32 = -4294967296
= -14400
= -4 hours
@Dmitriy
your choice was for the simple time input where there is no time zone
but here we are discussing the advance time input sketch.
BLYNK_WRITE(V1) {
TimeInputParam t(param);
// Process start time
if (t.hasStartTime())
{
Serial.println(String("Start: ") +
t.getStartHour() + ":" +
t.getStartMinute() + ":" +
t.getStartSecond());
}
else if (t.isStartSunrise())
{
Serial.println("Start at sunrise");
}
else if (t.isStartSunset())
{
Serial.println("Start at sunset");
}
else
{
// Do nothing
}
// Process stop time
if (t.hasStopTime())
{
Serial.println(String("Stop: ") +
t.getStopHour() + ":" +
t.getStopMinute() + ":" +
t.getStopSecond());
}
else if (t.isStopSunrise())
{
Serial.println("Stop at sunrise");
}
else if (t.isStopSunset())
{
Serial.println("Stop at sunset");
}
else
{
// Do nothing: no stop time was set
}
// Process timezone
// Timezone is already added to start/stop time
Serial.println(String("Time zone: ") + t.getTZ());
// Get timezone offset (in seconds)
Serial.print(String("Time zone offset: ") + t.getTZ_Offset()/3600);
Serial.println(String(" Hour(s)"));
// Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)
for (int i = 1; i <= 7; i++) {
if (t.isWeekdaySelected(i)) {
Serial.println(String("Day ") + i + " is selected");
}
}
Serial.println();
}
thanks, you are correct.
Should work now on master branch
@vshymanskyy
hi,
same as before
on local and cloud servers
“simple time input” is OK but not the “advance time input” sketch.
[19553] Ready (ping: 0ms).
Start at sunrise
Stop at sunrise
Time zone: Pacific/Samoa
Time zone offset: 4294927696
Day 4 is selected