logo elektroda
logo elektroda
X
logo elektroda

Aliexpress, Smart Touch Switch (Smart life app), Fan light smart switch

tonyb62 429 8
ADVERTISEMENT
  • #1 21412265
    tonyb62
    Level 8  
    Hi all.
    Latest purchase, wanted a light/fan switch for a ceiling fan but alas the fan controller is PWM and the ceiling fan is noisy.
    I'm going to try it on a bathroom extractor fan instead.

    Smart touch switch packaging with text and a label.
    Fan control panel and PCB board.
    WiFi switch for light and fan with labels N, L, Fan, Light against a notebook background.


    Photo's of the board

    Close-up of a circuit board with a mounted integrated circuit.
    PCB with CB3S module and TuyaMCU chip on a wooden surface.
    Close-up of a circuit board with several white insulated areas.
    Photo of the back of an electronic circuit board with various components.
    Printed circuit board with electronic components.


    Features a CB3S with TuyaMCU chip that appears to have the ID scrapped off.
    Does require removing the CB3S for flashing.

    Current autoexec.bat is as follows, First time with a TuyaMCU device, have the light relay working but struggling with the fan control.

    //start NTP drive for current time
    startDriver NTP
    //power save functinon
    PowerSave 1
    // Start TuyaMCu driver
    startDriver TuyaMCU
    // set TuyaMCU baud rate
    //tuyaMcu_setBaudRate 115200
    // set TuyaMCU default wifi state 0x04, which means "paired",
    // because some TuyaMCU MCUs will not report all data
    // unless they think they are connected to cloud
    tuyaMcu_defWiFiState 4

    // Light on/off
    setChannelLabel 1 "1"
    setChannelType 1 Toggle
    linkTuyaMCUOutputToChannel 15 bool 1


    tuyaMcu_sendQueryState returns
    [{"id":103,"type":4,"data":0},{"id":102,"type":4,"data":0},{"id":101,"type":4,"data":2},{"id":15,"type":1,"data":0},{"id":1,"type":1,"data":0}]

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 01 01 00 01 00 11
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 1 type 1-bool len 1
    Info:TuyaMCU:ParseState: byte 0

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 0F 01 00 01 00 1F
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 15 type 1-bool len 1
    Info:TuyaMCU:ParseState: byte 0

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 65 04 00 01 02 7A
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 101 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 2

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 66 04 00 01 00 79
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 102 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 0

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 67 04 00 01 00 7A
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 103 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 0

    Looking for help in getting the fan control side working,

    Cheers :)

    Added after 17 [minutes]:

    Logs taken from the webapp with only TuyaMCU selected

    Pressing a speed selection button, once on and once off results in;

    low fan on/off;

    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 66 04 00 01 00 79
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 102 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 0

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 01 01 00 01 01 12
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 1 type 1-bool len 1
    Info:TuyaMCU:ParseState: byte 1

    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 01 01 00 01 00 11
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 1 type 1-bool len 1
    Info:TuyaMCU:ParseState: byte 0

    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8


    Pressing the Med speed button once on and once off results in;

    med fan on/off;

    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 66 04 00 01 01 7A
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 102 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 1

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 01 01 00 01 01 12
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 1 type 1-bool len 1
    Info:TuyaMCU:ParseState: byte 1

    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 01 01 00 01 00 11
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 1 type 1-bool len 1
    Info:TuyaMCU:ParseState: byte 0

    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8

    Pressing the Med speed button once on and once off results in;

    high fan on/off;

    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 66 04 00 01 02 7B
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 102 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 2

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 01 01 00 01 01 12
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 1 type 1-bool len 1
    Info:TuyaMCU:ParseState: byte 1

    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 01 01 00 01 00 11
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 1 type 1-bool len 1
    Info:TuyaMCU:ParseState: byte 0

    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8


    It appears ID 102 sets the fan speed & ID 1 turns the fan on/off.
    How do you go about setting this up?

    Cheers, Anthony
  • ADVERTISEMENT
  • ADVERTISEMENT
  • #3 21415341
    tonyb62
    Level 8  
    Just watching the logs. I started by turning on the fan at low speed, then increased to med speed, then increased to high speed, then turned the fan off by pressing the high speed button again.

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 66 04 00 01 00 79-------low speed
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 102 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 0

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 01 01 00 01 01 12-------fan on
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 1 type 1-bool len 1
    Info:TuyaMCU:ParseState: byte 1

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 66 04 00 01 01 7A------med speed
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 102 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 1

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 01 01 00 01 01 12------fan on
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 1 type 1-bool len 1
    Info:TuyaMCU:ParseState: byte 1

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 66 04 00 01 02 7B------high speed
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 102 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 2

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 01 01 00 01 01 12-------fan on
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 1 type 1-bool len 1
    Info:TuyaMCU:ParseState: byte 1

    Info:TuyaMCU:Received: 55 AA 03 07 00 05 01 01 00 01 00 11-------fan off
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 12
    Info:TuyaMCU:ParseState: id 1 type 1-bool len 1
    Info:TuyaMCU:ParseState: byte 0

    When you press a button it sends the fan speed request to ID 102 then sends a fan on request to ID 1 for each button press.
    How do you go about this in an autoexec.bat file?
    I understand I need to set up ID102 as a TextField so I can send it the speed requests.
    But how do you set up OBK to send/receive multiple messages for a singular event?

    Cheers, Anthony
  • ADVERTISEMENT
  • #4 21416185
    divadiow
    Level 34  
    is there anything existing in the autoexec examples that would suit?

    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md

    I have flashed your firmware and paired it. The dpID info are this according to Tuya

    Code: JSON
    Log in, to see the code


    Code: Text
    Log in, to see the code


    additionally, for the records, here is an unpaired device boot log

    Code: Text
    Log in, to see the code


    Firmware version 2.1.17 so not cloudcutter exploitable.

    Paired Tuya app pics

    Screenshot of the Tuya app displaying the WiFi Fan Light Switch device. An app interface featuring a switch for controlling a WiFi fan and light.App schedule setting screen with time selection and options to turn on fan and light. Tuya app screen showing settings for indicator status, fan level, and power-on status.
  • #5 21416831
    tonyb62
    Level 8  
    Interesting, I'll reassemble the second unit I have with the stock firmware, I'm interested to see what the Light mode and Power-on state options do.

    I did find a Fan/Light switch example and ended up with this;

    // Fan on/off
    setChannelLabel 1 "fan"
    setChannelType 1 Toggle
    linkTuyaMCUOutputToChannel 1 bool 1

    // Light on/off
    setChannelLabel 2 "Light"
    setChannelType 2 Toggle
    linkTuyaMCUOutputToChannel 15 bool 2

    // Indicator Light Mode
    setChannelLabel 3 "Light Mode"
    setChannelType 3 OffDimBright
    linkTuyaMCUOutputToChannel 101 var 3

    // Fan speed Level
    setChannelLabel 4 "speed"
    setChannelType 4 LowMidHigh
    linkTuyaMCUOutputToChannel 102 var 4

    // Power on state
    setChannelLabel 5 "Power-On State"
    setChannelType 5 OffOnRemember
    linkTuyaMCUOutputToChannel 103 var 5


    The fan and light toggles work but none of the Variable fields work. Fan speed doesn't change when selecting different options. Need to read up on the ENUM fields, while LowMedHigh appears as selectable boxes, OffOnMemory doesn't.
  • ADVERTISEMENT
  • #6 21418078
    tonyb62
    Level 8  
    Ok I believe I have the correct config in the autoexec.bat file now.

    With the enum fields I had used the VAR descriptor instead of ENUM and I'm not sure why. Correct Autoexec.bat attached.

    //start NTP drive for current time
    startDriver NTP
    //power save function
    PowerSave 1
    // Start TuyaMCu driver
    startDriver TuyaMCU
    // set TuyaMCU baud rate
    tuyaMcu_setBaudRate 9600
    // set TuyaMCU default wifi state 0x04, which means "paired",
    // because some TuyaMCU MCUs will not report all data
    // unless they think they are connected to cloud
    tuyaMcu_defWiFiState 4

    // Fan on/off
    setChannelLabel 1 "fan"
    setChannelType 1 Toggle
    linkTuyaMCUOutputToChannel 1 1 1

    // Light on/off
    setChannelLabel 2 "Light"
    setChannelType 2 Toggle
    linkTuyaMCUOutputToChannel 15 1 2

    // Indicator Light Mode
    setChannelLabel 3 "Light Mode"
    setChannelType 3 OffDimBright
    linkTuyaMCUOutputToChannel 101 4 3

    // Fan speed Level
    setChannelLabel 4 "speed"
    setChannelType 4 LowMidHigh
    linkTuyaMCUOutputToChannel 102 4 4

    // Power on state
    setChannelLabel 5 "Power-On State"
    setChannelType 5 OffOnRemember
    linkTuyaMCUOutputToChannel 103 4 5

    Cheers for the help :)
  • #8 21419342
    tonyb62
    Level 8  
    >>21418084 Jumped the gun, only fan and light switches show up in Home Assistant after using OpenBK discovery.

    The fan speed, switch lumination and power on toggles are not shown.

    https://www.elektroda.com/rtvforum/topic3895301.html - Does have a possible example to use to add these to Home Assistant.

    :)
  • #9 21431543
    tonyb62
    Level 8  
    Is there a reason why in openBK for this device now it is set up and working it doesn't fully display all controls to Home Assistant when using discovery?

Topic summary

Discussion revolves around the integration and configuration of a touch smart switch compatible with the Smart Life app, specifically for controlling a ceiling fan and a bathroom extractor fan. The user encountered issues with PWM control causing noise in the ceiling fan and is exploring alternative uses. The switch features a TuyaMCU chip, and users are sharing experiences with firmware flashing, autoexec.bat configurations, and the challenges of getting all controls to display in Home Assistant. Key functionalities discussed include fan speed control, light toggling, and power-on state settings, with users providing code snippets and troubleshooting tips for successful integration.
Summary generated by the language model.
ADVERTISEMENT