Light relay turn on with sunset and turn off with sunrise

Ok for me. Maybe just browser cache issue.

Cache cleared, all good now thanks.

@Costas
today i tried to run your sketch on my nodeMCU but i received many errors.
because i am not a programmer and i left C & C++ 40 years ago I don’t know how to correct errors.
so please tell me what I am missing here.
thanks.

Build options changed, rebuilding all
In file included 
                from C:\Users\jo\Documents\Arduino\libraries\Blynk\src/WidgetLED.h:13:0,

                 from C:\Users\jo\Documents\Arduino\libraries\Blynk\src/BlynkWidgets.h:10,

                 from C:\Users\jo\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266.h:94,

                 from C:\Users\jo\Documents\Arduino\LEARN & TEST\Time_Input_widget_with_Output\Time_Input_widget_with_Output.ino:11:

C:\Users\jo\Documents\Arduino\LEARN & TEST\Time_Input_widget_with_Output\Time_Input_widget_with_Output.ino: In function 'void BlynkWidgetWrite0(BlynkReq&, const BlynkParam&)':

C:\Users\jo\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkWidgetBase.h:50:33: error: 'class WidgetRTC' has no member named 'onWrite'

     BLYNK_WRITE(pin) { (widget).onWrite(request, param); }

                                 ^

C:\Users\jo\Documents\Arduino\LEARN & TEST\Time_Input_widget_with_Output\Time_Input_widget_with_Output.ino:20:1: note: in expansion of macro 'BLYNK_ATTACH_WIDGET'

 BLYNK_ATTACH_WIDGET(rtc, V0);

 ^

C:\Users\jo\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkWidgetBase.h: In instantiation of 'BlynkAttachWidgetHelper::BlynkAttachWidgetHelper(T&, uint8_t) [with T = WidgetRTC; uint8_t = unsigned char]':

C:\Users\jo\Documents\Arduino\LEARN & TEST\Time_Input_widget_with_Output\Time_Input_widget_with_Output.ino:20:1:   required from here

C:\Users\jo\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkWidgetBase.h:43:9: error: 'class WidgetRTC' has no member named 'setVPin'

         widget.setVPin(vPin);

         ^

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

The RTC widget was changed a couple of months ago. It no longer uses a virtual pin.

Remove this line:

BLYNK_ATTACH_WIDGET(rtc, V0);

@Costas
Thanks a lot Costas
I test it, Working Great
my best Regards.

@Dmitriy

Negative and Positive Time zone offset for the sketch “Time Input widget on V1” needs revision.

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

Which sketch is giving you this data?

Is that iOs or Android?

Sketch in the First Post
or
Here

Android

I just tested it on IOS same results

Sunrise / Sunset Arduino example HERE

@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

@Costas @Ze_Pico could you please check simple mode for TimeInput is it ok? param.asInt(4)