logo elektroda
logo elektroda
X
logo elektroda

[BK7231N/CB2S] Moes Curtain. TuyaMCU: Button Bindings and Setup Assistance Needed

Eucli 1191 14
ADVERTISEMENT
  • #1 21083731
    Eucli
    Level 3  
    Good morning,
    I'm brand new to this forum
    I bought this on Aliexpress ]Link
    Shutter control panel with three touch buttons
    Electronic module with three white buttons and wiring on a circuit board. Close-up of an electronic module featuring a CB2S module with connected wires.

    I managed to flash the CB2S everything works well the device uses TuyaMCU.

    Unfortunately I can't find the bind of the buttons

    Info:TuyaMCU:Received: 55 AA 00 07 00 05 01 04 00 01 02 13 
    Info:TuyaMCU:ProcessIncoming[v=0]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 1 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 2
    Info:TuyaMCU:Received: 55 AA 00 00 00 01 01 01 
    Info:TuyaMCU:ProcessIncoming[v=0]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 00 07 00 08 02 02 00 04 00 00 00 61 77 
    Info:TuyaMCU:ProcessIncoming[v=0]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 97
    Info:TuyaMCU:Received: 55 AA 00 07 00 05 01 04 00 01 01 12 
    Info:TuyaMCU:ProcessIncoming[v=0]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 1 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 1
    Info:TuyaMCU:Received: 55 AA 00 07 00 05 01 04 00 01 01 12 
    Info:TuyaMCU:ProcessIncoming[v=0]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 1 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 1
    Info:TuyaMCU:Received: 55 AA 00 03 00 00 02 
    Info:TuyaMCU:ProcessIncoming[v=0]: cmd 3 (WiFiState) len 7
    Info:TuyaMCU:Received: 55 AA 00 07 00 05 07 01 00 01 01 15 
    Info:TuyaMCU:ProcessIncoming[v=0]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 7 type 1-bool len 1
    Info:TuyaMCU:ParseState: byte 1
    Info:TuyaMCU:Received: 55 AA 00 07 00 05 08 04 00 01 00 18 
    Info:TuyaMCU:ProcessIncoming[v=0]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 8 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 0
    Info:TuyaMCU:Received: 55 AA 00 07 00 08 02 02 00 04 00 00 00 61 77 
    Info:TuyaMCU:ProcessIncoming[v=0]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 2 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 97
    Info:TuyaMCU:Received: 55 AA 00 07 00 05 01 04 00 01 01 12 
    Info:TuyaMCU:ProcessIncoming[v=0]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 1 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 1
    Info:TuyaMCU:Received: 55 AA 00 07 00 08 0A 02 00 04 00 00 00 1E 3C 
    Info:TuyaMCU:ProcessIncoming[v=0]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 10 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 30
    Info:TuyaMCU:Received: 55 AA 00 00 00 01 01 01 
    Info:TuyaMCU:ProcessIncoming[v=0]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 00 00 00 01 01 01 
    Info:TuyaMCU:ProcessIncoming[v=0]: cmd 0 (Hearbeat) len 8
    


    My autoexec.bat

    startDriver TuyaMCU
    tuyaMcu_defWiFiState 4
    setChannelType 1 toggle


    With this code I can control the button to raise the shutter. I can't find how to lower the shutter[/center]
  • ADVERTISEMENT
  • #2 21083767
    p.kaczmarek2
    Moderator Smart Home
    There seem to be much more dpIDs, have you tried to investigate them all?

    You can request all of them with tuyaMcu_sendQueryState command and then we can start guessing. I will try to help but with dpIDs I know as much as you, they are often per-device.

    Or maybe you can do that: Extracting DpIDs for TUYA MCU devices

    PS: to get some basic TuyaMCU grasp, I would also recommend reading the generic guide: TuyaMCU flashing, setup and configuration guide - configure dpIDs for Home Assistant


    PS2: I can also see that your code is incomplete. Is this really your whole autoexec.bat:
    
    startDriver TuyaMCU
    tuyaMcu_defWiFiState 4
    setChannelType 1 toggle
    

    You are missing linkTuyaMCUOutputToChannel call, this will not work. There is no linkage between dpIDs and channels.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21083862
    Eucli
    Level 3  
    Yes indeed I was missing a line
    I found this

    Table with columns ID, Type, VCnt, and Values containing numerical data.

    If I understood correctly My id1 I am at 0 when I stop I am at 2 when I go down and I am at 1 when I go up

    startDriver TuyaMCU
    tuyaMcu_defWiFiState 4
    setChannelType 1 toggle
    linkTuyaMCUOutputToChannel 1 bool 1
    


    The problem with the linkTuyaMCUOutputToChannel 1, I can't find how to change the value from 1 to 0 or 2
  • Helpful post
    #4 21083872
    p.kaczmarek2
    Moderator Smart Home
    The capture indicates that dpID 1 is an enum and not a bool. That's why I would suggest to try a TextField channel type instead. See the modified autoexec.bat:
    
    startDriver TuyaMCU
    tuyaMcu_defWiFiState 4
    setChannelType 1 TextField
    // linkTuyaMCUOutputToChannel [dpId][varType][channelID]
    linkTuyaMCUOutputToChannel 1 enum 1
    


    Added after 36 [seconds]:

    With this, you can try entering any numerical value, so you can try all captured options - 0, 1 and 2.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 21083882
    Eucli
    Level 3  

    Magnificent, I did the rest and it works well

    startDriver TuyaMCU
    tuyaMcu_defWiFiState 4
    setChannelType 1 TextField
    // linkTuyaMCUOutputToChannel [dpId][varType][channelID]
    linkTuyaMCUOutputToChannel 1 enum 1
    setChannelType 2 TextField
    linkTuyaMCUOutputToChannel 2 val 2
    setChannelType 7 TextField
    linkTuyaMCUOutputToChannel 7 bool 7
    setChannelType 8 TextField
    linkTuyaMCUOutputToChannel 8 enum 8
    setChannelType 10 TextField
    linkTuyaMCUOutputToChannel 10 val 10
    


    I add the corresponding dpID
          {
            "code": "control",
            "custom_name": "",
            "dp_id": 1,
            "time": 1715765063838,
            "value": "stop"
          },
          {
            "code": "percent_control",
            "custom_name": "",
            "dp_id": 2,
            "time": 1715765064110,
            "value": 100
          },
          {
            "code": "cur_calibration",
            "custom_name": "",
            "dp_id": 3,
            "time": 1689333551402,
            "value": "start"
          },
          {
            "code": "switch_backlight",
            "custom_name": "",
            "dp_id": 7,
            "time": 1715726438356,
            "value": true
          },
          {
            "code": "control_back",
            "custom_name": "",
            "dp_id": 8,
            "time": 1715726437470,
            "value": "forward"
          },
          {
            "code": "tr_timecon",
            "custom_name": "",
            "dp_id": 10,
            "time": 1715726437661,
            "value": 30
          }


    Now I just have to figure out how to define a value using mqtt.

    Thanks a lot
  • #6 21083908
    p.kaczmarek2
    Moderator Smart Home
    Now you can also make a custom page for device in REST:
    https://www.elektroda.com/rtvforum/topic3971355.html

    For the Home Assistant, you may be interested in our new feature - custom Home Assistant discovery with PublishFile command (it lets you to publish any custom JSON)
    Helpful post? Buy me a coffee.
  • #9 21084217
    p.kaczmarek2
    Moderator Smart Home
    I don't know if it's a coincidence or not, but I haven't seen much TuyaMCU-based shutter controllers in the past. But now, that is a good thing that we have a TuyaMCU-based ones as well. They seem much simpler to configure and handle.
    Helpful post? Buy me a coffee.
  • #10 21084471
    Eucli
    Level 3  
    Once you understand how TuyaMCU works, it is easy to configure

    I hope this solves the problems, the disconnect buttons with the old official firmware
  • ADVERTISEMENT
  • #11 21084481
    p.kaczmarek2
    Moderator Smart Home
    What kind of disconnect buttons problem of official firmware, can you elaborate?
    Helpful post? Buy me a coffee.
  • #12 21084498
    Eucli
    Level 3  

    Association with smart life everything is fine, and generally between 1 and 2 days of use, the module flashed as if it was not paired with the Smart Life application.

    I have a total of 4 shutter switches, out of the 4, 3 have the problem
  • #13 21084589
    p.kaczmarek2
    Moderator Smart Home
    That sounds like a SmartLife issue. I don't think it will happen in OBK, but I will note upfront, that in OBK you should enable PowerSave 1 in autoexec.bat because some Tuya devices have low quality power supplies and they might not like being overloaded for too long.
    Helpful post? Buy me a coffee.
  • #14 21101809
    Eucli
    Level 3  

    Since the flash with OBK I come back, my buttons work very well no more problems
  • #15 21337540
    danielschiltz34
    Level 2  
    Hello all,
    I'm really new to all of this with CB2S Moduls, more used to the ESP-32 world, and I try to figure out how this puzzle of the few threads in here for the Moes Curtain Switch "WS-EUR-CW Wifi RF" have to be configured as a script/template including the autoexec.bat file to properly work for this device. The template for this device on your website is nearly empty, and it just contains basic information, but no other config details. If I'm not wrong, Cloudcutter does not help, since the TuyaMCU seems to be a hardcoded device, and only talks via TX and RX to the MCU.

    Many thanks for all this great work in here.
    PS: Due to the help of this great forum I managed to get the Smoke Detector YG400A-WA007 working running on a CBU Module

Topic summary

A user sought assistance with button bindings and setup for the Moes Curtain device utilizing the BK7231N/CB2S chip and TuyaMCU firmware. After successfully flashing the device, they struggled to configure the button states. Community members suggested querying all dpIDs using the tuyaMcu_sendQueryState command and provided guidance on modifying the autoexec.bat file to include necessary commands for linking dpIDs to channels. The user eventually resolved the issue by adjusting the channel types to TextField and linking the outputs correctly. Discussions also touched on potential issues with the Smart Life application and the benefits of using OpenBeken firmware for improved stability.
Summary generated by the language model.
ADVERTISEMENT