make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.41k stars 542 forks source link

Request support for MOES Smart Control Panel Mini #2396

Closed shadowkora closed 2 weeks ago

shadowkora commented 1 month ago

Log message

Device matches None with quality of 0%. DPS: {"updated_at": 1728993303.7288413, "3": false, "16": false, "17": false, "37": "relay", "38": "memory", "39": "memory", "40": "memory", "41": "memory"}

DPS information

{
  "result": {
    "model": "{\"modelId\":\"g00mg8\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[
{\"abilityId\":1,\"accessMode\":\"ro\",\"code\":\"up_channel\",\"description\":\"1\",\"extensions\":{\"iconName\":\"icon-dp_mode\"},\"name\":\"上行\",\"typeSpec\":{\"type\":\"raw\",\"maxlen\":128}},
{\"abilityId\":2,\"accessMode\":\"wr\",\"code\":\"down_channel\",\"description\":\"2\",\"extensions\":{\"iconName\":\"icon-dp_mode\"},\"name\":\"下行\",\"typeSpec\":{\"type\":\"raw\",\"maxlen\":128}},
{\"abilityId\":3,\"accessMode\":\"rw\",\"code\":\"switch_3\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_3\",\"attribute\":\"1\"},\"name\":\"开关3\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":16,\"accessMode\":\"rw\",\"code\":\"switch_1\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_1\",\"attribute\":\"1\"},\"name\":\"开关1\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":17,\"accessMode\":\"rw\",\"code\":\"switch_2\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_2\",\"attribute\":\"1\"},\"name\":\"开关2\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":36,\"accessMode\":\"rw\",\"code\":\"backlight_switch\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-a_power\"},\"name\":\"背光灯开关\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":37,\"accessMode\":\"rw\",\"code\":\"light_mode\",\"description\":\"\",\"extensions\":{\"iconName\":\"tcl_function_light\"},\"name\":\"指示灯状态设置\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"none\",\"relay\",\"pos\"]}},
{\"abilityId\":38,\"accessMode\":\"rw\",\"code\":\"relay_status\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-zhuangtai\"},\"name\":\"上电状态\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"off\",\"on\",\"memory\"]}},
{\"abilityId\":39,\"accessMode\":\"rw\",\"code\":\"relay_status_1\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-zhuangtai\"},\"name\":\"开关1上电状态\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"off\",\"on\",\"memory\"]}},
{\"abilityId\":40,\"accessMode\":\"rw\",\"code\":\"relay_status_2\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-zhuangtai\"},\"name\":\"开关2上电状态\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"off\",\"on\",\"memory\"]}},
{\"abilityId\":41,\"accessMode\":\"rw\",\"code\":\"relay_status_3\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-zhuangtai\"},\"name\":\"开关3上电状态\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"off\",\"on\",\"memory\"]}},
{\"abilityId\":201,\"accessMode\":\"rw\",\"code\":\"ir_send\",\"description\":\"201\",\"extensions\":{\"iconName\":\"icon-icon-test11\"},\"name\":\"红外控制下发\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":3072}},
{\"abilityId\":202,\"accessMode\":\"ro\",\"code\":\"ir_study_code\",\"description\":\"202\",\"extensions\":{\"iconName\":\"icon-shangsheng\"},\"name\":\"红外学习值上报\",\"typeSpec\":{\"type\":\"raw\",\"maxlen\":128}},
{\"abilityId\":203,\"accessMode\":\"rw\",\"code\":\"voice_vol\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-sound\",\"attribute\":\"2048\"},\"name\":\"音量控制\",\"typeSpec\":{\"type\":\"value\",\"max\":100,\"min\":0,\"scale\":0,\"step\":1}},
{\"abilityId\":204,\"accessMode\":\"rw\",\"code\":\"voice_mic\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-power\",\"attribute\":\"2048\"},\"name\":\"麦克风开关\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":205,\"accessMode\":\"rw\",\"code\":\"voice_play\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-zanting\",\"attribute\":\"2048\"},\"name\":\"暂停/播放\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":206,\"accessMode\":\"rw\",\"code\":\"voice_bt_play\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-power\",\"attribute\":\"2048\"},\"name\":\"蓝牙开/关\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":207,\"accessMode\":\"rw\",\"code\":\"voice_alarm_clock\",\"description\":\"207\",\"extensions\":{\"iconName\":\"icon-timer1\",\"attribute\":\"2048\"},\"name\":\"本地闹钟\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":255}},
{\"abilityId\":208,\"accessMode\":\"rw\",\"code\":\"voice_ctrl_group\",\"description\":\"208\",\"extensions\":{\"iconName\":\"icon-dp_mic\",\"attribute\":\"2048\"},\"name\":\"语音控制组合\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":3072}}]}]}"
  },
  "success": true,
  "t": 1728992521806,
  "tid": "7e4772808aea11ef8655dad62fbc1fe9"
}

Product ID

z1fcxdrpiazyjaky

Product Name

CCP-S01-EU-WH-EN

Information about how the device functions

Here are also the Tuya Data Points:

{"1":"Up channel","2":"Down channel","3":"L3","16":"L1","17":"L2","36":"backlight switch","37":"Indicate light status","38":"Relay status all","39":"Relay status 1","40":"Relay status 2","41":"Relay status 3","201":"IR send","202":"ir study code","203":"voice vol\t","204":"voice mic","205":"voice play","206":"voice bt play\t","207":"alarm clock","208":"ctrl group"}

Link to the product: https://moeshouse.com/products/tuya-wifi-3-5-inch-touchscreen-control-ir-remote-control-bluetooth-sigmesh-hub-built-in

Edit: Added the missing log Edit2: Added the correct product ID

make-all commented 1 month ago

Sorry, a blank log message indicates that this product cannot be supported.

shadowkora commented 1 month ago

@make-all Hey Jason, I didn't provide the log message because I wasn't sure where to find it, but I got it now, the log is as following:

Device matches None with quality of 0%. DPS: {"updated_at": 1728993303.7288413, "3": false, "16": false, "17": false, "37": "relay", "38": "memory", "39": "memory", "40": "memory", "41": "memory"}
make-all commented 1 month ago

Your product id appears to be a device id, which is unique to your device. There should be a separate product id, available from the same cloud API functions that return the local key, or from a python -m tinytuya scan

shadowkora commented 1 month ago

Product ID should be the following: z1fcxdrpiazyjaky

shadowkora commented 1 month ago

Let me know if you need anything else from me 👍

shadowkora commented 3 weeks ago

So I tried it, I am running into following errors: Protocol Error 914: "Check device key or version" Protocol Error 901: "Network Error: Unable to Connect" Protocol Error 904: "Unexpected Payload from Device"

Now I went to cross verify the DPS mappings

{
  "result": {
    "properties": [
      {
        "code": "up_channel",
        "custom_name": "",
        "dp_id": 1,
        "time": 1728990489967,
        "type": "raw"
      },
      {
        "code": "down_channel",
        "custom_name": "",
        "dp_id": 2,
        "time": 1728990489967,
        "type": "raw"
      },
      {
        "code": "switch_3",
        "custom_name": "",
        "dp_id": 3,
        "time": 1729948041232,
        "type": "bool",
        "value": false
      },
      {
        "code": "switch_1",
        "custom_name": "",
        "dp_id": 16,
        "time": 1729870237506,
        "type": "bool",
        "value": false
      },
      {
        "code": "switch_2",
        "custom_name": "",
        "dp_id": 17,
        "time": 1729948043800,
        "type": "bool",
        "value": false
      },
      {
        "code": "backlight_switch",
        "custom_name": "",
        "dp_id": 36,
        "time": 1728990489967,
        "type": "bool",
        "value": false
      },
      {
        "code": "light_mode",
        "custom_name": "",
        "dp_id": 37,
        "time": 1729869289828,
        "type": "enum",
        "value": "relay"
      },
      {
        "code": "relay_status",
        "custom_name": "",
        "dp_id": 38,
        "time": 1729869289444,
        "type": "enum",
        "value": "memory"
      },
      {
        "code": "relay_status_1",
        "custom_name": "",
        "dp_id": 39,
        "time": 1729869289538,
        "type": "enum",
        "value": "memory"
      },
      {
        "code": "relay_status_2",
        "custom_name": "",
        "dp_id": 40,
        "time": 1729869289583,
        "type": "enum",
        "value": "memory"
      },
      {
        "code": "relay_status_3",
        "custom_name": "",
        "dp_id": 41,
        "time": 1729869289641,
        "type": "enum",
        "value": "memory"
      },
      {
        "code": "ir_send",
        "custom_name": "",
        "dp_id": 201,
        "time": 1728990489967,
        "type": "string",
        "value": ""
      },
      {
        "code": "ir_study_code",
        "custom_name": "",
        "dp_id": 202,
        "time": 1728990489967,
        "type": "raw"
      },
      {
        "code": "voice_vol",
        "custom_name": "",
        "dp_id": 203,
        "time": 1728990489967,
        "type": "value",
        "value": 0
      },
      {
        "code": "voice_mic",
        "custom_name": "",
        "dp_id": 204,
        "time": 1728990489967,
        "type": "bool",
        "value": false
      },
      {
        "code": "voice_play",
        "custom_name": "",
        "dp_id": 205,
        "time": 1728990489967,
        "type": "bool",
        "value": false
      },
      {
        "code": "voice_bt_play",
        "custom_name": "",
        "dp_id": 206,
        "time": 1728990489967,
        "type": "bool",
        "value": false
      },
      {
        "code": "voice_alarm_clock",
        "custom_name": "",
        "dp_id": 207,
        "time": 1728990489967,
        "type": "string",
        "value": ""
      },
      {
        "code": "voice_ctrl_group",
        "custom_name": "",
        "dp_id": 208,
        "time": 1728990489967,
        "type": "string",
        "value": ""
      }
    ]
  },
  "success": true,
  "t": 1729949138907,
  "tid": "ca86c5c4939d11efad5172ecb0bd0dcf"
}

and they match the integration here.

Next I tried pinging the device and it pings just fine, so no issues with connectivity.

Another thing I cross-checked was the local_key, which I verified to be correct both through tinytuya and directly from the Tuya Developer portal website.

So now I am unsure where the actual issue might be, one observation I made was, that if I want to add the device through " Smart Life cloud-assisted device setup." it won't show there, but will only show as a Gateway, official Tuya integration also shows the device as "Smart Control Panel Mini (unsupported)"

make-all commented 3 weeks ago

You managed to get a log message before, so it must be possible to connect it. Maybe see the possible causesfor connection issues listed in #522.

shadowkora commented 3 weeks ago
2024-10-26 20:11:37.659 DEBUG (MainThread) [custom_components.tuya_local.device] Refreshing device state for Test
2024-10-26 20:11:37.660 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.1
2024-10-26 20:11:37.696 DEBUG (SyncWorker_23) [custom_components.tuya_local.device] Test refreshed device state: {"Error": "Unexpected Payload from Device", "Err": "904", "Payload": null}
2024-10-26 20:11:37.696 WARNING (SyncWorker_23) [custom_components.tuya_local.device] Test protocol error 904: Unexpected Payload from Device
2024-10-26 20:11:37.697 DEBUG (SyncWorker_23) [custom_components.tuya_local.device] new state (incl pending): {"updated_at": 1729966297.6964915}
2024-10-26 20:11:41.134 DEBUG (MainThread) [custom_components.tuya_local.device] Refreshing device state for Test
2024-10-26 20:11:41.134 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.2
2024-10-26 20:11:42.733 DEBUG (SyncWorker_33) [custom_components.tuya_local.device] Test refreshed device state: {"Error": "Unexpected Payload from Device", "Err": "904", "Payload": null}
2024-10-26 20:11:42.733 WARNING (SyncWorker_33) [custom_components.tuya_local.device] Test protocol error 904: Unexpected Payload from Device
2024-10-26 20:11:42.733 DEBUG (SyncWorker_33) [custom_components.tuya_local.device] new state (incl pending): {"updated_at": 1729966302.7335215}
2024-10-26 20:11:46.415 DEBUG (MainThread) [custom_components.tuya_local.device] Refreshing device state for Test
2024-10-26 20:11:46.415 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3
2024-10-26 20:11:46.451 DEBUG (SyncWorker_5) [custom_components.tuya_local.device] Test refreshed device state: {"Error": "Unexpected Payload from Device", "Err": "904", "Payload": null}
2024-10-26 20:11:46.451 WARNING (SyncWorker_5) [custom_components.tuya_local.device] Test protocol error 904: Unexpected Payload from Device
2024-10-26 20:11:46.451 DEBUG (SyncWorker_5) [custom_components.tuya_local.device] new state (incl pending): {"updated_at": 1729966306.451411}
2024-10-26 20:11:49.196 DEBUG (MainThread) [custom_components.tuya_local.device] Refreshing device state for Test
2024-10-26 20:11:49.196 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.4
2024-10-26 20:11:49.243 DEBUG (SyncWorker_61) [custom_components.tuya_local.device] Test refreshed device state: {"Error": "Check device key or version", "Err": "914", "Payload": null}
2024-10-26 20:11:49.243 WARNING (SyncWorker_61) [custom_components.tuya_local.device] Test protocol error 914: Check device key or version
2024-10-26 20:11:49.243 DEBUG (SyncWorker_61) [custom_components.tuya_local.device] new state (incl pending): {"updated_at": 1729966309.243419}
2024-10-26 20:11:50.892 DEBUG (MainThread) [custom_components.tuya_local.device] Refreshing device state for Test
2024-10-26 20:11:50.892 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.5

tinytuya output:

Smart Control Panel Mini   Product ID = keyqrn89dqf7hqpe  [Valid Broadcast]:
    Address = 192.168.31.17   Device ID = bf7e32d4dec892fba5dhz9 (len:22)  Local Key = xyz  Version = 3.5  Type = default, MAC = fc:3c:d7:9c:39:af
    Status: {'3': False, '16': False, '17': False, '37': 'relay', '38': 'memory', '39': 'memory', '40': 'memory', '41': 'memory'}

I still get this however: 2024-10-26 20:17:17.059 WARNING (MainThread) [custom_components.tuya_local.config_flow] Device matches None with quality of 0%. DPS: {"updated_at": 1729966631.6598845, "3": false, "16": false, "17": false, "37": "relay", "38": "memory", "39": "memory", "40": "memory", "41": "memory"}

I have it added under homeassistant/custom_components/tuya_local/devices/moes_controlpanel.yaml and I have restarted the whole Home Assistant after adding it.

Force stopped the Tuya app on my device and also made sure the Smart Panel has a static IP. I went ahead and re-paired the device with Tuya, it changed its Device ID and local_key, now when I try to connect using the credentials and Protocol V3.5, I get a "Sorry, there is no support for this device." message.

I guess I will just wait for the official release as it seems I might be doing something wrong when adding the new device yaml config to the files.

make-all commented 3 weeks ago

No, you are not doing something wrong, I didn't notice that the backlight dp (36) is missing from the log so didn't mark it as optional.

shadowkora commented 3 weeks ago

I am happy to report that it works as intended now, I was namely looking for the Switch control as not even the Tuya integration in HA supports controls for that yet.

Thank you very much!