So, for example Arizona, USA, does NOT ever change time so that would be a location to enter time.setup(zone,0) whereas Utah, USA DOES follow DST so there you would enter time.setup(-7,1).
Too bad it does NOT work
dwight
Explore... Chat... Share...
Moderator: Mmiscool
void checkDayLight() {
//Check Daylight - CET/CEST (March to October)
if(weekday() == 1 && month() == 3 && day()>=25 && day()<=31 && hour()==2 && !DST){
setTime((now()+3600));
DST = true;
}else if( month() >= 4 && month() <= 9 && !DST){
setTime((now()+3600));
DST = true;
}else if( month() == 10 && day() < 25 && !DST){
setTime((now()+3600));
DST = true;
}
if(weekday()==1 && month()==10 && day()>=25 && day()<=31 && hour()==3 && DST){
DST = false;
}
}
[calculate_DST]
dow = time("dow")
day = time("day")
month = time("month")
hour = time("hour")
if ((DST = 1) and (dow = "Sun") and (month = "Nov") and (day >= 1) and (day < 8)) then
DST = 0
write(DaylightSavings,str(DST))
endif
if ((DST = 0) and (dow = "Sun") and (month = "Mar") and (day >=8) and (day < 15)) then
DST = 1
write(DaylightSavings,str(DST))
endif
return
'================================================
'--- DST Calc (dec1 dow,dec2 mth,dec2 date) ---
'================================================
dstcalc:
dst = 1 'covers Apr, May, Jun, Jul, Aug, Sep, Oct
If mth=01 then dst = 0 'Jan
If mth=02 then dst = 0 'Feb
If mth=12 then dst = 0 'Dec
March:
if mth=03 then 'March
if date <8 then
dst=0
elseif (date>7 and date<15) and dow=1 and hours<2 then
dst=0
elseif (date=8 and dow>1) then
dst=0
elseif (date=9 and dow>2) then
dst=0
elseif (date=10 and dow>3) then
dst=0
elseif (date=11 and dow>4) then
dst=0
elseif (date=12 and dow>5) then
dst=0
elseif (date=13 and dow>6) then
dst=0
endif
endif
November:
if mth=11 then 'November
if date >7 then
dst=0
elseif (date <8 and dow=1) and hours>1 then
dst=0
elseif (date=2 and dow<3) then
dst=0
elseif (date=3 and dow<4) then
dst=0
elseif (date=4 and dow<5) then
dst=0
elseif (date=5 and dow<6) then
dst=0
elseif (date=6 and dow<7) then
dst=0
endif
endif
return
'===========================================
[gettime]
bla = time()
dy = mid(bla,1,3) 'dow
mh = mid(bla,5,3) 'month
dd = mid(bla,9,2) 'date
hh = mid(bla,12,2) 'hour
mm = mid(bla,15,2) 'min
ss = mid(bla,18,2) 'sec
yr = mid(bla,21,4) 'year
'
if dy == "Sun" then dow = "1/"
if dy == "Mon" then dow = "2/"
if dy == "Tue" then dow = "3/"
if dy == "Wed" then dow = "4/"
if dy == "Thu" then dow = "5/"
if dy == "Fri" then dow = "6/"
if dy == "Sat" then dow = "7/"
'
if mh == "Jan" then mth = "01/"
if mh == "Feb" then mth = "02/"
if mh == "Mar" then mth = "03/"
if mh == "Apr" then mth = "04/"
if mh == "May" then mth = "05/"
if mh == "Jun" then mth = "06/"
if mh == "Jul" then mth = "07/"
if mh == "Aug" then mth = "08/"
if mh == "Sep" then mth = "09/"
if mh == "Oct" then mth = "10/"
if mh == "Nov" then mth = "11/"
if mh == "Dec" then mth = "12/"
'
picout = dow & mth
picout = picout & dd
picout = picout & "/"
picout = picout & hh
picout = picout & mm
picout = picout & ss
'
serialprint picout
return
It takes about 20-25 seconds for home assistant c[…]
I tried to upgrade tof my sonoff basic R2 with the[…]
a problem Perhaps you want to define "Probl[…]
Rebooting your router will not give you a faster I[…]
There are no other notifications from esptool.py i[…]
Using the Arduino IDE, you'll learn how to set up […]
In this project, you will post to Twitter using an[…]
In this project, we will build a water level contr[…]
I guess I'm late, but I had the same problem and f[…]
Last night I received my first D1 Minis for a lear[…]
Although I am aware that this is an old post, I fe[…]