make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.22k stars 490 forks source link

Request support for ION WIFI Dimmer #2131

Closed Blcktape closed 3 weeks ago

Blcktape commented 2 months ago

Log Message

Logger: custom_components.tuya_local.config_flow
Source: custom_components/tuya_local/config_flow.py:483
integration: Tuya Local ([documentation](https://github.com/make-all/tuya-local), [issues](https://github.com/make-all/tuya-local/issues))
First occurred: 12:42:35 (2 occurrences)
Last logged: 12:54:38

Device matches eurom_800_heater with quality of 100%. DPS: {"updated_at": 1722508951.3461888, "1": false, "2": 552, "3": 92, "5": 552, "6": 0}
Device matches eurom_800_heater with quality of 100%. DPS: {"updated_at": 1722509675.1124086, "1": false, "2": 552, "3": 92, "5": 552, "6": 0}

Information about DPS mappings

{
  "result": {
    "category": "tgq",
    "functions": [
      {
        "code": "switch_led_1",
        "desc": "{}",
        "name": "开关1",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "bright_value_1",
        "desc": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}",
        "name": "亮度值1",
        "type": "Integer",
        "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "brightness_min_1",
        "desc": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}",
        "name": "最小亮度1",
        "type": "Integer",
        "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "led_type_1",
        "desc": "{\"range\":[\"led\",\"incandescent\",\"halogen\"]}",
        "name": "光源类型1",
        "type": "Enum",
        "values": "{\"range\":[\"led\",\"incandescent\",\"halogen\"]}"
      },
      {
        "code": "brightness_max_1",
        "desc": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}",
        "name": "最大亮度1",
        "type": "Integer",
        "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "countdown_1",
        "desc": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}",
        "name": "开关1倒计时",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "work_mode",
        "desc": "{\"range\":[\"white\"]}",
        "name": "模式",
        "type": "Enum",
        "values": "{\"range\":[\"white\"]}"
      }
    ],
    "status": [
      {
        "code": "switch_led_1",
        "name": "开关1",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "bright_value_1",
        "name": "亮度值1",
        "type": "Integer",
        "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "brightness_min_1",
        "name": "最小亮度1",
        "type": "Integer",
        "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "led_type_1",
        "name": "光源类型1",
        "type": "Enum",
        "values": "{\"range\":[\"led\",\"incandescent\",\"halogen\"]}"
      },
      {
        "code": "brightness_max_1",
        "name": "最大亮度1",
        "type": "Integer",
        "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "countdown_1",
        "name": "开关1倒计时",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "work_mode",
        "name": "模式",
        "type": "Enum",
        "values": "{\"range\":[\"white\"]}"
      }
    ]
  },
  "success": true,
  "t": 1722513285540,
  "tid": "d87daced4ffc11efa403ca121059b45d"
}

DPS ID's

1 = Switch1
2 = Brightness1
3 = Minimum brightness1
4 = Type of light source1
5 = Maximum brightness1
6 = Countdown1
13 = Mode
{
  "result": {
    "properties": [
      {
        "code": "switch_led_1",
        "custom_name": "Slaapkamer Dimmer",
        "dp_id": 1,
        "time": 1722508564101,
        "type": "bool",
        "value": false
      },
      {
        "code": "bright_value_1",
        "custom_name": "",
        "dp_id": 2,
        "time": 1722496038783,
        "type": "value",
        "value": 552
      },
      {
        "code": "brightness_min_1",
        "custom_name": "",
        "dp_id": 3,
        "time": 1718563166843,
        "type": "value",
        "value": 92
      },
      {
        "code": "led_type_1",
        "custom_name": "",
        "dp_id": 4,
        "time": 1687034904602,
        "type": "enum",
        "value": "led"
      },
      {
        "code": "brightness_max_1",
        "custom_name": "",
        "dp_id": 5,
        "time": 1718563166862,
        "type": "value",
        "value": 552
      },
      {
        "code": "countdown_1",
        "custom_name": "",
        "dp_id": 6,
        "time": 1718563166933,
        "type": "value",
        "value": 0
      },
      {
        "code": "work_mode",
        "custom_name": "",
        "dp_id": 13,
        "time": 1687034904602,
        "type": "enum",
        "value": "white"
      }
    ]
  },
  "success": true,
  "t": 1722515175744,
  "tid": "3f2dcea7500111efa403ca121059b45d"
}
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
}
led_type_1  Enum    
{
  "range": [
    "led",
    "incandescent",
    "halogen"
  ]
}
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
}
work_mode   Enum    
{
  "range": [
    "white"
  ]
}

Product ID

I have 4 ION Dimmers with all four different product id's. Product name: LW_WI_DI_00

Information about how the device functions

https://www.ionindustries.com/winkel/led-dimmer-wifi/

Possible configuration

name: ION Dimmer switch
products:
    name: ION WIFI Dimmer
primary_entity:
  entity: light
  dps:
    - id: 1
      name: switch
      type: boolean
    - id: 2
      name: brightness
      type: integer
      range:
        min: 10
        max: 1000
