logo elektroda
logo elektroda
X
logo elektroda

Flashed 16A Smart Switch: OpenBeken NTP Server Connection & Time Sync Issues (addClockEvent)

patentjyp 4716 11
ADVERTISEMENT
  • #1 20489309
    patentjyp
    Level 5  
    I flashed 16A smart switch according to the guide here:

    https://www.elektroda.com/rtvforum/topic3912748.html

    The switch is working fine but I need to use the command "addClockEvent".

    Therefore, I added this to my autoexec.bat.

    startDriver ntp
    ntp_setServer 0.kr.pool.ntp.org
    ntp_timeZoneOfs 9:00

    However, I do not think the relay has the correct time because the relay cannot connect to NTP servers.

    Log repeatedly shows the next line

    Info:NTP:NTP_CheckForReceive: Error while receiving server's msg

    I tried different NTP servers but I got the same result.

    UI shows "NTP: Syncing with 0.kr.pool.ntp.org...." like below.

    Flashed 16A Smart Switch: OpenBeken NTP Server Connection & Time Sync Issues (addClockEvent)

    I tired the command "addClockEvent" and the relay would not turn on or off at the specified time.

    I think this is because the relay cannot sync with the NTP servers. Therefore, I have to figure out the time stored in the relay.

    Tasmota has the command "time" and the current time will be shown on the console when the command is issued.

    Is there any command or way to see the time or manually set the time?

    I went through the date command list but I could not find any.

    Any help is appreciated.
  • ADVERTISEMENT
  • #2 20489357
    p.kaczmarek2
    Moderator Smart Home
    Hello, have you tried putting IP instead of hostname?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20489448
    patentjyp
    Level 5  
    IP address works!

    I have another question.

    I used the commands below to change the label of UI button.

    startDriver cmd_channels
    SetChannelLabel 1 Power

    However, while the button still has "Toggle", so it is now "Toggle Power".

    Is there any way to remove "Toggle" from the UI buttons?
  • #4 20489567
    p.kaczmarek2
    Moderator Smart Home
    Well, right now not... but I can add a flag for that for you... some kind of a simple setting, wait...

    btw what is "cmd_channels"? I don't think anything like that exists.

    Added after 1 [hours] 7 [minutes]:

    @patentjyp I have added ability to hide "Toggle "prefix from button per your request.
    Please see updated docs for usage:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    Please search for "SetChannelLabel ". Of course, you must first update your firmware.
    Helpful post? Buy me a coffee.
  • #5 20490233
    patentjyp
    Level 5  
    It works! No "Toggle"

    Thank you again!!!
  • #6 20490282
    p.kaczmarek2
    Moderator Smart Home
    It was a pleasure to help you. Is there anything else I can help with, or maybe do you have any other suggestions for console commands and/or fixes?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #7 20563425
    rakalexei
    Level 8  
    @p.kaczmarek2

    Hi, I have the same issue, I have two smart switches, and on both, I turned on the NTP driver, but one switch is connected to NTP, another one doesn't

    Here is the result from 1 switch - NTP (): Local Time: 2023/05/02 14:50:07
    here is from 2 switch - NTP: Syncing with 217.147.223.78....

    I tried to change the server to another IP address (91.210.190.13) but the result is the same, it doesn't work.

    Some logs from 2 switch

    Info:MAIN:Started NTP.
    Info:NTP:NTP offset set, wait for next ntp packet to apply changes
    ...........
    Info:NTP:NTP_CheckForReceive: Error while receiving server's msg
  • #8 20563434
    p.kaczmarek2
    Moderator Smart Home
    NTP will retry automatically after 60 seconds. Are you trying to say it fails every time?
    Helpful post? Buy me a coffee.
  • #9 20563491
    rakalexei
    Level 8  
    Yes, every time, it never connects. But another switch is connected ok.

    Flashed 16A Smart Switch: OpenBeken NTP Server Connection & Time Sync Issues (addClockEvent) Flashed 16A Smart Switch: OpenBeken NTP Server Connection & Time Sync Issues (addClockEvent) Flashed 16A Smart Switch: OpenBeken NTP Server Connection & Time Sync Issues (addClockEvent) Flashed 16A Smart Switch: OpenBeken NTP Server Connection & Time Sync Issues (addClockEvent)
  • #10 20563504
    p.kaczmarek2
    Moderator Smart Home
    Ok, please remove startDriver NTP from the problematic switch, reboot it, make sure that NTP is not running, wait 60 seconds, and then in console type manually startDriver NTP and tell me if it works for you in that way.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #11 20563509
    rakalexei
    Level 8  
    Yes, it works now. Then I added it back to autoexec.bat and it's working well.

    Thank you very much!
  • #12 20563552
    p.kaczmarek2
    Moderator Smart Home
    Wait! But we did basically nothing and it works for you now? It must have been a fluke, maybe a temporary network issue.

    I was going to suggest that, if it works with a delay, you could use:
    
    addRepeatingEvent 10 1 startDriver NTP

    to start NTP with a delay... but I don't think this should be needed.
    Helpful post? Buy me a coffee.

Topic summary

✨ The discussion revolves around issues with a flashed 16A smart switch regarding NTP server connection and time synchronization. The user initially faced problems with the command "addClockEvent" due to the relay's inability to connect to NTP servers, resulting in repeated log errors. A suggestion to use an IP address instead of a hostname for the NTP server proved successful. Another user reported similar issues with two smart switches, where one connected to NTP while the other did not. After troubleshooting steps, including removing and re-adding the NTP driver, the problematic switch successfully connected. The conversation also touched on modifying UI button labels and the addition of a feature to hide the "Toggle" prefix from button labels.
Generated by the language model.

