make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.28k stars 505 forks source link

Request support for Citilux CL737B42 #1655

Open evd1ser opened 7 months ago

evd1ser commented 7 months ago

Information about DPS mappings

{
  "modelId": "000001499p",
  "services": [
    {
      "actions": [],
      "code": "",
      "description": "",
      "events": [],
      "name": "默认服务",
      "properties": [
        {
          "abilityId": 20,
          "accessMode": "rw",
          "code": "switch_led",
          "description": "",
          "extensions": {
            "iconName": "icon-dp_powe",
            "attribute": "3"
          },
          "name": "开关",
          "typeSpec": {
            "type": "bool",
            "typeDefaultValue": false
          }
        },
        {
          "abilityId": 21,
          "accessMode": "rw",
          "code": "work_mode",
          "description": "",
          "extensions": {
            "iconName": "icon-dp_mode"
          },
          "name": "模式",
          "typeSpec": {
            "range": [
              "white",
              "colour",
              "scene",
              "music"
            ],
            "type": "enum",
            "typeDefaultValue": "white"
          }
        },
        {
          "abilityId": 22,
          "accessMode": "rw",
          "code": "bright_value",
          "description": "",
          "extensions": {
            "iconName": "icon-liangdu1",
            "attribute": "2"
          },
          "name": "亮度值",
          "typeSpec": {
            "max": 1000,
            "min": 10,
            "scale": 0,
            "step": 1,
            "type": "value",
            "typeDefaultValue": 10
          }
        },
        {
          "abilityId": 23,
          "accessMode": "rw",
          "code": "temp_value",
          "description": "",
          "extensions": {
            "iconName": "icon-dp_half",
            "attribute": "2"
          },
          "name": "冷暖值",
          "typeSpec": {
            "max": 1000,
            "min": 0,
            "scale": 0,
            "step": 1,
            "type": "value",
            "typeDefaultValue": 0
          }
        },
        {
          "abilityId": 25,
          "accessMode": "rw",
          "code": "scene_data",
          "description": "",
          "extensions": {
            "iconName": "icon-shoucang"
          },
          "name": "场景",
          "typeSpec": {
            "maxlen": 255,
            "type": "string",
            "typeDefaultValue": ""
          }
        },
        {
          "abilityId": 26,
          "accessMode": "rw",
          "code": "countdown",
          "description": "",
          "extensions": {
            "iconName": "icon-a_nav_timer",
            "attribute": "2"
          },
          "name": "倒计时",
          "typeSpec": {
            "max": 86400,
            "min": 0,
            "scale": 0,
            "step": 1,
            "type": "value",
            "typeDefaultValue": 0
          }
        },
        {
          "abilityId": 28,
          "accessMode": "rw",
          "code": "control_data",
          "description": "",
          "extensions": {
            "iconName": "icon-dp_box2"
          },
          "name": "调节",
          "typeSpec": {
            "maxlen": 255,
            "type": "string",
            "typeDefaultValue": ""
          }
        },
        {
          "abilityId": 101,
          "accessMode": "rw",
          "code": "work_mode1",
          "description": "\"white\"表示仅白光起作用\n\"scene\"表示场景",
          "name": "模式",
          "typeSpec": {
            "range": [
              "white",
              "scene"
            ],
            "type": "enum",
            "typeDefaultValue": "white"
          }
        },
        {
          "abilityId": 102,
          "accessMode": "rw",
          "code": "memory_mode",
          "description": "M1~M4,遥控器和面板都可以操作,长按保存灯的当前状态(白光/彩光/上光,亮度/色温/颜色),短按则恢复到记忆的数据;\n记忆的数据在MCU本地保存;\n面板长按,下发该DP点,并下发灯的数据,MCU保存;\n面板短按,下发该DP点,MCU上报记忆值;\n遥控器长按,MCU保存数据;\n遥控器短按,上报记忆值;\n1:长按M1;\n2:短按M1;\n3:长按M2;\n4:短按M2;\n5:长按M3;\n6:短按M3;\n7:长按M4;\n8:短按M4;",
          "name": "记忆模式",
          "typeSpec": {
            "max": 8,
            "min": 1,
            "scale": 0,
            "step": 1,
            "type": "value",
            "typeDefaultValue": 1,
            "unit": ""
          }
        }
      ]
    }
  ]
}

Product ID

"product_id": "tk8n6rlp7rtidyis",
"product_name": "Citilux-CW",

Information about how the device functions

https://citilux.ru/store/cl737b42/

my example citilux_cw_light.yaml

name: Citilux-CW
products:
  - id: tk8n6rlp7rtidyis
    name: Citilux-CW
primary_entity:
  entity: light
  dps:
    - id: 20
      type: boolean
      name: switch
    - id: 21
      name: work_mode
      type: string
      optional: true
    - id: 22
      name: brightness
      type: integer
      range:
        min: 10
        max: 1000
      mapping:
        - scale: 3.92
    - id: 23
      name: color_temp
      type: integer
      range:
        min: 0
        max: 1000
      mapping:
        - target_range:
            min: 3000
            max: 5500
    - id: 25
      name: scene
      type: hex
      optional: true
    - id: 28
      type: hex
      name: control_data
      optional: true
secondary_entities:
  - entity: number
    name: Timer
    category: config
    icon: "mdi:timer"
    dps:
      - id: 26
        type: integer
        name: value
        unit: min
        optional: true
        range:
          min: 0
          max: 86400
        mapping:
          - scale: 60
            step: 60
  - entity: button
    name: M1 save
    category: config
    icon: "mdi:alpha-a-box"
    dps:
      - id: 102
        type: integer
        name: button
        optional: true
        mapping:
          - dps_val: 1
            value: true
          - value: false
  - entity: button
    name: M1 restore
    category: config
    icon: "mdi:alpha-a-box-outline"
    dps:
      - id: 102
        type: integer
        name: button
        optional: true
        mapping:
          - dps_val: 2
            value: true
          - value: false
  - entity: button
    name: M2 save
    category: config
    icon: "mdi:alpha-b-box"
    dps:
      - id: 102
        type: integer
        name: button
        optional: true
        mapping:
          - dps_val: 3
            value: true
          - value: false
  - entity: button
    name: M2 restore
    category: config
    icon: "mdi:alpha-b-box-outline"
    dps:
      - id: 102
        type: integer
        name: button
        optional: true
        mapping:
          - dps_val: 4
            value: true
          - value: false
  - entity: button
    name: M3 save
    category: config
    icon: "mdi:alpha-c-box"
    dps:
      - id: 102
        type: integer
        name: button
        optional: true
        mapping:
          - dps_val: 5
            value: true
          - value: false
  - entity: button
    name: M3 restore
    category: config
    icon: "mdi:alpha-c-box-outline"
    dps:
      - id: 102
        type: integer
        name: button
        optional: true
        mapping:
          - dps_val: 6
            value: true
          - value: false
  - entity: button
    name: M4 save
    category: config
    icon: "mdi:alpha-d-box"
    dps:
      - id: 102
        type: integer
        name: button
        optional: true
        mapping:
          - dps_val: 7
            value: true
          - value: false
  - entity: button
    name: M4 restore
    category: config
    icon: "mdi:alpha-d-box-outline"
    dps:
      - id: 102
        type: integer
        name: button
        optional: true
        mapping:
          - dps_val: 8
            value: true
          - value: false
evd1ser commented 7 months ago
tuya ha card ha light
IMG_0110 IMG_0111 IMG_0112

Example in tuya app and HA