logo elektroda
logo elektroda
X
logo elektroda

[BK7231N][BL0937] Zunepluse 16A Smart Plug OpenBK7231N_1.18.143 Power Data Scripting for Auto-Off

OP741 210 5
ADVERTISEMENT
  • #1 21620951
    OP741
    Level 2  
    I have Zunepluse 16A Smart Plug [BK7231N][BL0937] running OpenBK7231N_1.18.143.rbl,
    i need to have this smart plug detect low load like 5w and then turn off. but i can't figure out how to get power data from MCU in script i have tried every article without success.
    OpenBK7231N web interface showing power data for Zunepluse 16A smart plug


    there every less information available about this on internet. please someone help
    AI: is the power data (like current wattage) visible anywhere in the openbk7231n web interface, mqtt, or logs for your plug?
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic ServerPower/power/get
    Info:MQTT:Publishing val 0.189 to ServerPower/current/get retain=0
    Info:MQTT:Publishing val 45.43 to ServerPower/power_apparent/get retain=0
    Info:MQTT:Publishing val 526562.187 to ServerPower/energycounter/get retain=0
  • ADVERTISEMENT
  • Helpful post
    #2 21621253
    Drakarah
    Level 5  
    
    alias checkBelowThreshold if $power<5 then SetChannel 0 0
    addRepeatingEvent 1 -1 checkBelowThreshold
    


    This will do a check every second (1) indefinitely (-1). If the power is below 5w, then it will turn channel 0 off (if your relay is on channel 1 then it would become SetChannel 1 0)

    ($power is one of the available constants you can use https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/constants.md)
  • ADVERTISEMENT
  • #3 21621473
    p.kaczmarek2
    Moderator Smart Home
    You can also try using Berry scripting: https://www.elektroda.com/rtvforum/topic4117238.html
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #4 21621525
    OP741
    Level 2  
    >>21621253
    Sir you are a godsend. Many thanks. This is working perfectly

    Can you please also tell me how to remove this rule if needed.
    I mean to delete alias or list alias.
  • ADVERTISEMENT
  • #5 21622991
    Drakarah
    Level 5  
    >>21621525 AFAIK you can't delete it, but it's not persistent, if you reboot it'll be gone. If you put it into autoexec.bat it will register and execute it at boot, so what I usually do is put the things I want active and comment out the things I don't want active in autoexec.bat and then reboot
  • #6 21623043
    OP741
    Level 2  
    Yes I figured that out while trying.
    Once again thanks.
ADVERTISEMENT