FAQ

TL;DR: 60-second auto-retry plus switching to an IP NTP server fixes most OpenBeken time-sync issues. "NTP will retry automatically after 60 seconds." Verify Local Time, consider a delayed start, and update firmware for UI label tweaks. [Elektroda, p.kaczmarek2, post #20563434]

Why it matters: This FAQ helps OpenBeken users of 16A smart switches fix NTP time sync so addClockEvent schedules run reliably.

Quick Facts

How do I fix NTP sync when logs show "Error while receiving server's msg"?

Use an IP address in ntp_setServer instead of a hostname, then restart the NTP driver. Ensure NTP is started (startDriver NTP) and your timezone is set (ntp_timeZoneOfs 9:00 style). Watch the UI for "NTP: Syncing with ..." and then confirm time. That error indicates the device did not receive a valid NTP reply. Once NTP sync completes, schedules will have a reliable clock. [Elektroda, patentjyp, post #20489309]

Should I set the NTP server as an IP instead of a hostname?

Yes. Several users resolved connection problems by switching from a pool hostname to a numeric IP in ntp_setServer. This avoids DNS-related hiccups on embedded devices. After setting an IP, the device began syncing immediately. If you still see sync stalls, restart the NTP driver once. [Elektroda, patentjyp, post #20489448]

How can I delay NTP startup to avoid boot race conditions?

If NTP fails right after boot, start it with a short delay. Example: addRepeatingEvent 10 1 startDriver NTP. This waits 10 seconds before starting the NTP driver, allowing Wi‑Fi and network services to settle. The developer noted this workaround but said it usually isn’t required. [Elektroda, p.kaczmarek2, post #20563552]

Why don’t my addClockEvent schedules fire on time?

They won’t run predictably if the device clock isn’t synced. Confirm NTP is running, set the timezone offset, and verify Local Time in the console or UI. When logs show repeated receive errors, fix NTP first, then retest schedules. After time sync, addClockEvent actions will execute correctly. [Elektroda, patentjyp, post #20489309]

How do I restart and test the NTP driver without autoexec.bat?

Try this quick test:
  1. Remove startDriver NTP from autoexec.bat and reboot.
  2. Confirm NTP isn’t running; wait 60 seconds.
  3. Run startDriver NTP in the console and observe sync. This isolated a startup issue for a user and validated NTP operation interactively. [Elektroda, p.kaczmarek2, post #20563504]

How can I confirm NTP sync and see the current time?

Open the console and look for a line similar to: "Local Time: 2023/05/02 14:50:07". That indicates the device has synchronized time. If you only see "NTP: Syncing with ...", it has not yet locked. Once Local Time appears, scheduled events can run reliably. [Elektroda, rakalexei, post #20563425]

Is there a console command like Tasmota’s time to show or set time manually?

In this discussion, users did not find a direct time command. Use the NTP driver to obtain time and inspect the Local Time output in console or UI. The thread focuses on NTP-based sync rather than manual setting. Adjust timezone via ntp_timeZoneOfs, then verify. [Elektroda, patentjyp, post #20489309]

What is the correct timezone setting format in OpenBeken?

Use ntp_timeZoneOfs with an hours:minutes offset. Example: ntp_timeZoneOfs 9:00 for UTC+9. Set the server, start the NTP driver, and confirm Local Time afterward. Without the correct offset, schedules can drift from your local wall-clock time even after sync. [Elektroda, patentjyp, post #20489309]

One switch connects to NTP but another identical one doesn’t. What helped others?

Remove startDriver NTP from autoexec, reboot, then start the NTP driver manually. After confirming it works, add startDriver NTP back to autoexec. This sequence restored stable operation for a user whose second switch never synced until manual intervention. [Elektroda, rakalexei, post #20563509]

How long should I wait before troubleshooting NTP sync?

Wait at least 60 seconds. “NTP will retry automatically after 60 seconds.” If it still doesn’t lock, change the server to an IP and restart the driver. This timing avoids chasing transient startup conditions and network flukes. [Elektroda, p.kaczmarek2, post #20563434]

How do I remove the "Toggle" text from UI button labels?

Update to the latest firmware containing the new label feature. Then use SetChannelLabel with the option that hides the "Toggle" prefix. After updating and applying the new label, the UI shows your custom text without the prefix. Check the updated commands documentation mentioned by the developer. [Elektroda, p.kaczmarek2, post #20489567]

Does a cmd_channels module exist for labeling or buttons?

No. The developer clarified this isn’t a valid driver: “I don’t think anything like that exists.” Use SetChannelLabel on supported builds to customize button labels instead. Update firmware first, then apply the label command. [Elektroda, p.kaczmarek2, post #20489567]

Which logs are most useful when diagnosing NTP startup?

Look for: “Started NTP.” Then “NTP offset set, wait for next ntp packet to apply changes.” Finally, confirm it prints “Local Time: …” after locking. If Local Time never appears, recheck server settings, try an IP address, and restart NTP. [Elektroda, rakalexei, post #20563425]

What does persistent "Error while receiving server's msg" mean, and what’s the edge case?

It means the device did not receive a valid NTP reply. An edge case is repeated failures even with working Wi‑Fi. In that case, switch to an IP server, restart the NTP driver, and verify timezone settings. Then retest schedules like addClockEvent. [Elektroda, patentjyp, post #20489309]
Generated by the language model.
ADVERTISEMENT