Elektroda.com
Elektroda.com
X

HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch

marioalmeida 4590 21
  • Product information
    Tuya 4 CH touch switch for Roma fitting for Indian homes, it has CB3S chip (BK7231N)

    https://amzn.eu/d/3K8uk6I
    HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch

    Technical Specs
    TuyaMCU: T1616-N TH 2720E (ATTINY1616)
    Darlington transistor array ULN2003A
    Relay: 5A 230V x 4
    Power Module: HLK-PM01L

    This switch consists of 3 board, soldered with long header pins,
    Top board is the controller board, top side is with the touch buttons, and on the other side it has CB3S and TuyaMCU, after that, is the relay board and then the power board.

    Total dpId 12
    
    0 Object { dpName: "Switch 1", dpId: 1 }
    1 Object { dpName: "Switch 2", dpId: 2 }
    2 Object { dpName: "Switch 3", dpId: 3 }
    3 Object { dpName: "Delay-off Schedule", dpId: 19 }
    4 Object { dpName: "Switch 4", dpId: 4 }
    5 Object { dpName: "Timer 1", dpId: 7 }
    6 Object { dpName: "Timer 2", dpId: 8 }
    7 Object { dpName: "Test Bit", dpId: 24 }
    8 Object { dpName: "Timer 3", dpId: 9 }
    9 Object { dpName: "Timer 4", dpId: 10 }
    10  Object { dpName: "Master Switch", dpId: 13 }
    11  Object { dpName: "Memory Status", dpId: 14 }
    

    Teardown
    HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch
    HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch

    Prepare for firmware upload
    HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch
    download the latest firmware from https://github.com/openshwprojects/OpenBK7231T_App/releases/

    Create autoexec.bat file with below content
    
    startDriver TuyaMCU
    
    setChannelType 1 toggle
    setChannelType 2 toggle
    setChannelType 3 toggle
    setChannelType 4 toggle
    setChannelType 13 toggle
    
    setChannelType 7 TextField
    setChannelType 8 TextField
    setChannelType 9 TextField
    setChannelType 10 TextField
    
    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 1 2
    linkTuyaMCUOutputToChannel 3 1 3
    linkTuyaMCUOutputToChannel 4 1 4
    linkTuyaMCUOutputToChannel 7 2 7
    linkTuyaMCUOutputToChannel 8 2 8
    linkTuyaMCUOutputToChannel 9 2 9
    linkTuyaMCUOutputToChannel 10 2 10
    linkTuyaMCUOutputToChannel 13 1 13
    


    After upload is done. open http://192.168.4.1/app, go to Filesystem and drop the autoexec.bat file in the "drop file(s) here" box, reboot the device, change the host-name, connect to the network, configure MQTT and start using the device with you home automation system.

    Added after 7 [hours] 8 [minutes]:

    @p.kaczmarek2 how to configure the below 2 dbId?
    { dpName: "Delay-off Schedule", dpId: 19 }
    { dpName: "Memory Status", dpId: 14 }

    Cool? Ranking DIY
    About Author
    marioalmeida
    Level 10  
    Offline 
    marioalmeida wrote 47 posts with rating 21. Been with us since 2022 year.
  • #2
    parmarshailendra47
    Level 2  
    after flashing and finishing the config. toggles are visible but relays are not working. when pressed shoing below in log. but nothing happens to relay.
    Info:MQTT:Channel has changed! Publishing 1 to channel 1
    Info:MQTT:Publishing val 1 to TouchSwitch/1/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic TouchSwitch/1/get
    Info:MQTT:MQTT in topic TouchSwitch/1/get
    Info:MQTT:MQTT topic not handled: TouchSwitch/1/get
    Info:MQTT:channelSet part topic 1/get
    Info:MQTT:channelSet channel 1
    Info:MQTT:channelSet NOT 'set'
    Info:MQTT:Channel has changed! Publishing 1 to channel 2
    Info:MQTT:Publishing val 1 to TouchSwitch/2/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic TouchSwitch/2/get
    Info:MQTT:MQTT in topic TouchSwitch/2/get
    Info:MQTT:MQTT topic not handled: TouchSwitch/2/get
    Info:MQTT:channelSet part topic 2/get
    Info:MQTT:channelSet channel 2
    Info:MQTT:channelSet NOT 'set'
    Info:MQTT:Channel has changed! Publishing 1 to channel 3
    Info:MQTT:Publishing val 1 to TouchSwitch/3/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic TouchSwitch/3/get
    Info:MQTT:MQTT in topic TouchSwitch/3/get
    Info:MQTT:MQTT topic not handled: TouchSwitch/3/get
    Info:MQTT:channelSet part topic 3/get
    Info:MQTT:channelSet channel 3
    Info:MQTT:channelSet NOT 'set'
    Info:MQTT:Channel has changed! Publishing 1 to channel 4
    Info:MQTT:Publishing val 1 to TouchSwitch/4/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic TouchSwitch/4/get
    Info:MQTT:MQTT in topic TouchSwitch/4/get
    Info:MQTT:MQTT topic not handled: TouchSwitch/4/get
    Info:MQTT:channelSet part topic 4/get
    Info:MQTT:channelSet channel 4
    Info:MQTT:channelSet NOT 'set'


    also some time the relays and switches working automatically like the below video.





    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 04 01 00 01 00 14
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 4, dataType 1-DP_TYPE_BOOL and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte:
    Info:MQTT:Channel has changed! Publishing 0 to channel 4
    Info:MQTT:Publishing val 0 to TouchSwitch/4/get retain=0
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 02 01 00 01 00 12
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 2, dataType 1-DP_TYPE_BOOL and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte:
    Info:MQTT:Channel has changed! Publishing 0 to channel 2
    Info:MQTT:Publishing val 0 to TouchSwitch/2/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic TouchSwitch/4/get
    Info:MQTT:MQTT in topic TouchSwitch/4/get
    Info:MQTT:MQTT topic not handled: TouchSwitch/4/get
    Info:MQTT:channelSet part topic 4/get
    Info:MQTT:channelSet channel 4
    Info:MQTT:channelSet NOT 'set'
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic TouchSwitch/2/get
    Info:MQTT:MQTT in topic TouchSwitch/2/get
    Info:MQTT:MQTT topic not handled: TouchSwitch/2/get
    Info:MQTT:channelSet part topic 2/get
    Info:MQTT:channelSet channel 2
    Info:MQTT:channelSet NOT 'set'
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 04 01 00 01 01 15
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 4, dataType 1-DP_TYPE_BOOL and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:MQTT:Channel has changed! Publishing 1 to channel 4
    Info:MQTT:Publishing val 1 to TouchSwitch/4/get retain=0
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 04 01 00 01 00 14
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 4, dataType 1-DP_TYPE_BOOL and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte:
    Info:MQTT:Channel has changed! Publishing 0 to channel 4
    Info:MQTT:Publishing val 0 to TouchSwitch/4/get retain=0
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 02 01 00 01 01 13
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 2, dataType 1-DP_TYPE_BOOL and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:MQTT:Channel has changed! Publishing 1 to channel 2
    Info:MQTT:Publishing val 1 to TouchSwitch/2/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic TouchSwitch/4/get
    Info:MQTT:MQTT in topic TouchSwitch/4/get
    Info:MQTT:MQTT topic not handled: TouchSwitch/4/get
    Info:MQTT:channelSet part topic 4/get
    Info:MQTT:channelSet channel 4
    Info:MQTT:channelSet NOT 'set'
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic TouchSwitch/4/get
    Info:MQTT:MQTT in topic TouchSwitch/4/get
    Info:MQTT:MQTT topic not handled: TouchSwitch/4/get
    Info:MQTT:channelSet part topic 4/get
    Info:MQTT:channelSet channel 4
    Info:MQTT:channelSet NOT 'set'
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic TouchSwitch/2/get
    Info:MQTT:MQTT in topic TouchSwitch/2/get
    Info:MQTT:MQTT topic not handled: TouchSwitch/2/get
    Info:MQTT:channelSet part topic 2/get
    Info:MQTT:channelSet channel 2
    Info:MQTT:channelSet NOT 'set'
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 04 01 00 01 01 15
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 4, dataType 1-DP_TYPE_BOOL and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:MQTT:Channel has changed! Publishing 1 to channel 4
    Info:MQTT:Publishing val 1 to TouchSwitch/4/get retain=0
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 02 01 00 01 00 12
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 2, dataType 1-DP_TYPE_BOOL and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte:
    Info:MQTT:Channel has changed! Publishing 0 to channel 2
    Info:MQTT:Publishing val 0 to TouchSwitch/2/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic TouchSwitch/4/get
    Info:MQTT:MQTT in topic TouchSwitch/4/get
    Info:MQTT:MQTT topic not handled: TouchSwitch/4/get
    Info:MQTT:channelSet part topic 4/get
    Info:MQTT:channelSet channel 4
    Info:MQTT:channelSet NOT 'set'
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic TouchSwitch/2/get
    Info:MQTT:MQTT in topic TouchSwitch/2/get
    Info:MQTT:MQTT topic not handled: TouchSwitch/2/get
    Info:MQTT:channelSet part topic 2/get
    Info:MQTT:channelSet channel 2
    Info:MQTT:channelSet NOT 'set'

    Added after 1 [minutes]:

    @marioalmeida
  • #3
    marioalmeida
    Level 10  
    when you press the touch button, do you see normal functions?

    Note:- OBK firmware will interact with the Tuya MCU and not directly with the relays. if there is any issue with the firmware, the touch buttons must work.
  • #4
    parmarshailendra47
    Level 2  
    Yes , all touch button is working normal and operate relay when pressed.
  • #5
    marioalmeida
    Level 10  
    Can you attached the device autoexec file?
  • #6
    parmarshailendra47
    Level 2  
    This is the content of autoexec.bat

    Moderated By p.kaczmarek:

    You have tuyaMcu_setBaudRate call before you startDriver TuyaMCU! The tuyaMcu_setBaudRate call will be ignored. Please be aware that you always have to start the driver first!



    tuyaMcu_setBaudRate 115200
    
    startDriver TuyaMCU
    
    setChannelType 1 toggle
    setChannelType 2 toggle
    setChannelType 3 toggle
    setChannelType 4 toggle
    setChannelType 13 toggle
    
    setChannelType 7 TextField
    setChannelType 8 TextField
    setChannelType 9 TextField
    setChannelType 10 TextField
    
    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 1 2
    linkTuyaMCUOutputToChannel 3 1 3
    linkTuyaMCUOutputToChannel 4 1 4
    linkTuyaMCUOutputToChannel 7 2 7
    linkTuyaMCUOutputToChannel 8 2 8
    linkTuyaMCUOutputToChannel 9 2 9
    linkTuyaMCUOutputToChannel 10 2 10
    linkTuyaMCUOutputToChannel 13 1 13


    HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch
  • #7
    DCG
    Level 4  
    Hey team, any further help in this device ? I have flashed OpenBK7231N via Tuya cloud cutter and now stuck...

    @parmarshailendra47 any luck with this device ?
  • #8
    DCG
    Level 4  
    Update - Switch is working fine and able to integrate with Home Assistant aswell :)

    I just went thru the details in the OP again and followed the "autoexec.bat" instructions.

    -- Open Web App
    -- File System tab
    -- Create a file (autoexec.bat) and click on the newly created autoexec.bat button
    -- Copy & paste the entire code (startDriver TuyaMCU) mentioned in the OP on the right side dialog box
    -- Click save & restart the device....

    you are now all set and device will work fine... tested & confirmed. (working fine in Home Assistant)
    HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch

    the issue mentioned by @parmarshailendra47 seems to be a faulty device.
  • #9
    DCG
    Level 4  
    @p.kaczmarek2 I have a quick query regarding this device

    Everything is perfectly working, I have noticed that the small Wifi Led on the switch keeps blinking even though its connected to Wifi..
    Is there any settings that I need to change to stop the led blinking ?
  • #10
    p.kaczmarek2
    Moderator Smart Home
    If you have a TuyaMCU device, and it has a LED blinking, it means you need to either:
    - connect to MQTT so OBK reports it's "connected to cloud" to TuyaMCU
    - or add following line to autoexec.bat:
    
    tuyaMcu_defWiFiState 4
    
  • #11
    DCG
    Level 4  
    Yes once connected to MQTT issue has been resolved, no more led blinking.
  • #12
    p.kaczmarek2
    Moderator Smart Home
    If you want to totally disable led blinking, no matter the MQTT state, add the following line to autoexec.bat script:
    
    tuyaMcu_defWiFiState 4
    

    See the list of available WiFi states in TuyaMCU:
    Network statusDescriptionStatus value
    Status 1Pairing in EZ mode. (For Wi-Fi and Bluetooth LE combo module: Bluetooth is also in pairing mode.)0x00
    Status 2Pairing in AP mode. (For Wi-Fi and Bluetooth LE combo module: Bluetooth is also in pairing mode.)0x01
    Status 3The Wi-Fi network is set up, but the device is not connected to the router.0x02
    Status 4The Wi-Fi network is set up, and the device is connected to the router.0x03
    Status 5The device is connected to the cloud.0x04
    Status 6Tuya’s network module is in low power mode.0x05
    Status 7EZ mode and AP mode coexist. (For Wi-Fi and Bluetooth LE combo module: Bluetooth is also in pairing mode.)0x06
  • #13
    latocheski
    Level 3  
    p.kaczmarek2 wrote:
    If you want to totally disable led blinking, no matter the MQTT state, add the following line to autoexec.bat script:
    
    tuyaMcu_defWiFiState 4
    



    Hello!

    I set this property "tuyaMcu_defWiFiState 4" in my device which I recorded in my CB2S chip - BK7231N (autoexec.bat) but even so it keeps blinking.




    I tested other values but without success. This is my complete .bat:

    
    startDriver TuyaMCU
    
    tuyaMcu_defWiFiState 4
    
    setChannelType 1 toggle
    setChannelType 2 toggle
    setChannelType 3 toggle
    setChannelType 4 toggle
    setChannelType 5 toggle
    
    setChannelLabel 5 "All"
    
    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 1 2
    linkTuyaMCUOutputToChannel 3 1 3
    linkTuyaMCUOutputToChannel 4 1 4
    linkTuyaMCUOutputToChannel 38 1 5
    
    alias set_all_on backlog setChannel 1 1; setChannel 2 1; setChannel 3 1; setChannel 4 1;
    alias set_all_off backlog setChannel 1 0; setChannel 2 0; setChannel 3 0; setChannel 4 0;
    alias myToggle if $CH1||$CH2||$CH3||$CH4 then set_all_off else set_all_on
    addEventHandler OnChannelChange 5 myToggle
    

    HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch
    Another problem that is happening is that I can turn on the buttons through MQTT or web interface but I can't turn off, I couldn't solve it in a simple way, but if I define this:
    
    
    ...
    setChannelType 7 TextField
    setChannelType 8 TextField
    setChannelType 9 TextField
    setChannelType 10 TextField
    setChannelType 13 TextField
    
    linkTuyaMCUOutputToChannel 7 2 7
    linkTuyaMCUOutputToChannel 8 2 8
    linkTuyaMCUOutputToChannel 9 2 9
    linkTuyaMCUOutputToChannel 10 2 10
    linkTuyaMCUOutputToChannel 13 1 13
    ...
    


    it works, setting a value of "1" on the interface, unsuccessfully with MQTT/interface button.

    The model in question is manufactured by NovaDigital, a Brazilian model. There is 4 touch buttons.
    HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch
  • #14
    p.kaczmarek2
    Moderator Smart Home
    lucianolatochesk wrote:

    I set this property "tuyaMcu_defWiFiState 4" in my device which I recorded in my CB2S chip - BK7231N (autoexec.bat) but even so it keeps blinking.




    But everything else is working? Or maybe you are missing baud setting and there is no communication at all?

    Disconnect power entirely from device and reconnect it.
    lucianolatochesk wrote:

    Another problem that is happening is that I can connect the buttons through MQTT or web interface but I can't disconnect, I couldn't solve it in a simple way, but if I define this:

    If I understand you correctly, this is because you still have "Toggle" channel types if you open Web App, on the right column. Change those channel types manually back to default one and Toggles (buttons) from HTTP panel will disappear, unless you set them again in autoexec.
  • #15
    latocheski
    Level 3  
    p.kaczmarek2 wrote:
    But everything else is working? Or maybe you are missing baud setting and there is no communication at all?

    Sorry, i'll explain better:

    The device works fine, i can turn on in the web interface and MQTT, but can't turn off. Only button back to the "off" state, the device not. I need to touch on the physical button to back off state.

    Added after 2 [minutes]:

    If I define some baud (tried: 115200, 921600 and 1500000), the buttons/MQTT doesn't work more.
    like: "tuyaMcu_setBaudRate 115200"
  • #16
    p.kaczmarek2
    Moderator Smart Home
    This is very strange.

    Backup your config and try:
    
    startDriver TuyaMCU
    tuyaMcu_defWiFiState 4
    setChannelType 1 toggle
    linkTuyaMCUOutputToChannel 1 1 1
    

    The following code should allow you to both turn on and off the first relay... check it and tell me whether the bug persists.
  • #17
    latocheski
    Level 3  
    p.kaczmarek2 wrote:
    check it and tell me whether the bug persists.

    Unfortunately, same.



    HomeMate Wi-Fi + Bluetooth Smart 4 Gang Touch Switch
  • #18
    p.kaczmarek2
    Moderator Smart Home
    Now, do the following steps:
    1. open Web App -> Log
    2. Disconnect all power from device
    3. Clear log
    4. Connect power to the device
    5. Wait for it to connect to WiFi
    6. Press the physical buttons several times (4+) on the device
    7. Copy Web App log to file, clear Web App log
    8. Press HTML GUI button several times (4+)
    8. Copy Web App log to another file
    Paste here the two logs. I want to see their content

    Alternatively, do you have unflashed version of this device to do the UART capture with original Tuya firmware?
  • #19
    latocheski
    Level 3  
    p.kaczmarek2 wrote:
    6. Press the physical buttons several times (4+) on the device

    Ok, the first boot:
    I switched the physical button more than 10 times but apparently there is no log
    
    Info:MAIN:Main_Init_Before_Delay
    Info:CFG:####### Boot Count 123 #######
    Warn:CFG:CFG_InitAndLoad: Correct config has been loaded with 16 changes count.
    Error:CMD:no file early.bat err -2
    Info:GEN:PIN_SetupPins pins have been set up.
    Info:MAIN:Main_Init_Before_Delay done
    Info:MAIN:Main_Init_Delay
    Info:MAIN:Main_Init_Delay done
    Info:MAIN:Main_Init_After_Delay
    Info:MAIN:Using SSID [edited]
    Info:MAIN:Using Pass [edited]
    Info:MQTT:MQTT_RegisterCallback called for bT homeassistant/ subT homeassistant/+/set
    Info:MQTT:MQTT_RegisterCallback called for bT switch_/ subT switch_/+/set
    Info:MQTT:MQTT_RegisterCallback called for bT cmnd/homeassistant/ subT cmnd/homeassistant/+
    Info:MQTT:MQTT_RegisterCallback called for bT cmnd/switch_/ subT cmnd/switch_/+
    Info:MQTT:MQTT_RegisterCallback called for bT homeassistant/ subT homeassistant/+/get
    Info:CMD:CMD_StartScript: started autoexec.bat at the beginning
    Info:MAIN:Main_Init_After_Delay done
    Info:MAIN:Started TuyaMCU.
    Info:GEN:Channel 1 type changed to toggle
    Info:MAIN:Time 1, idle 277551/s, free 76792, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 2, idle 186486/s, free 76792, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 3, idle 185606/s, free 76792, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 4, idle 187846/s, free 76792, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 5, idle 186611/s, free 76792, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:ssid:HOME key:edited
    Info:MAIN:Time 6, idle 177864/s, free 72064, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Boot complete time reached (5 seconds)
    Info:CFG:####### Set Boot Complete #######
    Info:MAIN:Time 7, idle 182073/s, free 71536, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 8, idle 83338/s, free 71848, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 9, idle 0/s, free 71848, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 10, idle 0/s, free 71848, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=0.0.0.0 gate=0.0.0.0 mask=0.0.0.0 mac=fc:67:1f:42:77:08
    Info:GEN:sta: 0, softap: 0, b/g/n
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING - 1
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    Info:MAIN:Time 11, idle 95493/s, free 71944, MQTT 0(0), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 12, idle 185199/s, free 71984, MQTT 0(0), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    Info:MQTT:mqtt_userName edited
    mqtt_pass edited
    mqtt_clientID homeassistant
    mqtt_host 192.168.1.129:1883
    Info:MAIN:Time 13, idle 183910/s, free 71880, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 14, idle 181398/s, free 71880, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:mqtt_connection_cb: Successfully connected
    Info:MQTT:mqtt_subscribed to homeassistant/+/set
    Info:MQTT:mqtt_subscribed to switch_/+/set
    Info:MQTT:mqtt_subscribed to cmnd/homeassistant/+
    Info:MQTT:mqtt_subscribed to cmnd/switch_/+
    Info:MQTT:mqtt_subscribed to homeassistant/+/get
    Info:MQTT:Publishing val s4x to homeassistant/host retain=0
    Info:MAIN:Time 15, idle 175169/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val Build on Sep  8 2023 14:40:34 version 1.17.240 to homeassistant/build retain=0
    Info:MAIN:Time 16, idle 187681/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val fc:67:1f:42:77:08 to homeassistant/mac retain=0
    Info:MAIN:Time 17, idle 186193/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val HOME to homeassistant/ssid retain=0
    Info:MAIN:Time 18, idle 178860/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val 2 to homeassistant/sockets retain=0
    Info:MAIN:Time 19, idle 187724/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val -75 to homeassistant/rssi retain=0
    Info:MAIN:Time 20, idle 370713/s, free 71664, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:GEN:dhcp=0 ip=192.168.1.244 gate=192.168.1.254 mask=255.255.255.0 mac=fc:67:1f:42:77:08
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-75,ssid=HOME,bssid=d8:77:8b:02:48:91,channel=11,cipher_type:MIXED
    Info:MQTT:Publishing val 20 to homeassistant/uptime retain=0
    Info:MAIN:Time 21, idle 180223/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val 71880 to homeassistant/freeheap retain=0
    Info:MAIN:Time 22, idle 181436/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val 192.168.1.244 to homeassistant/ip retain=0
    Info:MAIN:Time 23, idle 184080/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to homeassistant/1/get retain=0
    Info:MAIN:Time 24, idle 185630/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MAIN:Time 25, idle 195836/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 26, idle 202410/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 27, idle 185536/s, free 71664, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:MAIN:Time 28, idle 373410/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 29, idle 188790/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 30, idle 183761/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=192.168.1.244 gate=192.168.1.254 mask=255.255.255.0 mac=fc:67:1f:42:77:08
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-68,ssid=HOME,bssid=d8:77:8b:02:48:91,channel=11,cipher_type:MIXED
    Info:MAIN:Time 31, idle 183809/s, free 71456, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:MAIN:Time 32, idle 188952/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 33, idle 185805/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 34, idle 185560/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 35, idle 189167/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 36, idle 186778/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 37, idle 189019/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 38, idle 185368/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 39, idle 188384/s, free 60184, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:MAIN:Time 40, idle 195778/s, free 60184, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:GEN:dhcp=0 ip=192.168.1.244 gate=192.168.1.254 mask=255.255.255.0 mac=fc:67:1f:42:77:08
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-63,ssid=HOME,bssid=d8:77:8b:02:48:91,channel=11,cipher_type:MIXED
    Info:MAIN:Time 41, idle 181914/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 42, idle 189365/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    

    p.kaczmarek2 wrote:
    8. Press HTML GUI button several times (4+)

    Now, on the web interface:
    
    Info:MAIN:Time 61, idle 185125/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 1 to channel 1 
    Info:MQTT:Publishing val 1 to homeassistant/1/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MAIN:Time 62, idle 176710/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to homeassistant/1/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MAIN:Time 63, idle 175794/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 1 to channel 1 
    Info:MQTT:Publishing val 1 to homeassistant/1/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to homeassistant/1/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MAIN:Time 64, idle 183446/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 1 to channel 1 
    Info:MQTT:Publishing val 1 to homeassistant/1/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to homeassistant/1/get retain=0
    Info:MAIN:Time 65, idle 172357/s, free 59976, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MQTT:Channel has changed! Publishing 1 to channel 1 
    Info:MQTT:Publishing val 1 to homeassistant/1/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to homeassistant/1/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MAIN:Time 66, idle 166827/s, free 60184, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:MQTT:Channel has changed! Publishing 1 to channel 1 
    Info:MQTT:Publishing val 1 to homeassistant/1/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to homeassistant/1/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MAIN:Time 67, idle 171492/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 1 to channel 1 
    Info:MQTT:Publishing val 1 to homeassistant/1/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to homeassistant/1/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MQTT:Channel has changed! Publishing 1 to channel 1 
    Info:MQTT:Publishing val 1 to homeassistant/1/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MAIN:Time 68, idle 162350/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to homeassistant/1/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MAIN:Time 69, idle 184979/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 1 to channel 1 
    Info:MQTT:Publishing val 1 to homeassistant/1/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic homeassistant/1/get
    Info:MAIN:Time 70, idle 177675/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=192.168.1.244 gate=192.168.1.254 mask=255.255.255.0 mac=fc:67:1f:42:77:08
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-72,ssid=HOME,bssid=d8:77:8b:02:48:91,channel=11,cipher_type:MIXED
    


    p.kaczmarek2 wrote:
    Alternatively, do you have unflashed version of this device to do the UART capture with original Tuya firmware?

    I was unable to read the original firmware, the program stopped at the first reading of the hex.
  • #20
    p.kaczmarek2
    Moderator Smart Home
    marioalmeida wrote:

    @p.kaczmarek2 how to configure the below 2 dbId?
    { dpName: "Delay-off Schedule", dpId: 19 }
    { dpName: "Memory Status", dpId: 14 }


    dpID 14 describes the state of the device after power up. So, for example, if you lose power in the house, what happens when power comes back.
    dpID 14 has 3 options:
    - 0 , means "off by default"
    - 1, means "on by default"
    - 2, means "remember last state"

    You can set it manually via command:
    
    // [dpID] [type] [value]
    tuyaMcu_sendState 14 4 0
    

    The type is 4 here because it's enum, this variable is using enumeration type.

    You can also put that on Gui with a channel type OffOnRemember:
    https://github.com/openshwprojects/OpenBK7231T_App/commit/c948af2a3af4abbbdab6c09bb7fb5f6ef14f4f0a
    More details later
  • #21
    latocheski
    Level 3  
    >>20727005
    @p.kaczmarek2

    I did some tests using this configuration:

    setChannelType 7 toggle
    linkTuyaMCUOutputToChannel 7 2 7

    Thus, when activating the button through the web interface, it turns on or off, similar to a push button. The LEDs don't stop blinking either!