logo elektroda
logo elektroda
X
logo elektroda

OpenBeken Autoexec.bat Script for Hot Water Recirculating Pump with NTP and Timed Control

agarg 369 1
ADVERTISEMENT
  • #1 21716473
    agarg
    Level 3  
    I have a hot water recirculating pump that I was earlier operating using smart-life scenes. The routine failed if there was an internet outage at any triggers. I also did not want the pump to needlessly run 24/7. So, I converted it to OpenBeken. It was easy to open and see the marking on the chip. It wasn't glued. Used tuya-cloudcutter on this device and then wrote this autoexec.bat for it to work autonomously. More refinements with DST implementation and MQTT and HA are in my bucket list. Let me know if there are any suggestions to improve this:

    
    waitFor WiFiState 4 
    startDriver ntp
    startDriver SSDP
    ntp_enable 1
    ntp_setServer 192.168.216.1
    ntp_setLatlong  38.43685112526607, -122.57683490730257
    setChannel 11 -7
    ntp_timeZoneOfs $CH11
    waitFor NTPState 1
    setchannel 50 $hour
    setchannel 51 $minute
    setchannel 40 240
    setchannel 41 1500
    alias bootime echo Booted at $ch50:$ch51
    alias laston  echo recirc at $ch52:$ch53
    alias lastoff echo recirc-off at $ch54:$ch55
    alias showme backlog bootime; laston; lastoff; 
    addClockEvent 05:00 0xff 1 ntp_enable 1
    addClockEvent 21:00 0xff 1 ntp_enable 1
    if $hour>=5 && $hour<22 then 
    setChannel 10 1 
    endif
    addClockEvent 06:00 0xff 1 setChannel 10 1
    addClockEvent 22:00 0xff 1 setChannel 10 0
    addClockEvent 05:59 0xff 1 setChannel 1 1
    addChangeHandler "Channel1" == 1 backlog cancelRepeatingEvent 456; setchannel 52 $hour; setchannel 53 $minute; addRepeatingEventID $ch40 1 789 setChannel 1 0
    addChangeHandler "Channel1" == 0 backlog cancelRepeatingEvent 789; setchannel 54 $hour; setchannel 55 $minute; if $CH10==1 then addRepeatingEventID  $ch41 1 456 setChannel 1 1 endif
    addClockEvent 04:40 0xff 1 reboot
    PowerSave 1
    //
    


    Five white Wi-Fi Smart Switch relays with labeling and screw terminal connectors.
    AI: Could you share the exact brand and model of your hot water recirculating pump or the Tuya-based device you converted to OpenBeken?
    1. Watts Hot Water Recirculation 120V Pump (0955800)
    2. 10A KR2201WB Wi-Fi Wireless Smart Basic Switch for Smart Home Smart Life APP Compatible with Alexa & Google Home Assistant No Hub Required
    AI: Are there any specific issues or limitations you've noticed with your current script, or are you mainly looking for general suggestions and best practices?
    I am using a manually changeable channel 11 for Daylight adjustments. I wish there was a way to compute and change to daylights automatically based on the NTP data. Or if there was an easy IF Endif combo that would allow me to to change DST time without any manual interventions.
  • ADVERTISEMENT
  • #2 21718516
    agarg
    Level 3  
    I have a follow on question:
    My NTP is set correctly however its not picking it from local server and when I enter ntp commands they are rejected:
    
    Debug:CMD:cmd [ntp_enable 1]
    Error:CMD:cmd ntp_enable NOT found (args 1)
    Info:CMD:[WebApp Cmd 'ntp_enable 1' Result] Unknown command
    

    It also rejectd accepting NTP server address:
    
    Debug:API:POST to api/cmnd
    Debug:CMD:cmd [ntp_server 192.168.116.1]
    Error:CMD:cmd ntp_server NOT found (args 192.168.116.1)
    Info:CMD:[WebApp Cmd 'ntp_server 192.168.116.1' Result] Unknown command
    


    It may be default enabled once started and not sure how to fix ntp_enable but I figured out and corrected ip setting for it ntp_setServer 192.168.116.1:
    
    Info:NTP:NTP server set to 192.168.116.1
    Info:CMD:[WebApp Cmd 'ntp_setServer 192.168.116.1' Result] OK
    
ADVERTISEMENT