secondary_entities:
  - entity: number
    name: Minimum brightness
    category: config
    icon: "mdi:brightness-percent"
    dps:
      - id: 3
        type: integer
        name: value
        unit: "%"
        range:
          min: 10
          max: 1000
        mapping:
          - step: 1
  - entity: number
    name: Maximum brightness
    category: config
    icon: "mdi:brightness-percent"
    dps:
      - id: 5
        type: integer
        name: value
        unit: "%"
        range:
          min: 10
          max: 1000
        mapping:
          - step: 1
  - entity: select
    name: Light type
    icon: mdi:lightbulb-variant
    category: config
    dps:
      - id: 4
        type: string
        name: option
        mapping:
          - dps_val: "led"
            value: LED
          - dps_val: "incandescent"
            value: Incandescent
          - dps_val: "halogen"
            value: Halogen
  - entity: select
    name: Work Mode
    category: config
    dps:
      - id: 13
        type: string
        name: option
        mapping:
          - dps_val: "white"
            value: White
  - entity: number
    translation_key: timer
    name: Timer
    category: config
    dps:
      - id: 6
        type: integer
        name: value
        unit: "s"
        range:
          min: 0
          max: 86400
        mapping:
          - scale: 0
          - step: 1

When i added the following configuration manually in the tuya-local device folder i cannot get it to match.

2024-08-01 13:00:28.354 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Loaded device config ion_wifi_dimmer.yaml
2024-08-01 13:00:28.354 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Not match for Dimmer switch, missing required DPs: [{'13': 'str'}, {'4': 'str'}]
Blcktape commented 2 months ago

@make-all Is there a reason why the integration is being rejected?

make-all commented 2 months ago

As clearly stated in the template, the log message is not optional

Blcktape commented 1 month ago

@make-all Sorry I forgot the log! I completed the issue. Can it be re opened?

Blcktape commented 1 month ago

@make-all When adding the device i cannot get it to match DPS

2024-08-01 13:00:28.354 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Loaded device config ion_wifi_dimmer.yaml
2024-08-01 13:00:28.354 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Not match for Dimmer switch, missing required DPs: [{'13': 'str'}, {'4': 'str'}]

I set DPS 4 and 13 as optional and got the option to select the yaml file. Adding went fine but when trying to set DPS 4 for example it fails. Seems that when the device pulls its configuration status from the device it does not contain DPS 4 and 13.

2024-08-01 17:12:39.802 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] option values: ['LED', 'Incandescent', 'Halogen']
2024-08-01 17:12:39.802 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] ION Dimmer switch: Mapped dps 4 to led from LED
2024-08-01 17:12:39.802 DEBUG (MainThread) [custom_components.tuya_local.device] ION Dimmer switch new pending updates: {"4": {"value": "led", "updated_at": 1722525159.8027353, "sent": false}}
2024-08-01 17:12:39.804 DEBUG (MainThread) [custom_components.tuya_local.device] ION Dimmer switch sending dps update: {"4": "led"}
2024-08-01 17:12:40.073 DEBUG (MainThread) [custom_components.tuya_local.device] ION Dimmer switch received {"1": false, "2": 552, "3": 92, "5": 115, "6": 0, "full_poll": true}
Blcktape commented 1 month ago

Device Details

{
  "result": {
    "active_time": 1712167505,
    "bind_space_id": "158688766",
    "category": "tgq",
    "create_time": 1687034904,
    "custom_name": "Sleepingroom",
    "icon": "smart/icon/ay1547540731802V31Xp/13640871deeccfd8d14120b70b8a3255.png",
    "id": "<REDACTED>",
    "ip": "<REDACTED>",
    "is_online": true,
    "lat": "<REDACTED>",
    "local_key": "<REDACTED>",
    "lon": "<REDACTED>",
    "model": "WIFI 调光器",
    "name": "ION WIFI DIMMER",
    "product_id": "ceikasvm5p5ymcax",
    "product_name": "LW_WI_DI_00",
    "sub": false,
    "time_zone": "+02:00",
    "update_time": 1718491226,
    "uuid": "85a104af002c77b5"
  },
  "success": true,
  "t": 1722605728385,
  "tid": "14c2e1dc50d411efb4aad63cb6505ef8"
}

Working Device config without DPS 4 and 13 as they cannot be controlled by tuya-local for some unknown reason.

name: ION WIFI DIMMER
products:
  - id: ceikasvm5p5ymcax
    name: ION WIFI DIMMER
primary_entity:
  entity: light
  dps:
    - id: 1
      name: switch
      type: boolean
    - id: 2
      name: brightness
      type: integer
      range:
        min: 10
        max: 1000
secondary_entities:
  - entity: number
    name: Minimum brightness
    category: config
    icon: "mdi:brightness-percent"
    dps:
      - id: 3
        type: integer
        name: value
        range:
          min: 10
          max: 1000
        mapping:
          - step: 1
  - entity: number
    name: Maximum brightness
    category: config
    icon: "mdi:brightness-percent"
    dps:
      - id: 5
        type: integer
        name: value
        range:
          min: 10
          max: 1000
        mapping:
          - step: 1
  - entity: number
    translation_key: timer
    name: Timer
    category: config
    dps:
      - id: 6
        type: integer
        name: value
        unit: "s"
        range:
          min: 0
          max: 86400
        mapping:
          - scale: 0
          - step: 1