logo elektroda
logo elektroda
X
logo elektroda

Avatto DMS16-W1 CBU Dimmer + Puya PY32F002A MCU: OpenBeken Flashing and Autoexec Setup

divadiow 2226 6
ADVERTISEMENT
  • Hello. It's me again with another device. This is the Avatto DMS16-W1 1-channel dimmer smart switch with CBU talking to a Puya PY32F002A (TSSOP-20) MCU.

    Box on a blue table background with the text Smart Dimmer Module. Packaging of Avatto DMS16-W1 single-channel smart dimmer switch. 1-channel Wi-Fi dimmer module Avatto DMS16-W1 Components of the Avatto DMS16-W1 smart dimmer switch on a blue mat. 1-channel smart switch Avatto DMS16-W1 on a blue background PCB of Avatto DMS16-W1 smart dimmer switch with components. Photo of Avatto DMS16-W1 smart dimmer switch with electronic components. Close-up view of a smart dimmer switch Avatto DMS16-W1 showing the CBU module and electronic components. 1-channel smart dimmer switch Avatto DMS16-W1 with CBU module and electronic components. Avatto DMS16-W1 module with CBU and Puya MCU on a blue background Avatto DMS16-W1 smart dimmer switch board on a blue background Avatto DMS16-W1 smart dimmer switch on a blue background Avatto DMS16-W1 smart dimmer switch with a CBU module on a blue background. Close-up of the Avatto DMS16-W1 smart dimmer switch circuit board.

    The Puya MCU is well documented and has had some interesting followings on Elektroda https://www.elektroda.com/rtvforum/topic3946116.html

    Code: Text
    Log in, to see the code


    CBU log out from power-on

    Code: Text
    Log in, to see the code

    After de-soldering the CBU riser the factory firmware was dumped using Easy Flasher, attached. The extracted config was "baud":"115200".

    With a multimeter I determine the following traces

    The photo shows the Avatto DMS16-W1 smart dimmer switch with a Puya PY32F002A microcontroller in a TSSOP-20 package.

    so I have everything I need to capture communications between the Puya and the CBU and potentially to use J-Link to read the flash of the Puya. Sadly I was not able to get a connection from J-Link to the MCU despite my best efforts. Even with NRST-reset pulled low.

    SEGGER J-Flash programming interface showing connection error

    Moving onto the communication between the CBU and the Puya, TuycaMCU Analyser was a winner for capturing all I could toggle and set within the official Tuya app. Those features being:

    App interface for controlling a dimmer module with brightness set to 19%. Power-on status setting screen in mobile app Mobile app interface for setting the dimmer brightness range. Device update screen showing no updates available. App interface for setting the dimmer brightness range with switch type selection.

    And with the CBU rise de-soldered we can easily switch between OpenBeken and the factory firmware to recheck default behaviour by removing the Puya from the equation in this setup:
    Electronic projects on a desk with various modules and cables connected to devices.

    And with two USB-TTL adaptors in the mix we can capture communications in real-time when setting up OBK autoexec.

    Screenshot of TuyaMCU Explorer software analyzing communication between modules.

    The full extent of the dpIDs being

    Code: Text
    Log in, to see the code


    Code: Text
    Log in, to see the code


    I did not see dpIDs 13 and 47 in all my fiddling in the Tuya app trying every function, boot communication or tuyaMcu_sendQueryState.

    Fast-forward to the current state of the autoexec

    Code: Text
    Log in, to see the code


    which gives us

    OpenBK7231N interface with various switch and control options.

    The countdown to power-on timer field numerical value will change every ~30s as the CBU receives an update from the MCU on time remaining.

    This is as far as I have gone for now. Most functions appear to be working in OpenBeken, though I've not yet tested with mains power and an incandescent bulb. Certainly the communications I'm watching in the MCU analyser mirror what was seen in factory firmware.

    There is one thing I don't yet know how to replicate. The brightness range, dpID3, allows you to customise the range from both ends. This is this screen in the Tuya app

    App screen for setting the dimmer brightness range.

    The yellow indicator can be toggled from the left to right to reduce the minimum, as well as from right to left to reduce maximum. This can be seen in factory with these comms. It also involves dpID 2, I'm not sure how this can be replicated in OBK.

    Screenshot showing communication between Wi-Fi module and device, displaying data related to dimmer settings.

    One thing I did notice was that although I've set the dimmer range to tuyaMcu_setDimmerRange 200 1000, same as factory, OpenBeken only displays a fixed 0-100 value range in the GUI for that channel when using the slider. It does however communicate the right values to the MCU.

    OpenBeken software configuration interface with sliders and control buttons. Log of communication between the WiFi module and device, with yellow indicators highlighting values 200 and 1000.

    suggestions for improvement welcome!

    Cool? Ranking DIY
    About Author
    divadiow
    Level 34  
    Offline 
    divadiow wrote 2755 posts with rating 473, helped 246 times. Live in city Bristol. Been with us since 2023 year.
  • ADVERTISEMENT
  • #2 21164833
    p.kaczmarek2
    Moderator Smart Home
    Thank you for detailed presentation. This min/max (range) control seems like a very custom component, we don't have such channel type in firmware yet, especially that it would need to handle two dpIDs... maybe, alternatively, we could just use two channels and create sliders for them? One slider called "max" and second "min"?

    Of course, you can also do better UI with REST page:
    https://www.elektroda.com/rtvforum/topic3971355.html
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21173417
    tomik67
    Level 12  
    I recently received an identical AVATTO dimmer with the designation DMS 16-Y1 instead of W1.
    An interesting feature of this version is a timer that counts down the time until the light is switched off.
    I tested it on a traditional incandescent bulb and it works great, I need to test it to see how it works with dimmable power supplies and LED bulbs.

    What I was able to detect:

    dpID Type VCnt Values
    1 Bool(1) 2 0, 1 Power 0/OFF, 1/ON
    2 Val(2) 18 Min=200, max=1000 Brigtnes
    3 Val(2) 18 Min=10 (1%-100%), max=500 (50%-100%) Brightness range set (minimum brightness value)
    4 Enum(4) 1 Switch type.: 0-Seesaw Toogle Switch, 1-Seesaw Sync Switch, 2-Kick Back Switch
    14 Enum(4) 1 Power-on Status Settings.: 0-Power-on OFF, 1-Power-on ON, 2-Power-on Memory
    6 Val(2) 1 Timer, seconds value

    {
    	"baud":"115200}",
    	"ap_passwd":"null",
    	"country_code":"null",
    	"bt_mac":"null",
    	"bt_hid":"null",
    	"prod_test":"false",
    	"fac_pin":"kszhpwrtdpznkpi70Atls_ca_cnt0SAmf_test_closetrue<NBastro_timer{timestamp",
    	"index":"0}0qAgw_di?1LAgw_wsm{abi",
    	"id":"null",
    	"swv":"2.1.17",
    	"bv":"40.00",
    	"pv":"2.2",
    	"lpv":"3.4",
    	"pk":"chfpey4klfcp1ipl",
    	"firmk":"key83r5jq9qqeaxt",
    	"cadv":"1.0.5",
    	"cdv":"1.0.0",
    	"dev_swv":"1.0.3",
    	"s_id":"null",
    	"dtp":"9",
    	"sync":"0",
    	"attr_num":"1",
    	"mst_tp_0":"9",
    	"mst_ver_0":"1.0.3",
    	"mst_md5_0":"null",
    	"mst_tp_1":"0",
    	"mst_ver_1":"null",
    	"mst_md5_1":"null",
    	"mst_tp_2":"0",
    	"mst_ver_2":"null",
    	"mst_md5_2":"null",
    	"mst_tp_3":"0",
    	"mst_ver_3":"null",
    	"mst_md5_3":"null",
    	"mst_tp_4":"0",
    	"mst_ver_4":"null",
    	"mst_md5_4":"null",
    	"mst_tp_5":"0",
    	"mst_ver_5":"null",
    	"mst_md5_5":"null",
    	"mst_tp_6":"0",
    	"mst_ver_6":"null",
    	"mst_md5_6":"null",
    	"mst_tp_7":"0",
    	"mst_ver_7":"null",
    	"mst_md5_7":"null",
    	"mst_tp_8":"0",
    	"mst_ver_8":"null",
    	"mst_md5_8":"null",
    	"md":"0",
    	"random":"0",
    	"wfb64":"1",
    	"stat":"0",
    	"token":"null",
    	"region":"null",
    	"reg_key":"null",
    	"dns_prio":"00{uuid",
    	"psk_key":"NqpUFtRz0KpOTePCePKZjlsLIJu2Jps3uPfXt",
    	"auth_key":"0kRx0y3KntpG1MFX4WwZJNDTq5JqLo0q",
    	"ap_ssid":"SmartLife",
    	"mst_ver_9":"null",
    	"mst_md5_9":"null }{abi",
    	"mst_tp_9":"0",
    	"ssid":"null",
    	"passwd":"null",
    	"mode":"rw",
    	"property":"{type",
    	"{type":"obj",
    	"max":"1000",
    	"scale":"0",
    	"step":"1",
    	"type":"value}",
    	"lckey":"^ANYmz^YUwo~h7z-",
    	"h_url":"http",
    	"h_ip":"18.193.219.35",
    	"hs_url":"null",
    	"hs_ip":"null",
    	"hs_psk":"https",
    	"hs_psk_ip":"18.195.249.137",
    	"mqs_url":"null",
    	"mqs_ip":"null",
    	"mq_url":"m2.tuyae u.com",
    	"mq_ip":"3.66.126.37",
    	"ai_sp":"null",
    	"ai_sp_ip":"null",
    	"mq_psk":"m2.tuyaeu.com",
    	"mq_psk_ip":"3.66.126.37",
    	"lp_url":"baal.tuyaeu.com",
    	"lp_ip":"18.193.97.90",
    	"time_z":"+01",
    	"s_time_z":"[[1711846800",
    	"wx_app_id":"null",
    	"wx_uuid":"null",
    	"dy_tls_m":"0",
    	"cloud_cap":"1025",
    	"psk21_key":"null }{nc_tp",
    	"ap_s{baud":"115200}",
    	"{key":"C|wn~+{bL'e8~R;V"
    }
    .
  • ADVERTISEMENT
  • #4 21440751
    groove6j
    Level 8  
    I have the same dimmer switch, only it's the 2CH model. So I see mostly things are working fine with the 1CH unit, I will try out flashing my unit and report my findings. Seems like just the right dpIDs need finding.

    1CH version:
    Orange 1CH Zigbee dimmer module with technical specifications.
    Mine is this:
    Orange 2-channel Wi-Fi dimmer module with electrical connections.
  • ADVERTISEMENT
  • #5 21441002
    divadiow
    Level 34  
    you could sniff out the additional dpID(s)
    https://www.elektroda.com/rtvforum/topic3970199.html
    https://www.elektroda.com/rtvforum/topic4038151.html

    https://github.com/openshwprojects/OpenBK7231T_App?tab=readme-ov-file#features

    or post your full factory firmware dump (or send it to me to reset if you joined it to wifi/Tuya) or extract the config data if you've already converted to OBK without backup

    OpenBK7231N control panel with status information and configuration buttons.
  • #6 21441155
    groove6j
    Level 8  
    >>21441002
    I already flashed it.
    Here is the full 2MB dump of Tuya FW. I had it connected to WiFi if it matters.

    Anyways it seems that things are very similar, because when using your autoexec.bat:
    *both physical switches work (on both CH's/lamps)
    *CH1 dimming and switching works from webui

    Just have to find the dpIDs for CH2 for basic functionality to work.

    edit:
    Looks like CH2 continues from dpID7, very logical. I'll write up the new autoexec.
    
    switch_led_1   Boolean   
    
    "{true,false}"
    
    bright_value_1   Integer   
    
    {
      "min": 10,
      "max": 1000,
      "scale": 0,
      "step": 1
    }
    
    brightness_min_1   Integer   
    
    {
      "min": 10,
      "max": 1000,
      "scale": 0,
      "step": 1
    }
    
    brightness_max_1   Integer   
    
    {
      "min": 10,
      "max": 1000,
      "scale": 0,
      "step": 1
    }
    
    countdown_1   Integer   
    
    {
      "unit": "s",
      "min": 0,
      "max": 86400,
      "scale": 0,
      "step": 1
    }
    
    switch_led_2   Boolean   
    
    "{true,false}"
    
    bright_value_2   Integer   
    
    {
      "min": 10,
      "max": 1000,
      "scale": 0,
      "step": 1
    }
    
    brightness_min_2   Integer   
    
    {
      "min": 10,
      "max": 1000,
      "scale": 0,
      "step": 1
    }
    
    brightness_max_2   Integer   
    
    {
      "min": 10,
      "max": 1000,
      "scale": 0,
      "step": 1
    }
    
    countdown_2   Integer   
    
    {
      "unit": "s",
      "min": 0,
      "max": 86400,
      "scale": 0,
      "step": 1
    }
    
    relay_status   Enum   
    
    {
      "range": [
        "0",
        "1",
        "2"
      ]
    }
    

    
    {
      "result": {
        "model": "{\"modelId\":\"eyjoc4\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[{\"abilityId\":1,\"accessMode\":\"rw\",\"code\":\"switch_led_1\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-power\",\"attribute\":\"1539\"},\"name\":\"开关1\",\"typeSpec\":{\"type\":\"bool\"}},{\"abilityId\":2,\"accessMode\":\"rw\",\"code\":\"bright_value_1\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_half\",\"attribute\":\"1666\"},\"name\":\"亮度值1\",\"typeSpec\":{\"type\":\"value\",\"max\":1000,\"min\":10,\"scale\":0,\"step\":1}},{\"abilityId\":3,\"accessMode\":\"rw\",\"code\":\"brightness_min_1\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-liangdu1\",\"attribute\":\"1760\"},\"name\":\"最小亮度1\",\"typeSpec\":{\"type\":\"value\",\"max\":1000,\"min\":10,\"scale\":0,\"step\":1}},{\"abilityId\":4,\"accessMode\":\"rw\",\"code\":\"led_type_1\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_box2\",\"scope\":\"\",\"attribute\":\"1760\"},\"name\":\"开关类型1\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"flip\",\"sync\",\"button\"]}},{\"abilityId\":5,\"accessMode\":\"rw\",\"code\":\"brightness_max_1\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_sun\",\"attribute\":\"1760\"},\"name\":\"最大亮度1\",\"typeSpec\":{\"type\":\"value\",\"max\":1000,\"min\":10,\"scale\":0,\"step\":1}},{\"abilityId\":6,\"accessMode\":\"rw\",\"code\":\"countdown_1\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_time2\",\"attribute\":\"1667\"},\"name\":\"倒计时1\",\"typeSpec\":{\"type\":\"value\",\"max\":86400,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"s\"}},{\"abilityId\":7,\"accessMode\":\"rw\",\"code\":\"switch_led_2\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-power\",\"attribute\":\"1027\"},\"name\":\"开关2\",\"typeSpec\":{\"type\":\"bool\"}},{\"abilityId\":8,\"accessMode\":\"rw\",\"code\":\"bright_value_2\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_half\",\"attribute\":\"1154\"},\"name\":\"亮度值2\",\"typeSpec\":{\"type\":\"value\",\"max\":1000,\"min\":10,\"scale\":0,\"step\":1}},{\"abilityId\":9,\"accessMode\":\"rw\",\"code\":\"brightness_min_2\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-liangdu1\",\"attribute\":\"1248\"},\"name\":\"最小亮度2\",\"typeSpec\":{\"type\":\"value\",\"max\":1000,\"min\":10,\"scale\":0,\"step\":1}},{\"abilityId\":10,\"accessMode\":\"rw\",\"code\":\"led_type_2\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_box2\",\"scope\":\"\",\"attribute\":\"1248\"},\"name\":\"开关类型2\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"flip\",\"sync\",\"button\"]}},{\"abilityId\":11,\"accessMode\":\"rw\",\"code\":\"brightness_max_2\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_sun\",\"attribute\":\"1248\"},\"name\":\"最大亮度2\",\"typeSpec\":{\"type\":\"value\",\"max\":1000,\"min\":10,\"scale\":0,\"step\":1}},{\"abilityId\":12,\"accessMode\":\"rw\",\"code\":\"countdown_2\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_time2\",\"attribute\":\"1154\"},\"name\":\"倒计时2\",\"typeSpec\":{\"type\":\"value\",\"max\":86400,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"s\"}},{\"abilityId\":13,\"accessMode\":\"rw\",\"code\":\"work_mode\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_mode\",\"attribute\":\"1024\"},\"name\":\"模式\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"light_white\"]}},{\"abilityId\":14,\"accessMode\":\"rw\",\"code\":\"relay_status\",\"description\":\"\",\"extensions\":{\"iconName\":\"setting icon-setting\",\"attribute\":\"1760\"},\"name\":\"上电状态记忆\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"off\",\"on\",\"memory\"]}}]}]}"
      },
      "success": true,
      "t": 1739658888879,
      "tid": "10794136ebed11efbbcac2b21b10ca93"
    }
    



    This seems to work:
    
    startdriver tuyamcu
    tuyaMcu_setBaudRate 115200
    tuyaMcu_defWiFiState 4
    
    
    //-------CH1-------
    
    // Power On/Off dpID 1  - Channel 1
    setChannelType 1 toggle
    setChannelLabel 1 "On/Off"
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 1 bool 1
    
    
    // Brightness dpID 2  - Channel 2
    setChannelType 2 Dimmer
    //Set dimmer range 
    tuyaMcu_setDimmerRange 200 1000
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 2 val 2
    
    //Start httpButtons Driver
    startDriver httpButtons
    
    //Switch Type SeeSaw Toggle dpId=4 Enum V=0
    alias switchtype1 uartsendhex 55AA000600050404000100
    setButtonEnabled 1 1
    setButtonLabel 1 "Switch Type CH1: SeeSaw Toggle"
    setButtonCommand 1 "switchtype1"
    setButtonColor 1 "#DC0077"
    
    //Switch Type SeeSaw Sync dpId=4 Enum V=1
    alias switchtype2 uartsendhex 55AA000600050404000101
    setButtonEnabled 2 1
    setButtonLabel 2 "Switch Type CH1: SeeSaw Sync"
    setButtonCommand 2 "switchtype2"
    setButtonColor 2 "#DC0077"
    
    //Switch Type dpId=4 Enum V=2
    alias switchtype3 uartsendhex 55AA000600050404000102
    setButtonEnabled 3 1
    setButtonLabel 3 "Switch Type CH1: Kickback"
    setButtonCommand 3 "switchtype3"
    setButtonColor 3 "#DC0077"
    
    //Switch Type dpId=6 Enum V=<seconds>
    setChannelType 6 Textfield
    setChannelLabel 6 ":non-persistent countdown in seconds to power ON. Set 0 to cancel."
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 6 val 6
    
    //-------CH2-------
    
    // Power On/Off dpID 7  - Channel 7
    setChannelType 7 toggle
    setChannelLabel 7 "On/Off"
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 7 bool 7
    
    
    // Brightness dpID 8  - Channel 8
    setChannelType 8 Dimmer
    //Set dimmer range 
    tuyaMcu_setDimmerRange 200 1000
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 8 val 8
    
    //Switch Type SeeSaw Toggle dpId=10 Enum V=0
    alias switchtype4 uartsendhex 55AA000600050404000100
    setButtonEnabled 4 1
    setButtonLabel 4 "Switch Type CH2: SeeSaw Toggle"
    setButtonCommand 4 "switchtype4"
    setButtonColor 4 "#DC0077"
    
    //Switch Type SeeSaw Sync dpId=10 Enum V=1
    alias switchtype5 uartsendhex 55AA000600050404000101
    setButtonEnabled 5 1
    setButtonLabel 5 "Switch Type CH2: SeeSaw Sync"
    setButtonCommand 6 "switchtype5"
    setButtonColor 5 "#DC0077"
    
    //Switch Type dpId=10 Enum V=2
    alias switchtype6 uartsendhex 55AA000600050404000102
    setButtonEnabled 6 1
    setButtonLabel 6 "Switch Type CH2: Kickback"
    setButtonCommand 6 "switchtype6"
    setButtonColor 6 "#DC0077"
    
    //Switch Type dpId=12 Enum V=<seconds>
    setChannelType 12 Textfield
    setChannelLabel 12 ":non-persistent countdown in seconds to power ON. Set 0 to cancel."
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 12 val 12
    
    
    //-------Additional dpIDs-------
    
    // Power-On State dpID 14  - Channel 14
    setChannelType 14 OffOnRemember
    setChannelLabel 14 "Power-On State"
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 14 enum 14
    


    Could we get brightness_min and brightness_max to work? dpIDs 3 and 5 (9 and 11 for the 2CH version respectively)
  • #7 21544103
    przemsi_ele
    Level 11  
    Good job
    TuyaMCU is a great tool.
    I found another CBU and restore original tuya firmware for testing.

    My 2 channel wifi avatto dimmer software version

    Text on white background: Moduł główny: v3.1.17 Moduł MCU: v1.0.4.

    my autoexec.bat
    
    startdriver tuyamcu
    tuyaMcu_setBaudRate 115200
    tuyaMcu_defWiFiState 4
    
    //-------CH1-------
    
    // Power On/Off dpID 1  - Channel 1
    setChannelType 1 toggle
    setChannelLabel 1 "CH1 On/Off"
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 1 bool 1
    
    
    // Brightness dpID 2  - Channel 2
    setChannelType 2 Dimmer
    //Set dimmer range 
    tuyaMcu_setDimmerRange 200 1000
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 2 val 2
    
    //Start httpButtons Driver
    startDriver httpButtons
    
    //Switch Type SeeSaw Toggle dpId=4 Enum V=0
    alias switchtype1 uartsendhex 55AA00060005040400010013
    setButtonEnabled 1 1
    setButtonLabel 1 "Switch Type CH1: SeeSaw Toggle"
    setButtonCommand 1 "switchtype1"
    setButtonColor 1 "#DC0077"
    
    //Switch Type SeeSaw Sync dpId=4 Enum V=1
    alias switchtype2 uartsendhex 55AA00060005040400010114
    setButtonEnabled 2 1
    setButtonLabel 2 "Switch Type CH1: SeeSaw Sync"
    setButtonCommand 2 "switchtype2"
    setButtonColor 2 "#DC0077"
    
    //Switch Type dpId=4 Enum V=2
    alias switchtype3 uartsendhex 55AA00060005040400010215
    setButtonEnabled 3 1
    setButtonLabel 3 "Switch Type CH1: Kickback"
    setButtonCommand 3 "switchtype3"
    setButtonColor 3 "#DC0077"
    
    //Switch Type dpId=6 Enum V=<seconds>
    setChannelType 6 Textfield
    setChannelLabel 6 ":non-persistent countdown in seconds to power ON. Set 0 to cancel."
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 6 val 6
    
    //-------CH2-------
    
    // Power On/Off dpID 7  - Channel 7
    setChannelType 7 toggle
    setChannelLabel 7 "CH2 On/Off"
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 7 bool 7
    
    
    // Brightness dpID 8  - Channel 8
    setChannelType 8 Dimmer
    //Set dimmer range 
    tuyaMcu_setDimmerRange 200 1000
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 8 val 8
    
    //Switch Type SeeSaw Toggle dpId=10 Enum V=0
    alias switchtype4 uartsendhex 55AA000600050A0400010019
    setButtonEnabled 4 1
    setButtonLabel 4 "Switch Type CH2: SeeSaw Toggle"
    setButtonCommand 4 "switchtype4"
    setButtonColor 4 "#DC0077"
    
    //Switch Type SeeSaw Sync dpId=10 Enum V=1
    alias switchtype5 uartsendhex 55AA000600050A040001011A
    setButtonEnabled 5 1
    setButtonLabel 5 "Switch Type CH2: SeeSaw Sync"
    setButtonCommand 6 "switchtype5"
    setButtonColor 5 "#DC0077"
    
    //Switch Type dpId=10 Enum V=2
    alias switchtype6 uartsendhex 55AA000600050A040001021B
    setButtonEnabled 6 1
    setButtonLabel 6 "Switch Type CH2: Kickback"
    setButtonCommand 6 "switchtype6"
    setButtonColor 6 "#DC0077"
    
    //Switch Type dpId=12 Enum V=<seconds>
    setChannelType 12 Textfield
    setChannelLabel 12 ":non-persistent countdown in seconds to power ON. Set 0 to cancel."
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 12 val 12
    
    
    //-------Additional dpIDs-------
    
    // Power-On State dpID 14  - Channel 14
    setChannelType 14 OffOnRemember
    setChannelLabel 14 "Power-On State"
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 14 enum 14
    


    I used TuyaMCU to check payload that change type of a externall switch, it worked.
    For my software version payload looks:

    kickback1      55AA00060005040400010215
    Received by WiFi module:
    55 AA   03   07      00 05   04 04 00 01 02       19   
    HEADER   VER=03   State      LEN   dpId=4 Enum V=2   CHK   
    
    Sent by WiFi module:
    55 AA   00   06      00 05   0404000102   15   
    HEADER   VER=00   SetDP      LEN   dpId=4 Enum V=2      CHK
    
    
    toggle1         55AA00060005040400010013
    Received by WiFi module:
    55 AA   03   07      00 05   04 04 00 01 00       17   
    HEADER   VER=03   State      LEN   dpId=4 Enum V=0   CHK   
    
    Sent by WiFi module:
    55 AA   00   06      00 05   0404000100   13   
    HEADER   VER=00   SetDP      LEN   dpId=4 Enum V=0      CHK   
    
    
    sync1         55AA00060005040400010114   
    Sent by WiFi module:
    55 AA   00   06      00 05   0404000101   14   
    HEADER   VER=00   SetDP      LEN   dpId=4 Enum V=1      CHK   
    
    Received by WiFi module:
    55 AA   03   07      00 05   04 04 00 01 01       18   
    HEADER   VER=03   State      LEN   dpId=4 Enum V=1   CHK   
    
    
    
    toggle2         55AA000600050A0400010019
    //R 10.05.2025 15:47:42 WiFi received:
    55AA030700050A040001001D
    //S 10.05.2025 15:47:42 WiFi sent:
    55AA000600050A0400010019
    
    
    
    kick2          55AA000600050A040001021B
    //R 10.05.2025 15:45:30 WiFi received:
    55AA030700050A040001021F
    //S 10.05.2025 15:45:30 WiFi sent:
    55AA000600050A040001021B
    
    sync2         55AA000600050A040001011A
    //R 10.05.2025 15:47:00 WiFi received:
    55AA03070005070100010017
    //S 10.05.2025 15:47:00 WiFi sent:
    55AA000600050A040001011A
    //R 10.05.2025 15:47:00 WiFi received:
    55AA030700050A040001011E
    


    i am waiting for min max brightness slider
    thx

Topic summary

The discussion revolves around the Avatto DMS16-W1 dimmer switch, which utilizes a Puya PY32F002A MCU. Users explore the device's capabilities, including a custom min/max control feature that is not yet supported in the firmware. Suggestions include using two channels to create separate sliders for minimum and maximum brightness settings. Another user mentions testing a similar model, the DMS16-Y1, which features a countdown timer for light switching. Technical details about the device's dpID types and values are shared, highlighting its functionality with various bulb types and switch configurations.
Summary generated by the language model.
ADVERTISEMENT