logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

OpenBK Timer Web Interface Similar to Tasmota: Availability and Options

RappaSan 720 20
Best answers

How can I get a Tasmota-like schedules/timer web interface in OpenBK, and what options do I have if it isn't available yet?

There is no Schedules tab in the current OpenBK web app because that timer UI was planned but not implemented yet [#21853781] The available workaround is to configure timers through scripts instead of the web interface [#21853781] A possible approach is to generate an `autoexec.bat` or a separate startup script that the firmware runs on boot [#21853781]
Generated by the language model.
ADVERTISEMENT
  • ADVERTISEMENT
  • #2 21853781
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14628
    Help: 655
    Rate: 12646
    That was the plan, but it was not implemented yet. Can I help you somehow with setting up timers via script? Or I can try to speed up UI for that ... probably something generating autoexec.bat or better, separate script file, but also executed on start by firmware.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21853897
    RappaSan
    Level 8  
    Posts: 28
    Rate: 1
    >>21853781 Thanks for your kind answer, but no. There's no need for it at the moment.
    Better to wait for this feature to be implemented in OBK.
  • #4 21915839
    RappaSan
    Level 8  
    Posts: 28
    Rate: 1
    There is the time_setDST ccommand, but it isnt activated in the downloadable versions.
    Isnt that ridiculous?
  • #5 21915926
    Adriaan2
    Level 4  
    Posts: 8
    I'm confused. I get errors for any of the DST settings (Built on Jun 2 2026 12:15:38 version 1.18.289). Reading through this thread, I see that the prefix changed, so I tried the old prefix. In another answer, it's called clock_calcDST, so tried that too:

    Error:CMD:cmd time_setDST NOT found (args 0 3 1 2 1 0 10 1 3 0)
    Info:CMD:[WebApp Cmd 'time_setDST 0 3 1 2 1 0 10 1 3 0' Result] Unknown command
    
    Error:CMD:cmd clock_setDST NOT found (args 0 3 1 2 1 0 10 1 3 0)
    Info:CMD:[WebApp Cmd 'clock_setDST 0 3 1 2 1 0 10 1 3 0' Result] Unknown command
    
    Error:CMD:cmd clock_calcDST NOT found (args 0 3 1 2 1 0 10 1 3 0)
    Info:CMD:[WebApp Cmd 'clock_calcDST 0 3 1 2 1 0 10 1 3 0' Result] Unknown command
    
    Error:CMD:cmd time_calcDST NOT found (args 0 3 1 2 1 0 10 1 3 0)
    Info:CMD:[WebApp Cmd 'time_calcDST 0 3 1 2 1 0 10 1 3 0' Result] Unknown command


    What is going on? Should I load some extra driver?

    The problem I'd like to solve is to have the MCU change the time automatically. If there's another way to do it, I'd like to learn about that.

    Before anyone asks: this in my autoexec.bat:
    // 
    // name      : $RCSfile: Action_Socket_3202087-2_unit_1_autoexec.bat,v $ $Revision: 1.2 $
    // issued   : $Date: 2026/06/05 10:24:57 $
    // description   : OpenBeken autoexec.bat for LCS Socket 3202087.2
    //
    // id      : $Id: Action_Socket_3202087-2_unit_1_autoexec.bat,v 1.2 2026/06/05 10:24:57 adriaan Exp adriaan $
    //
    // Based on script found at https://www.elektroda.com/news/news4087228.html
    
    // Do not enable powersaving because the BL0937 requires exact
    // pulse/interrupt counting. See comment 16 Nov 2024 11:01 at URL
    // above
    PowerSave 0
    
    // Set IP of NTP server (if you'd like to keep things local)
    // ntp_setServer 172.16.1.73
    // Start NTP driver
    startDriver NTP
    
    // Timezone is Central European time (1 hr ahead of UTC)
    time_setTZ 1
    // Change time offset (last week (0) of March (3) 1st (1) at 2:00 (2)
    // with one hour (1), and last week (0) of October (10) 1st (1) at
    // 3:00 back to 0 hours).
    // https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md)
    time_setDST 0 3 1 2 1 0 10 1 3 0
    // Setting the devices location will allow for calculating sunrise and
    // sunset times
    time_setLatlong (removed for privacy)
    
    // Energy statistics: enabled, 60 sec intervals, 60 samples, no JSON
    SetupEnergyStats 1 60 60 0
    
    // Switch the socket to always "on" after boot
    SetChannel 1 1
    
    // Wait for NTP to connect
    waitFor NTPState 1
  • ADVERTISEMENT
  • #6 21917073
    Adriaan2
    Level 4  
    Posts: 8
    Only now I understand what @RappaSan meant: In the source on GitHub, this function is not enabled, so it's not part of the binaries that are downloaded with the EasyFlash tool under Windows.

    OpenBK Timer Web Interface Similar to Tasmota: Availability and Options

    I will try and compile the firmware myself when I get around to it.
  • #7 21917948
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14628
    Help: 655
    Rate: 12646
    @insmod @max4elektroda @divadiow I've got question from @RappaSan , whether we can enable time_setDST in main release (main build). What do you think, do we have enough flash size for that?
    Helpful post? Buy me a coffee.
  • #8 21917959
    Adriaan2
    Level 4  
    Posts: 8
    Once I get around to building a version locally, I can let you know how much larger the object image becomes. When would you like to make the decision on enabling time_setDST? Do you think the code will work (it's untested on OpenBeken, I presume)?
  • #9 21917982
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14628
    Help: 655
    Rate: 12646
    But why do you want o build locally? You can build in Github, it's just few clicks:
    https://www.elektroda.com/rtvforum/topic4033833.html
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #10 21917987
    Adriaan2
    Level 4  
    Posts: 8
    Just my ignorance. I'm new to OpenBK new to MCUs, actually) and I am used to crosscompile stuff I get from github. I'll have to go and look how to do it on github. Thanks for the tip - it could be way faster than downloading special stuff!
  • #11 21918038
    insmod
    Level 31  
    Posts: 1399
    Help: 164
    Rate: 437
    >>21917948
    BK7238 size
    No DST
    text data bss dec hex filename
    740408 5976 86640 833024 cb600 ./out/bk7231_bsp.elf
    With DST
    text data bss dec hex filename
    742304 5976 86656 834936 cbd78 ./out/bk7231_bsp.elf
  • #12 21918829
    max4elektroda
    Level 24  
    Posts: 756
    Help: 48
    Rate: 187
    p.kaczmarek2 wrote:
    What do you think, do we have enough flash size for that?


    This depends, how much it is used and if it's "worth" it's memory "price": The increase is quite notable, mainly about 2k (output without "OTA" or "rbl" files):

    
    Size +/-    Filename                                              main_bf3682a7ef91      dsttest_4bce2fcf3eba
    -1          obkSimulator_XX.zip                                             2515017                    2515016
    0           OpenBK7231M_ALT_QIO_XX.bin                                      1253376                    1253376
    0           OpenBK7231M_ALT_QIO_XX_btproxy.bin                              1253376                    1253376
    0           OpenBK7231M_QIO_XX.bin                                          1220464                    1220464
    0           OpenBK7231N_ALT_QIO_XX.bin                                      1253376                    1253376
    0           OpenBK7231N_ALT_QIO_XX_btproxy.bin                              1253376                    1253376
    0           OpenBK7231N_ALT_UA_XX.bin                                       1183744                    1183744
    0           OpenBK7231N_ALT_UA_XX_btproxy.bin                               1183744                    1183744
    0           OpenBK7231N_QIO_XX_battery.bin                                  1220464                    1220464
    0           OpenBK7231N_QIO_XX_berry.bin                                    1220464                    1220464
    0           OpenBK7231N_QIO_XX.bin                                          1220464                    1220464
    0           OpenBK7231N_QIO_XX_hlw8112.bin                                  1220464                    1220464
    0           OpenBK7231N_QIO_XX_irRemoteESP.bin                              1220464                    1220464
    0           OpenBK7231N_QIO_XX_powerMetering.bin                            1220464                    1220464
    0           OpenBK7231N_QIO_XX_sensors.bin                                  1220464                    1220464
    0           OpenBK7231N_QIO_XX_tuyaMCU.bin                                  1220464                    1220464
    0           OpenBK7231N_UA_XX_battery.bin                                   1150832                    1150832
    0           OpenBK7231N_UA_XX_berry.bin                                     1150832                    1150832
    0           OpenBK7231N_UA_XX.bin                                           1150832                    1150832
    0           OpenBK7231N_UA_XX_hlw8112.bin                                   1150832                    1150832
    0           OpenBK7231N_UA_XX_irRemoteESP.bin                               1150832                    1150832
    0           OpenBK7231N_UA_XX_powerMetering.bin                             1150832                    1150832
    0           OpenBK7231N_UA_XX_sensors.bin                                   1150832                    1150832
    0           OpenBK7231N_UA_XX_tuyaMCU.bin                                   1150832                    1150832
    0           OpenBK7231T_ALT_QIO_XX.bin                                      1253376                    1253376
    0           OpenBK7231T_ALT_UA_XX.bin                                       1183744                    1183744
    0           OpenBK7231T_QIO_XX_berry.bin                                    1048576                    1048576
    0           OpenBK7231T_QIO_XX.bin                                          1048576                    1048576
    0           OpenBK7231T_QIO_XX_irRemoteESP.bin                              1048576                    1048576
    0           OpenBK7231T_QIO_XX_powerMetering.bin                            1048576                    1048576
    0           OpenBK7231T_QIO_XX_sensors.bin                                  1048576                    1048576
    0           OpenBK7231T_QIO_XX_tuyaMCU.bin                                  1048576                    1048576
    0           OpenBK7231T_UA_XX_berry.bin                                      978944                     978944
    0           OpenBK7231T_UA_XX.bin                                            978944                     978944
    0           OpenBK7231T_UA_XX_irRemoteESP.bin                                978944                     978944
    0           OpenBK7231T_UA_XX_powerMetering.bin                              978944                     978944
    0           OpenBK7231T_UA_XX_sensors.bin                                    978944                     978944
    0           OpenBK7231T_UA_XX_tuyaMCU.bin                                    978944                     978944
    0           OpenBK7231U_QIO_XX.bin                                          1253376                    1253376
    0           OpenBK7231U_UA_XX.bin                                           1183744                    1183744
    0           OpenBK7238_QIO_XX_battery.bin                                   1253376                    1253376
    0           OpenBK7238_QIO_XX_berry.bin                                     1253376                    1253376
    0           OpenBK7238_QIO_XX.bin                                           1253376                    1253376
    0           OpenBK7238_QIO_XX_btproxy.bin                                   1253376                    1253376
    0           OpenBK7238_QIO_XX_irRemoteESP.bin                               1253376                    1253376
    0           OpenBK7238_UA_XX_battery.bin                                    1183744                    1183744
    0           OpenBK7238_UA_XX_berry.bin                                      1183744                    1183744
    0           OpenBK7238_UA_XX.bin                                            1183744                    1183744
    0           OpenBK7238_UA_XX_btproxy.bin                                    1183744                    1183744
    0           OpenBK7238_UA_XX_irRemoteESP.bin                                1183744                    1183744
    0           OpenBK7252N_QIO_XX.bin                                          1253376                    1253376
    0           OpenBK7252N_UA_XX.bin                                           1183744                    1183744
    0           OpenBK7252_QIO_XX.bin                                           1253376                    1253376
    0           OpenBK7252_UA_XX.bin                                            1183744                    1183744
    0           OpenRTL8720D_XX.bin                                             1138688                    1138688
    16          OpenW800_XX.fls                                                  708496                     708512
    192         OpenRTL87X0C_XX.bin                                              835652                     835844
    256         OpenRTL87X0C_XX_btproxy.bin                                      925828                     926084
    1024        OpenXR806_DCDC_XX.img                                            901984                     903008
    1024        OpenXR806_XX.img                                                 901984                     903008
    1024        OpenXR809_XX.img                                                 916264                     917288
    1280        OpenBK7231T_UG_XX_tuyaMCU.bin                                    497776                     499056
    1296        OpenBK7231N_UG_XX_hlw8112.bin                                    459968                     461264
    1296        OpenBK7231T_UG_XX_powerMetering.bin                              497824                     499120
    1316        OpenW600_XX_gz.img                                               348728                     350044
    1360        OpenBK7231N_UG_XX_berry.bin                                      586176                     587536
    1376        OpenBK7231T_UG_XX_irRemoteESP.bin                                562592                     563968
    1412        OpenECR6600_XX.bin                                               996137                     997549
    1424        OpenBK7231N_UG_XX_powerMetering.bin                              519792                     521216
    1504        OpenBK7231N_UG_XX_battery.bin                                    472224                     473728
    1536        OpenRDA5981_XX.bin                                               511532                     513068
    1536        OpenTXW81X_XX.bin                                                606736                     608272
    1552        OpenBK7231N_UG_XX_tuyaMCU.bin                                    518656                     520208
    1584        OpenBK7231N_UG_XX_irRemoteESP.bin                                581088                     582672
    1600        OpenBK7231N_UG_XX.bin                                            520864                     522464
    1600        OpenBK7231T_UG_XX_sensors.bin                                    489728                     491328
    1608        OpenW600_XX.fls                                                  567488                     569096
    1640        OpenLN882H_XX_btproxy.bin                                        980528                     982168
    1648        OpenBK7231N_UG_XX_sensors.bin                                    513856                     515504
    1648        OpenBK7231T_UG_XX.bin                                            495872                     497520
    1680        OpenLN882H_XX.bin                                                734840                     736520
    1680        OpenRTL8710B_XX.bin                                              680692                     682372
    1696        OpenRTL8721DA_XX.bin                                            1571456                    1573152
    1704        OpenTR6260_XX.bin                                                671864                     673568
    1712        OpenESP32S2_XX_4M.factory.bin                                   1065984                    1067696
    1712        OpenESP32S2_XX_4M.img                                           1000448                    1002160
    1712        OpenESP32S3_XX_4M.factory.bin                                   1102960                    1104672
    1712        OpenESP32S3_XX_4M.img                                           1037424                    1039136
    1728        OpenESP32_XX_4M.factory.bin                                     1103232                    1104960
    1728        OpenESP32_XX_4M.img                                             1037696                    1039424
    1728        OpenRTL8720E_XX.bin                                             1309600                    1311328
    1776        OpenBK7231T_UG_XX_berry.bin                                      560768                     562544
    1792        OpenRTL8710A_XX.bin                                              690628                     692420
    1864        OpenBK7231U_XX.bin                                               752272                     754136
    1880        OpenBK7231N_ALT_XX.bin                                           752664                     754544
    1880        OpenBK7231N_ALT_XX_btproxy.bin                                   906728                     908608
    1880        OpenBK7231T_ALT_XX.bin                                           750336                     752216
    1880        OpenBK7238_XX_battery.bin                                        715808                     717688
    1880        OpenBK7238_XX.bin                                                746440                     748320
    1880        OpenBK7238_XX_btproxy.bin                                        949232                     951112
    1880        OpenBK7238_XX_irRemoteESP.bin                                    823080                     824960
    1880        OpenBK7252N_XX.bin                                               725028                     726908
    1880        OpenBK7252_XX.bin                                                730988                     732868
    1888        OpenBK7238_XX_berry.bin                                          843392                     845280
    1944        OpenBK7231N_XX_battery.bin                                       731805                     733749
    1944        OpenBK7231N_XX_berry.bin                                         929345                     931289
    1944        OpenBK7231N_XX_hlw8112.bin                                       711461                     713405
    1944        OpenBK7231N_XX_irRemoteESP.bin                                   922125                     924069
    1944        OpenBK7231N_XX_sensors.bin                                       818353                     820297
    1944        OpenBK7231T_XX.bin                                               793177                     795121
    1944        OpenBK7231T_XX_powerMetering.bin                                 773909                     775853
    1944        OpenBK7231T_XX_tuyaMCU.bin                                       774013                     775957
    1952        OpenBK7231N_XX.bin                                               826985                     828937
    1952        OpenBK7231N_XX_powerMetering.bin                                 804629                     806581
    1952        OpenBK7231N_XX_tuyaMCU.bin                                       803365                     805317
    1952        OpenBK7231T_XX_berry.bin                                         895537                     897489
    1952        OpenBK7231T_XX_irRemoteESP.bin                                   897437                     899389
    1952        OpenBK7231T_XX_sensors.bin                                       786001                     787953
    2032        OpenESP8266_1MB_XX.factory.bin                                   768464                     770496
    2032        OpenESP8266_2MB_XX.factory.bin                                   768464                     770496
    2032        OpenESP8266_XX.img                                               702928                     704960
    2048        OpenGD32VW553_XX.bin                                             869045                     871093
    2048        OpenXR872_XX.img                                                 794456                     796504
    2144        OpenESP32C6_XX_4M.factory.bin                                   1286720                    1288864
    2144        OpenESP32C6_XX_4M.img                                           1221184                    1223328
    2160        OpenESP32C3_XX_2M.factory.bin                                   1039632                    1041792
    2160        OpenESP32C3_XX_2M.img                                            974096                     976256
    2160        OpenESP32C3_XX_4M.factory.bin                                   1189984                    1192144
    2160        OpenESP32C3_XX_4M.img                                           1124448                    1126608
    2176        OpenESP32C2_XX_2M.factory.bin                                    934960                     937136
    2176        OpenESP32C2_XX_2M.img                                            869424                     871600
    2176        OpenESP32C2_XX_4M.factory.bin                                   1071952                    1074128
    2176        OpenESP32C2_XX_4M.img                                           1006416                    1008592
    2176        OpenESP32C5_XX_4M.factory.bin                                   1274112                    1276288
    2176        OpenESP32C5_XX_4M.img                                           1208576                    1210752
    2176        OpenESP32C61_XX_4M.factory.bin                                  1240064                    1242240
    2176        OpenESP32C61_XX_4M.img                                          1174528                    1176704
    2208        OpenBL602_XX_berry.bin                                           907508                     909716
    2224        OpenBL602_XX.bin                                                 782172                     784396
    3248        OpenLN8825_XX.bin                                                923000                     926248
    3360        OpenRTL8710B_UG_XX.img                                          1271328                    1274688
    


    Some code is used for "correcting" output, for example, enabling DST will give correct DST information in JSON output instead of "2022-03-27T02:00:00" and "2022-10-30T03:00:00".

    On the other hand, I don't think we come near to the maximum size yet, I only see BL602_berry near it's limit for 1MB (907508 to 909716).
    OTA isn't working even for "regular" berry, but flashing DST firmware by serial worked fine, DST is working.


    OpenBK Timer Web Interface Similar to Tasmota: Availability and Options


    Just realized, the command documentation for "time_setDST" is wrong :-( describing it will use "hours" for offset, while it will use minutes.

    Will fix that and look if I can squeeze some more bytes by optimizing the code.
  • #13 21919148
    RappaSan
    Level 8  
    Posts: 28
    Rate: 1
    Nice to hear that, thanks in advance.
  • #14 21919416
    max4elektroda
    Level 24  
    Posts: 756
    Help: 48
    Rate: 187
    Made PR#2127 to fix the call to "time_setDST"

    If you'd like to test, you can find the binaries for all platforms with enabled "DST" here in the artifacts (need to be logged in):
    https://github.com/MaxineMuster/OpenBK7231T_App/actions/runs/27356496470

    For the PR DST is still disabled like before, only call is fixed.

    Now both calls are possible: If DST offset is 1, we'll interpret as 1 hour (there are almost no other values) else as minutes, so "60" will lead to the same rule:
    TIME_setDST 0 3 1 2 1 0 10 1 3 0
    equals
    TIME_setDST 0 3 1 2 60 0 10 1 3 0
  • #15 21919423
    RappaSan
    Level 8  
    Posts: 28
    Rate: 1
    Wow, that’s a bunch of files, thanks.
    Unfortunately I’m on holiday, but I’ll try them as soon as possible.
  • #16 21924753
    Adriaan2
    Level 4  
    Posts: 8
    I did try the DSTtest firmware and it works (for my situation).

    I am working on an smart socket ("Action" (the name of store) LSC article 3202087.2, costing about € 7,00, with an T1-2S-NL module containing a BK7238 MCU). I want the thing to switch on at sunset and off at at sunrise, and (preferably) not worry about it ever again.

    For reference, this is my autoexec.bat:
    // 
    // name		: $RCSfile: Action_Socket_3202087-2_unit_1_autoexec.bat,v $ $Revision: 1.4 $
    // issued	: $Date: 2026/06/20 10:59:39 $
    // description	: OpenBeken autoexec.bat for LSC Socket 3202087.2
    //
    // id		: $Id: Action_Socket_3202087-2_unit_1_autoexec.bat,v 1.4 2026/06/20 10:59:39 adriaan Exp $
    //
    
    // --------------- Start of generic autoexec.bat ------------------
    
    // Do not enable powersaving because the BL0937 requires exact
    // pulse/interrupt counting. See comment 16 Nov 2024 11:01 at
    // https://www.elektroda.com/news/news4087228.html
    PowerSave 0
    
    // Disable noisy logging (temporarily during debugging)
    logfeature 6 0
    logfeature 7 0
    
    // Set IP of NTP server (if you'd like to keep things local)
    ntp_setServer 172.16.1.88
    // Start NTP driver
    startDriver NTP
    
    // Timezone is Central European time (Change this to 2 during DST while
    // time_setDST (below) is not included)
    time_setTZ 1
    // Give (local) time offsets: the last week (0) of March (3) on Sunday (1) at
    // 2:00 (2) of one hour (1), and last week (0) of October (10) on Sunday (1) at
    // 3:00 back to 0 hours.
    time_setDST 0 3 1 2 1 0 10 1 3 0
    // The time_setDST command (above) is not included in regular versions...
    // https://www.elektroda.com/rtvforum/viewtopic.php?p=21917073#21917073
    
    // Setting the devices (approximate) location will allow for calculating
    // sunrise and sunset times
    time_setLatlong 50.285 5.792
    
    // Energy statistics: enabled, 60 sec intervals, 60 samples, no JSON
    SetupEnergyStats 1 60 60 0
    
    // Wait for NTP to connect
    waitFor NTPState 1
    
    // --------------- End of generic autoexec.bat --------------------
    
    // ----------------------------------------------------------------
    // Switch the socket (Channel 1) to always "off" (0) after boot
    SetChannel 1 0
    
    // ----------------------------------------------------------------
    // Script to switch the relay on at sunset and off at sunrise. This uses three
    // ClockEvent UniqueIDs: 1 for sunset, 2 for sunrise and 3 for scheduling the
    // other events. A ClockEvent is set with an absolute time, so we'll have to
    // make a new ClockEvent everyday (at 1:00 am).
    
    // Aliases:
    // Remove ClockEvent 1, then schedule any day of the week (0xff) with uniqueID
    // 1: SetChannel 1 to "on" at (today's!) sunset
    alias set_sunset backlog removeClockEvent 1; addClockEvent $sunset 0xff 1 SetChannel 1 1
    // Remove ClockEvent 2, then schedule any day of the week (0xff) with uniqueID
    // 2: SetChannel 1 to "off" at (today's!) sunrise
    alias set_sunrise backlog removeClockEvent 2; addClockEvent $sunrise 0xff 2 SetChannel 1 0
    
    // After boot, schedule what to do at next sunset and sunrise
    set_sunset
    set_sunrise
    
    // (Re)schedule the times for today's solar phase, everyday at 1:00 am
    addClockEvent 1:00 0xff 3 backlog set_sunset; set_sunrise
    
    // vim:set textwidth=0 ft=java:

    And this is the boot log:
    Info:CMD:CMD_StartScript: started @startup at the beginning
    Info:CMD:CMD_StartScript: started autoexec.bat at the beginning
    Info:MAIN:Main_Init_After_Delay done
    Info:HTTP:TCP server listening
    Info:CMD:CMD_PowerSave: will set to 0
    Error:CMD:cmd ntp_setServer NOT found (args 172.16.1.88)
    Info:NTP:NTP driver initialized with server=172.16.1.88, offset=0, syncing every 60 seconds
    Info:NTP:Time offset set to 3600 seconds (DST offset 0 seconds)
    Info:NTP:DST config set: offset=3600 seconds
    Info:NTP:TIME latitude set to 50.285
    Info:NTP:TIME longitude set to 5.792
    Info:EnergyMeter:Consumption History enabled
    Info:EnergyMeter:Sample Count: 60
    Info:EnergyMeter:Sample Interval: 60
    Info:NTP:Seconds since Jan 1 1900 = 3990939770
    DST switch - calling fix_DSTforEvents(60)
    In summer time - next DST switch at 1792897200 (2026-10-25 03:00:00)
    Info:NTP:Unix time: 1781950970 - local Time 2026-06-20 12:22:50
    Info:CMD:New alias has been set: set_sunset runs backlog removeClockEvent 1; addClockEvent $sunset 0xff 1 SetChannel 1 1
    Info:CMD:New alias has been set: set_sunrise runs backlog removeClockEvent 2; addClockEvent $sunrise 0xff 2 SetChannel 1 0
    Info:NTP:TIME sunset is at 21:50
    Info:NTP:TIME sunset is at 21:50
    Info:NTP:TIME sunrise is at 05:25
    Info:NTP:TIME sunrise is at 05:25

    Now, obviously, I have to wait until today's sunset to actually see it working, but the tests and the logs look promising. I'll update with results in a week.

    Meanwhile, thanks @max4elektroda for building this firmware and the hour/minute fix - I didn't even have to change the command I tried earlier!
  • #17 21924813
    max4elektroda
    Level 24  
    Posts: 756
    Help: 48
    Rate: 187
    Adriaan2 wrote:
    Now, obviously, I have to wait until today's sunset to actually see it working, but the tests and the logs look promising. I'll update with results in a week.

    You might, but if you are impatient like me ;-) you can also set the clock to any time you like, e.g. 5 seconds ahead of the expected switch.

    $  date -d "2026-06-20 21:49:55" +%s
    1781984995


    --> time_setTime 1781984995



    BTW: While you use "$sunset" and "$sunrise" - hence need to set time every day (e.g. like your script at 1:00), you can also use "sunset"/"sunrise", which will recalc the next event after one fired.

    Here's my (similar) script for switching a light on every "night" (the "long" code is used to set the correct state during start [only used if socket is started "during night"):


    startdriver ntp
    clock_setTZ 1
    CLOCK_setDST 0 3 1 2 60 0 10 1 3 0
    // let's user Berlin here ...
    clock_setLatLong 52.5200  13.4050
    waitFor NTPState 1
    // on boot: Force relay off ...
    setChannel 0 0
    // .. and set relay "on", if we are between sunset and sunrise ("before" sunrise or "after" sunset)
    if $hour*3600+$minute*60+$second-$sunrise<0||$hour*3600+$minute*60+$second-$sunset>0 then setChannel 0 1
    // set (recurring) sunset/sunrise event
    addClockEvent sunset 0xff 31 setChannel 0 1
    addClockEvent sunrise 0xff 32 setChannel 0 0
  • #18 21925099
    Adriaan2
    Level 4  
    Posts: 8
    Thanks again, @max4elektroda. It looks a lot cleaner now, without an extra scheduled ClockEvent (at 1:00 am). I missed that a variable could be used as sunset instead of $sunset. I still cannot find it in the documentation - do you know where this is documented? Or: could this be added to the section about constants (although "sunset" (instead of "$sunset") is hardly a constant...)?

    Australian user @ilengyel may benefit from this info as well - I used $sunset and extra ClockEvents after reading his article on this site.

    I shamelessly copied your if statement to determine the status at boot as well. This is the result:
    // 
    // name      : $RCSfile: Action_Socket_3202087-2_unit_1_autoexec.bat,v $ $Revision: 1.5 $
    // issued   : $Date: 2026/06/21 05:13:08 $
    // description   : OpenBeken autoexec.bat for LSC Socket 3202087.2
    //
    // id      : $Id: Action_Socket_3202087-2_unit_1_autoexec.bat,v 1.5 2026/06/21 05:13:08 adriaan Exp $
    //
    
    // --------------- Start of generic autoexec.bat ------------------
    
    // Do not enable powersaving because the BL0937 requires exact
    // pulse/interrupt counting. See comment 16 Nov 2024 11:01 at
    // https://www.elektroda.com/news/news4087228.html
    PowerSave 0
    
    // Disable noisy logging (temporarily during debugging)
    logfeature 6 0
    logfeature 7 0
    
    // Set IP of NTP server (if you'd like to keep things local)
    ntp_setServer 172.16.1.88
    // Start NTP driver
    startDriver NTP
    
    // Timezone is Central European time (Change this to 2 during DST while
    // time_setDST (below) is not included)
    time_setTZ 1
    // Give (local) time offsets: the last week (0) of March (3) on Sunday (1) at
    // 2:00 (2) of one hour (1), and last week (0) of October (10) on Sunday (1) at
    // 3:00 back to 0 hours.
    time_setDST 0 3 1 2 1 0 10 1 3 0
    // The time_setDST command (above) is not included in regular versions...
    // https://www.elektroda.com/rtvforum/viewtopic.php?p=21917073#21917073
    
    // Setting the devices (approximate) location will allow for calculating
    // sunrise and sunset times
    time_setLatlong 50.285 5.792
    
    // Energy statistics: enabled, 60 sec intervals, 60 samples, no JSON
    SetupEnergyStats 1 60 60 0
    
    // Wait for NTP to connect
    waitFor NTPState 1
    
    // --------------- End of generic autoexec.bat --------------------
    
    // ----------------------------------------------------------------
    // Switch the relay on at sunset and off at sunrise. Note the use of "sunrise"
    // (will be determined at each reference) and "$sunrise" (is a 'constant' set
    // at the time of evaluation).
    
    // After boot, make sure channel 1 is off (0), then switch channel 1 on (1) if
    // the time is before $sunrise or after $sunset
    setChannel 1 0
    if $hour*3600 $minute*60 $second<$sunrise||$hour*3600 $minute*60 $second>$sunset then setChannel 1 1
    
    // Schedule any day of the week (0xff) with uniqueID 1: SetChannel 1 to "on"
    // (1) at sunset
    addClockEvent sunset 0xff 1 SetChannel 1 1
    // Schedule any day of the week (0xff) with uniqueID 2: SetChannel 1 to "off"
    // (0) at sunrise
    addClockEvent sunrise 0xff 2 SetChannel 1 0
    
    // vim:set textwidth=0 ft=java:
  • #19 21925255
    RappaSan
    Level 8  
    Posts: 28
    Rate: 1
    Sunrise/sunset can be found under addClockEvent. :-)
  • #20 21925269
    Adriaan2
    Level 4  
    Posts: 8
    This?
    Quote:
    NOTE: Use of sunrise/sunset requires compiling with ENABLE_TIME_SUNRISE_SUNSET set

    I must be getting old - I never deducted that sunset (instead of $sunset) could be used from that remark. I also missed what the difference is. I did find something else under the article mentioned before:
    Screenshot of an OpenBeken FAQ about NTP and addClockEvent, with a table of options and risks
    I'm not sure where that comes from - I usually ignore this kind of auto-generated stuff at the bottom of pages. Oh well...
  • #21 21925278
    max4elektroda
    Level 24  
    Posts: 756
    Help: 48
    Rate: 187
    Adriaan2 wrote:
    I shamelessly copied your if statement

    On the contrary, that's the idea of sharing code (in my opinion) ;-).
    And it's absolutely no high end coding, might be done even smarter

Topic summary

✨ The inquiry concerns the availability of a web interface for OpenBK timer functionality similar to the scheduling feature found in Tasmota firmware. The user references an article on elektroda.com describing OpenBK timer web interface setup but notes the absence of a "Schedules" tab in the current OpenBK web application. The discussion focuses on whether OpenBK firmware supports integrated timer scheduling via its web UI comparable to Tasmota's implementation, and if alternative solutions or firmware versions provide this feature.
Generated by the language model.
ADVERTISEMENT