logo elektroda
logo elektroda
X
logo elektroda

TOB9-63M Smart Switch Freezes After Adding SetStartValue Command with OpenBK

Exkilla 855 11
ADVERTISEMENT
  • #1 20895551
    Exkilla
    Level 2  

    Hello! I bought the "TOB9-63M" WIFI Smart Switch Energy Meter Relay. I made the backup and flashed "OpenBK7231N_QIO_1.17.391.bin". Everything worked fine until I added "SetStartValue 1 1;" to the startup command line. The device hangs after restart and the LEDs light up a little. If I re-flash the OpenBK firmware - nothing changes. It still hangs. If I restore the original firmware (Tuya) from the backup - the relay works fine. Please tell me what the problem is and how to solve it?
  • ADVERTISEMENT
  • Helpful post
    #2 20896320
    p.kaczmarek2
    Moderator Smart Home
    I can check that SetStartValue command, but can you show your full script?

    Futhermore, why are you using this command? It should be possible to do the same from GUI...

    Maybe you are using it in some kind of way that was not predicted by us at the development stage.

    Alternatively, you can just put a setChannel call in your script and set channel to 1, it will work in a very similiar way... or maybe even better, if that's TuyaMCU device
    Helpful post? Buy me a coffee.
  • #3 20896946
    Exkilla
    Level 2  

    The final startup command was something like:

    backlog SetStartValue 1 1; startDriver NTP; ntp_setServer 217.147.223.78; ntp_timeZoneOfs 2; startDriver BL0942; SetupEnergyStats 1 60 5;

    But the problem is that even if I now rewrite OpenBK firmware with clean OBK settings - device hangs. Relay works only if I flash original firmware which I dumped before flashing OpenBK.
  • Helpful post
    #4 20896962
    p.kaczmarek2
    Moderator Smart Home
    Which flashing tool are you using to write firmware?

    Our flasher has option to clear command line, I think.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 20896988
    Exkilla
    Level 2  

    I use "BK7231Flasher". Command line is clear but the device doesn't boot with OpenBK.
  • ADVERTISEMENT
  • Helpful post
    #6 20897089
    p.kaczmarek2
    Moderator Smart Home
    Ok, so what does the debug log output on TX2 say?
    Helpful post? Buy me a coffee.
  • #7 20897368
    Exkilla
    Level 2  
    Thanks for the tip. I soldered the wire to TX2 and checked the console output. It turned out that the device was booting. For some reason the pin assignment was simply reset after changing startup command and restart the device.

    For now, I have another problem. I set these pins settings:

      "pins": {
        "9": "LED;1",
        "15": "WifiLED;1",
        "17": "Btn_Tgl_All;1",
        "24": "BridgeFWD;1",
        "26": "BridgeREV;1"
      },

    If I press "Toggle 1" button in the web-interface - I hear click and relay changes the state. But if I press the button on the device - nothing happens. Flag 41(Ignore all button events) isn't active. What can be wrong?
  • #8 20897584
    p.kaczmarek2
    Moderator Smart Home
    Is there some information in log when you press the button on the device?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #10 20906463
    Exkilla
    Level 2  

    I checked "src" of firmware. "Btn_Tgl_All" works with relays only. But we have type "Bridge".

    void CHANNEL_DoSpecialToggleAll() {
    	int anyEnabled, i;
    	anyEnabled = 0;
    	for (i = 0; i < CHANNEL_MAX; i++) {
    		if (CHANNEL_IsPowerRelayChannel(i) == false)
    			continue;
    		if (g_channelValues[i] > 0) {
    			anyEnabled = true;
    		}
    	}
    	for (i = 0; i < CHANNEL_MAX; i++) {
    		if (CHANNEL_IsPowerRelayChannel(i)) {
    			CHANNEL_Set(i, !anyEnabled, 0);
    		}
    	}
    }

    bool CHANNEL_IsPowerRelayChannel(int ch) {
    	int i;
    	for (i = 0; i < PLATFORM_GPIO_MAX; i++) {
    		if (g_cfg.pins.channels[i] == ch) {
    			int role = g_cfg.pins.roles[i];
    			// NOTE: do not include Battery relay
    			if (role == IOR_Relay || role == IOR_Relay_n) {
    				return true;
    			}
    		}
    	}
    	return false;
    }

    Maybe need to replace line in the function "CHANNEL_IsPowerRelayChannel" from:
    if (role == IOR_Relay || role == IOR_Relay_n) {
    to:
    if (role == IOR_Relay || role == IOR_Relay_n || role == IOR_BridgeForward || role == IOR_BridgeReverse) {

    Is it correct?

    P.S. We can't just change the type to "Relay" because device is getting very hot (mentioned in another topic about this device). Bistable relay is used.
  • #11 20906548
    p.kaczmarek2
    Moderator Smart Home
    That's very good finding, I've applied your fix. Please update and retry.
    Helpful post? Buy me a coffee.
  • #12 20906660
    Exkilla
    Level 2  
    It works fine now! Thanks! =)

Topic summary

The discussion revolves around issues faced with the TOB9-63M WiFi Smart Switch after adding the "SetStartValue 1 1;" command to the startup script while using the OpenBK firmware. The device freezes upon restart, and re-flashing the firmware does not resolve the issue, while the original Tuya firmware works fine. Users suggest checking the full script and using alternative commands. The author later discovers that the pin assignments reset after changing the startup command. Despite setting the pins correctly, the physical button on the device does not respond, leading to further investigation into the firmware's handling of button events. A proposed fix involves modifying the firmware code to recognize the device's bridge role, which ultimately resolves the issue.
Summary generated by the language model.
ADVERTISEMENT