logo elektroda
logo elektroda
X
logo elektroda

Automating Daylight Savings Adjustments for NTP with Scripting or driver update

randomalias324 8226 62
Best answers LABEL_AI_GENERATED

How can I automatically apply daylight-saving time to an NTP-based display in OpenBeken, either from autoexec.bat scripting or with a firmware change?

Yes — you can either switch `ntp_timeZoneOfs` from an `autoexec.bat` script using `if`, `&&`, `||`, aliases, and `backlog`, or use the newer clock/DST support so the offset follows DST rules automatically instead of editing it twice a year [#21301498][#21306272][#21302925] A working Sydney example was posted that sets `winter_time`/`summer_time`, checks month/day/hour edge cases, waits for `NTPState`, and refreshes the setting with a recurring `addClockEvent` [#21304679] The scripting language is limited and there is no full general documentation; aliases plus channels are used as the main building blocks, and there are no normal variables [#21306272] For the firmware approach, `Clock_SetConfig` stores the base timezone and DST rule set once; for Australia/ACT the derived setting was `Clock_SetConfig 99 1 1 4 1 3 600 1 10 1 2 60`, and later builds were updated so NTP offset changes automatically when DST changes [#21302925][#21364166] The DST feature was reported as having only a modest flash cost and was later merged into the main tree [#21364166][#21366516]
AI summary based on the discussion. May contain errors.
ADVERTISEMENT
  • #61 21597196
    4N6nerd
    Level 3  
    Posts: 4
    Rate: 4
    >>21597185
    OUCH! so sorry! I checked my post with my actual code and it's not '&&' that is missing but ' ' that is missing

    My post says "31-$mday $day<=6" while it should be "31-$mday+$day<=6"

    I'll repair my previous post right away.

    Thanks for the heads-up! "Dankjewel" ;)



    Edit: + signs get removed on initial post. After editting it back it stays. :P
  • ADVERTISEMENT
  • DST calculation script with sunrise-based auto-close

    #62 21818755
    lktrdng
    Level 5  
    Posts: 15
    Help: 1
    Rate: 2
    >>21564898 I also took some from this code and changed to my coding style :P
    I see in github the command to set dst but as up today, using OpenBK7231N_1.18.248.rbl is not available, any way to check since when the commands are available?

    
    // timezones definition for location
    alias winter_time ntp_timeZoneOfs +4
    alias summer_time ntp_timeZoneOfs +5
    
    // Timezone calculations inspired in https://www.elektroda.com/rtvforum/topic4086621-30.html#21564898
    // summer otherwise winter
    
    // April-September: always summer
    alias check-dst-1 if $month>3&&$month<10 then summer_time else check-dst-2
    // March/October non-Sundays in last week OR early October
    alias check-dst-2 if ($month==3&&31-$mday+$day<=6&&$day>0)||($month==10&&31-$mday+$day>6) then summer_time else check-dst-3
    // Sunday edge cases only
    alias check-dst-3 if ($month==3&&31-$mday+$day<=6&&$day==0&&$hour>=2)||($month==10&&31-$mday+$day<=6&&$day==0&&$hour<3) then summer_time else winter_time
    
    //calculate dst at startup
    check-dst-1
    
    //schedule close time
    //close at sunrise 
    addClockEvent $sunrise 0xff 2 auto-close
    
    //Every day at 4:00, re-add the clock event to get the sunset/sunrise updated and check dst
    addClockEvent 4:00 0xff 10 backlog removeClockEvent 2; addClockEvent $sunrise 0xff 2 auto-close check-dst-1
  • DST disabled on most platforms, Beken PR available

    #63 21819576
    max4elektroda
    Level 24  
    Posts: 758
    Help: 49
    Rate: 189
    lktrdng wrote:
    I see in github the command to set dst but as up today, using OpenBK7231N_1.18.248.rbl is not available, any way to check since when the commands are available?


    Though present, DST is disabled for almost all platforms.
    For Beken see here:
    https://github.com/openshwprojects/OpenBK7231T_App/tree/main/src/obk_config.h#L253

    I made a PR with DST for Beken, if you have a git user, you can download the firmwares here:
    https://github.com/openshwprojects/OpenBK7231T_App/actions/runs/21337440082

Topic summary

LABEL_AI_GENERATED
Discussion about OpenBeken time handling for LCD devices that receive time via NTP and TuyaMCU, with the main goal of automating daylight saving time adjustments in Australia. The thread explores whether autoexec.bat scripting can detect date ranges and switch ntp_timeZoneOfs using if statements, logical operators, aliases, backlog, labels, and goto, since documentation is limited and variables are not supported directly. A DST-capable clock/time driver was proposed and developed, including a new Clock_SetConfig command and later a simple $isDST command, with testing across multiple platforms. The conversation also covers device-specific issues such as LCD resets and WiFi/TuyaMCU behavior, where setting tuyaMcu_defWiFiState 4 and MQTT connectivity affected stability. In the end, a working script-based DST solution was shared for Sydney and later adapted for CET, while firmware changes added broader DST support and reduced flash usage.
AI summary based on the discussion. May contain errors.
ADVERTISEMENT