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

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

What was the Tuya Wi-Fi module doing inside the computer? Updating the PC Power Switch Remote firmwa

p.kaczmarek2 96 3

TL;DR

  • A Tuya Wi‑Fi PCIe card remotely controls a desktop PC’s power and reset buttons, bypassing the case switches with optocoupler-isolated inputs and outputs.
  • The board moved from a CBU BK7231N module to BK7238, and it can be flashed with OpenBK using a USB-to-UART converter and BK7231GUIFlashTool.
  • It costs just over $10, comes in Wi‑Fi and Zigbee versions, and the seller warns that branded computers may need specific BIOS settings.
  • Custom OBK scripts can map short and long presses to relay closures, add Home Assistant buttons, and enforce a child-lock condition that blocks power-on from the case.
  • The final result is a cloud-free remote PC power/reset switch that can boot, reset, and lock a computer, though Wake-on-LAN may already cover some use cases.
Generated by the language model.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI):
  • What was the Tuya Wi-Fi module doing inside the computer? Updating the PC Power Switch Remote firmwa
    The PCIe card shown here allows remote control of two buttons on a desktop computer – power and reset. It is available in two versions, Wi-Fi and Zigbee; here we will present the former. The original buttons are completely bypassed, and the module offers two inputs and outputs isolated by optocouplers. This means it can provide a child lock function – preventing the computer from being switched on from the case. All of this is also available in the RF version, but we’ve opted for the Wi-Fi-only version – for just over $10:
    What was the Tuya Wi-Fi module doing inside the computer? Updating the PC Power Switch Remote firmwa
    The seller warns that the device does not work on branded computers and requires appropriate BIOS settings.
    What was the Tuya Wi-Fi module doing inside the computer? Updating the PC Power Switch Remote firmwa
    The whole thing is also available in a PRO version with an additional radio remote control:
    What was the Tuya Wi-Fi module doing inside the computer? Updating the PC Power Switch Remote firmwa
    Here’s a close-up of the board – there are four pairs of wires, two pairs for inputs and two for outputs. The device automatically pairs them using the factory settings; short-circuiting one input (where the button will be) causes a short-circuit in the output (where we’ll connect the motherboard):
    What was the Tuya Wi-Fi module doing inside the computer? Updating the PC Power Switch Remote firmwa What was the Tuya Wi-Fi module doing inside the computer? Updating the PC Power Switch Remote firmwa
    The whole thing used to be on a CBU module (BK7231N), but it’s now on the BK7238:
    What was the Tuya Wi-Fi module doing inside the computer? Updating the PC Power Switch Remote firmwa
    A few words about the app are also in order. Tuya comes pre-installed, allowing you to control it for free from anywhere in the world. It also features a timer and integration with Google, Alexa and similar voice assistants.

    Firmware update
    However, we wanted to experiment a bit more and flash our own firmware onto it. This is where you need to think carefully, because if you don’t have a server on the internet, there may be a problem with controlling it from behind your router, but this is normal for solutions such as Tasmota or ESPHome. Here, we’ll upload our Cross-platform IoT firmware supporting as many as 32 platforms to the module.
    We’ve already shown the T1-U-HL pinouts on the forum: Data sheet for the T1, T1-M and T1-3S Tuya BK7238 modules, pinouts and flashing, Home Assistant
    You can change its firmware – all you need is a USB-to-UART converter:
    What was the Tuya Wi-Fi module doing inside the computer? Updating the PC Power Switch Remote firmwa
    First, we burn the firmware using our Flasher, then we upload the OBK:
    https://github.com/openshwprojects/BK7231GUIFlashTool
    Copy of the firmware:
    https://github.com/openshwprojects/FlashDumps/commit/f731ea9b6c9477ab72163f2231dbda793ee3239b
    However, the Flasher did not detect the GPIO this time:
    What was the Tuya Wi-Fi module doing inside the computer? Updating the PC Power Switch Remote firmwa
    We identified the GPIO roles by tracing the paths:
    Code: JSON
    Log in, to see the code

    There are two ways to script the device.
    1. in Home Assistant using their automations
    2. on the Beken board itself, via autoexec.bat
    Autoexec.bat allows the OBK to handle device events and add buttons to the main panel:
    
    
    alias force_power_off backlog setChannel 1 1; addRepeatingEvent 5 1 setChannel 1 0
    alias short_click backlog setChannel 1 1; addRepeatingEvent 1 1 setChannel 1 0
    
    startDriver httpButtons
    
    setButtonEnabled 0 1
    setButtonLabel 0 "Toggle Power"
    setButtonCommand 0 short_click 
    
    setButtonEnabled 1 1
    setButtonLabel 1 "Force POWER off"
    setButtonCommand 1 force_power_off 
    
    SetChannelLabel 1 PWR
    SetChannelLabel 2 RESET
    SetChannelLabel 3 PWR_ON
    
    addEventHandler OnHold 21 force_power_off 
    addEventHandler OnClick 21 short_click
    

    The script above:
    - sets the channel names
    - adds events that manually map a button click and a long press to a short and long relay closure respectively
    - adds buttons to the UI that trigger these events – these will then also be visible in Home Assistant
    Screenshot of the panel with a single scripted button:
    What was the Tuya Wi-Fi module doing inside the computer? Updating the PC Power Switch Remote firmwa
    Similarly, you can add a RESET button (a second button and relay):
    Home Assistant dashboard showing PWR and RESET controls and an MQTT activity log
    This way, you can bring this module to life without the cloud. There is still the matter of the child lock – the remote lock. This can be added by including an additional condition check in the button and event handling via if :
    
    SetChannelLabel 10 "Child Lock"
    
    addEventHandler OnHold 21 if $CH10==1 then force_power_off 
    

    Then, click events will only be triggered when we allow them to.

    Of course, this isn’t the only way to configure it. One could, for example, attempt to hard-code the connection between the buttons and the relays by assigning the inputs the dInput role (digital input) and the same channels as the relays, but then we would lose remote control. The digital value from the inputs would be copied to the outputs. For this reason, scripting seems to be the sensible solution here.

    For more information, please visit the project repository , the page with documentation and the examples of OBK scripts .

    To sum up , the module seems quite useful. It works well both in its factory-set state, where you immediately gain remote access via the Tuya app, and after a firmware update, when using Home Assistant or a similar system connected to the internet.
    The usefulness of this solution is somewhat diminished by the fact that many computers can be booted remotely via Wake-on-LAN. However, this is not always convenient to set up from outside the local network, and some hardware configurations do not support it at all. For this reason, such a module can still prove very practical as a simple way to boot a computer remotely, particularly when combined with a remote desktop configured to be accessible immediately after the system starts up.
    In addition, there is the option to remotely reset the computer and use the ‘child lock’ function, which locks the physical buttons on the case.
    Can you think of any interesting uses for such a remote PC power switch?

    Cool? Ranking DIY
    Helpful post? Buy me a coffee.
    About Author
    p.kaczmarek2
    Moderator Smart Home
    Offline 
    p.kaczmarek2 wrote 14624 posts with rating 12643, helped 655 times. Been with us since 2014 year.
  • ADVERTISEMENT
  • #2 21926449
    mkpl
    Level 37  
    Posts: 5665
    Help: 306
    Rate: 855
    I’m a bit disappointed. At first glance, I thought the computer was controlled via a bus (which would have been interesting). Unfortunately, it’s controlled via cables and the PCIe is just for power. In this version, it’s a waste of a slot.
  • ADVERTISEMENT
  • #3 21926474
    j4rek
    Level 19  
    Posts: 370
    Help: 8
    Rate: 103
    A standby voltage is required (available on the PCIe 3.3V aux connector). Alternatively, you would need to tap into the power supply’s wiring (the 5V standby line, pin 9, purple wire) and convert the 5V to 3.3V.
  • #4 21926475
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14624
    Help: 655
    Rate: 12643
    That’s an interesting idea about controlling it via PCIe – the question is, just how practical is it? Does anyone know whether controlling it via PCIe would make sense, whether it would offer any added benefits, and whether it would even be possible? Perhaps I could consider a DIY version.
    Helpful post? Buy me a coffee.
📢 Listen (AI):
ADVERTISEMENT