Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Device Support Request] Constant current LED dimmer TS0601 by _TZE200_86nbew0j #2431

Closed
larndoc opened this issue Jun 14, 2023 · 12 comments
Closed
Labels
stale Issue is inactivate and might get closed soon Tuya Request/PR regarding a Tuya device

Comments

@larndoc
Copy link

larndoc commented Jun 14, 2023

Problem description

The following device can be used to dim downlight LEDs via zigbee, however, does not seem to be supported by ZHA:
http://www.ltechonline.com/html/en/products/Intelligence/zigbee/TY-12-100-400-W1Z.html

There is maybe an integration (converter) done in Zigbee2MQTT here: Koenkk/zigbee2mqtt#17940

Solution description

Please support this device in ZHA.

Screenshots/Video

Screenshots/Video

image

Device signature

Device signature
{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.6.1",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.11.3",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/Vienna",
    "os_name": "Linux",
    "os_version": "6.1.21-v8",
    "supervisor": "2023.06.1",
    "host_os": "Home Assistant OS 10.2",
    "docker_version": "23.0.6",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {},
  "integration_manifest": {
    "domain": "zha",
    "name": "Zigbee Home Automation",
    "after_dependencies": [
      "onboarding",
      "usb"
    ],
    "codeowners": [
      "@dmulcahey",
      "@adminiuga",
      "@puddly"
    ],
    "config_flow": true,
    "dependencies": [
      "file_upload"
    ],
    "documentation": "https://www.home-assistant.io/integrations/zha",
    "iot_class": "local_polling",
    "loggers": [
      "aiosqlite",
      "bellows",
      "crccheck",
      "pure_pcapy3",
      "zhaquirks",
      "zigpy",
      "zigpy_deconz",
      "zigpy_xbee",
      "zigpy_zigate",
      "zigpy_znp"
    ],
    "requirements": [
      "bellows==0.35.5",
      "pyserial==3.5",
      "pyserial-asyncio==0.6",
      "zha-quirks==0.0.100",
      "zigpy-deconz==0.21.0",
      "zigpy==0.55.0",
      "zigpy-xbee==0.18.0",
      "zigpy-zigate==0.11.0",
      "zigpy-znp==0.11.1"
    ],
    "usb": [
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*2652*",
        "known_devices": [
          "slae.sh cc2652rb stick"
        ]
      },
      {
        "vid": "1A86",
        "pid": "55D4",
        "description": "*sonoff*plus*",
        "known_devices": [
          "sonoff zigbee dongle plus v2"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*sonoff*plus*",
        "known_devices": [
          "sonoff zigbee dongle plus"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*tubeszb*",
        "known_devices": [
          "TubesZB Coordinator"
        ]
      },
      {
        "vid": "1A86",
        "pid": "7523",
        "description": "*tubeszb*",
        "known_devices": [
          "TubesZB Coordinator"
        ]
      },
      {
        "vid": "1A86",
        "pid": "7523",
        "description": "*zigstar*",
        "known_devices": [
          "ZigStar Coordinators"
        ]
      },
      {
        "vid": "1CF1",
        "pid": "0030",
        "description": "*conbee*",
        "known_devices": [
          "Conbee II"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8A2A",
        "description": "*zigbee*",
        "known_devices": [
          "Nortek HUSBZB-1"
        ]
      },
      {
        "vid": "0403",
        "pid": "6015",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate+"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8B34",
        "description": "*bv 2010/10*",
        "known_devices": [
          "Bitron Video AV2010/10"
        ]
      }
    ],
    "zeroconf": [
      {
        "type": "_esphomelib._tcp.local.",
        "name": "tube*"
      },
      {
        "type": "_zigate-zigbee-gateway._tcp.local.",
        "name": "*zigate*"
      },
      {
        "type": "_zigstar_gw._tcp.local.",
        "name": "*zigstar*"
      },
      {
        "type": "_slzb-06._tcp.local.",
        "name": "slzb-06*"
      }
    ],
    "is_built_in": true
  },
  "data": {
    "ieee": "**REDACTED**",
    "nwk": 2937,
    "manufacturer": "_TZE200_86nbew0j",
    "model": "TS0601",
    "name": "_TZE200_86nbew0j TS0601",
    "quirk_applied": false,
    "quirk_class": "zigpy.device.Device",
    "manufacturer_code": 4098,
    "power_source": "Mains",
    "lqi": 81,
    "rssi": null,
    "last_seen": "2023-06-14T10:51:00",
    "available": true,
    "device_type": "Router",
    "signature": {
      "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.Router: 1>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.FullFunctionDevice|MainsPowered|RxOnWhenIdle|AllocateAddress: 142>, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=False, *is_full_function_device=True, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=True, *is_security_capable=False)",
      "endpoints": {
        "1": {
          "profile_id": "0x0104",
          "device_type": "0x0051",
          "input_clusters": [
            "0x0000",
            "0x0004",
            "0x0005",
            "0xef00"
          ],
          "output_clusters": [
            "0x000a",
            "0x0019"
          ]
        }
      },
      "manufacturer": "_TZE200_86nbew0j",
      "model": "TS0601"
    },
    "active_coordinator": false,
    "entities": [],
    "neighbors": [],
    "routes": [
      {
        "dest_nwk": "0x0000",
        "route_status": "Active",
        "memory_constrained": true,
        "many_to_one": true,
        "route_record_required": false,
        "next_hop": "0x0000"
      }
    ],
    "endpoint_names": [
      {
        "name": "SMART_PLUG"
      }
    ],
    "user_given_name": null,
    "device_reg_id": "ec8dfaadb9414bf83f1df0f0a616a26e",
    "area_id": "toilet",
    "cluster_details": {
      "1": {
        "device_type": {
          "name": "SMART_PLUG",
          "id": 81
        },
        "profile_id": 260,
        "in_clusters": {
          "0x0000": {
            "endpoint_attribute": "basic",
            "attributes": {
              "0x0001": {
                "attribute_name": "app_version",
                "value": 72
              },
              "0x0004": {
                "attribute_name": "manufacturer",
                "value": "_TZE200_86nbew0j"
              },
              "0x0005": {
                "attribute_name": "model",
                "value": "TS0601"
              }
            },
            "unsupported_attributes": {}
          },
          "0x0004": {
            "endpoint_attribute": "groups",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0005": {
            "endpoint_attribute": "scenes",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0xef00": {
            "endpoint_attribute": null,
            "attributes": {},
            "unsupported_attributes": {}
          }
        },
        "out_clusters": {
          "0x0019": {
            "endpoint_attribute": "ota",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x000a": {
            "endpoint_attribute": "time",
            "attributes": {},
            "unsupported_attributes": {}
          }
        }
      }
    }
  }
}

Diagnostic information

Diagnostic information
[Paste the diagnostic information here]

Logs

Logs
[Paste the logs here]

Custom quirk

Custom quirk
[Paste your custom quirk here]

Additional information

No response

@TheJulianJES TheJulianJES added the Tuya Request/PR regarding a Tuya device label Jun 14, 2023
@javicalle
Copy link
Collaborator

I would suggest you to add your device in the TuyaSingleSwitchDimmer quirk:

class TuyaSingleSwitchDimmer(TuyaDimmerSwitch):

@larndoc
Copy link
Author

larndoc commented Jun 15, 2023

Sorry, I am new to this - how do i do this exactly? Do enable custom quirks in zha, create a custom quirk directory and copy that class in there? or do i need to edit this file already somewhere on my HA zigpy installation?
Thanks a lot.

@javicalle
Copy link
Collaborator

Almost...
Enable the local quirk configuration. You can follow that guide:
#693 (comment)
Create a new ts0601_dimmer.py file and copy the current content of the linked file. ALL the content.
Then edit the TuyaSingleSwitchDimmer class and add your device. Will be more or less like that:

        MODELS_INFO: [
            ("_TZE200_86nbew0j", "TS0601"), 
            ("_TZE200_dfxkcots", "TS0601"),
            ("_TZE200_whpb9yts", "TS0601"),
            ("_TZE200_ebwgzdqq", "TS0601"),
            ("_TZE200_9i9dt8is", "TS0601"),
            ("_TZE200_swaamsoy", "TS0601"),
            ("_TZE200_0nauxa0p", "TS0601"),
            ("_TZE200_la2c2uo9", "TS0601"),
            ("_TZE200_1agwnems", "TS0601"),  # TODO: validation pending?
            ("_TZE200_9cxuhakf", "TS0601"),  # Added for Mercator IKUU SSWM-DIMZ Device
            ("_TZE200_a0syesf5", "TS0601"),  # Added for Mercator IKUU SSWRM-ZB
            ("_TZE200_p0gzbqct", "TS0601"),
            ("_TZE200_w4cryh2i", "TS0601"),
        ],

Save changes, restart HA and repair your device.

If not working check the logs and attach the relevant info.

@larndoc
Copy link
Author

larndoc commented Jun 15, 2023

Ok, did all above, the logs indicate the custom quirk being loaded, but error out at something pretty basic - what do i do wrong?

2023-06-15 22:38:36.000 DEBUG (MainThread) [zhaquirks] Loading quirks module 'zhaquirks.yale'
2023-06-15 22:38:36.007 DEBUG (MainThread) [zhaquirks] Loading quirks module 'zhaquirks.yale.realliving'
2023-06-15 22:38:36.014 DEBUG (MainThread) [zhaquirks] Loading quirks module 'zhaquirks.zen'
2023-06-15 22:38:36.026 DEBUG (MainThread) [zhaquirks] Loading quirks module 'zhaquirks.zen.thermostat'
2023-06-15 22:38:36.034 DEBUG (MainThread) [zhaquirks] Loading quirks module 'zhaquirks.zhongxing'
2023-06-15 22:38:36.043 DEBUG (MainThread) [zhaquirks] Loading quirks module 'zhaquirks.zhongxing.motion'
2023-06-15 22:38:36.049 DEBUG (MainThread) [zhaquirks] Loading custom quirks from PosixPath('/config/zha_quirks')
2023-06-15 22:38:36.068 DEBUG (MainThread) [zhaquirks] Loading custom quirk module 'ts0601_dimmer'
2023-06-15 22:38:36.076 ERROR (MainThread) [zhaquirks] Unexpected exception importing custom quirk 'ts0601_dimmer'
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zhaquirks/__init__.py", line 454, in setup
    importer.find_module(modname).load_module(modname)
  File "<frozen importlib._bootstrap_external>", line 605, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1120, in load_module
  File "<frozen importlib._bootstrap_external>", line 945, in load_module
  File "<frozen importlib._bootstrap>", line 290, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 721, in _load
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/zha_quirks/ts0601_dimmer.py", line 2, in <module>
    from zigpy.profiles import zgp, zha
ImportError: cannot import name 'zgp' from 'zigpy.profiles' (/usr/local/lib/python3.11/site-packages/zigpy/profiles/__init__.py)
2023-06-15 22:38:36.099 DEBUG (MainThread) [homeassistant.components.zha] ZHA storage file does not exist or was already removed
2023-06-15 22:38:36.113 DEBUG (Thread-2) [aiosqlite] executing <function aiosqlite_connect.<locals>.<lambda> at 0x7f64face00>
2023-06-15 22:38:36.118 DEBUG (Thread-2) [aiosqlite] operation <function aiosqlite_connect.<locals>.<lambda> at 0x7f64face00> completed
2023-06-15 22:38:36.257 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform energy is taking over 10 seconds.

@javicalle
Copy link
Collaborator

Changes in the way...
Ok, repeat all the process but this time take the content from this version of the file:

class TuyaSingleSwitchDimmer(TuyaDimmerSwitch):

@larndoc
Copy link
Author

larndoc commented Jun 16, 2023

Ok, thanks! Now the device uses this quirk, perfect. However, functionality is not 100% there.
I can switch on/off, but the dimming does not work (if i set it to 1% it does not get less bright).
Attached is the device diagnostics and home assistant log file.

home-assistant.log

zha-918ca61f570bba9733acd9cc7d75cf0f-_TZE200_86nbew0j TS0601-ec8dfaadb9414bf83f1df0f0a616a26e.json (3).txt

@javicalle
Copy link
Collaborator

I can't see any error in your logs, but it didn't have any dimmer report either.
I would suggest to you to operate the dimmer from the phisical device and check the logs to see if there are any errors. Attach the relevant info indicating what actions where performed (ie: switch on, then dimm to 50%, dimm to 1%, switch off, etc)

@larndoc
Copy link
Author

larndoc commented Jun 21, 2023

Hi - don't know what you mean by "operate the dimmer from the physical device" .... this is a zigbee LED driver and it can only be operated via Zigbee. Maybe the converter from zigbee can give the right clues what needs to change in the quirk so the dimming would work, but i cannot figure it out myself.
Thanks again for all the support.

@larndoc
Copy link
Author

larndoc commented Jul 3, 2023

Hi - i don't know how i could help and further provide information for this LED constant current dimmer, other than this device is working when using zigbee2mqtt (with the described oddities of the brightness being reported in the state sometimes) - however, i kind of would like to stay in ZHA. Is there a way to translate the converter from zigbee2mqtt to ZHA?

Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Issue is inactivate and might get closed soon label Dec 31, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 7, 2024
@morcus
Copy link

morcus commented Jan 8, 2024

Hello. I have almost the same device (_TZE200_2gtsuokt) and the custom quirk listed above only allow to control the on/off state. How can I help in order to allow the control of the brightness and light temperature? Thank you.

@DanielSobczak
Copy link

@larndoc if you are still looking you can try this custom quirk it should work for your device as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issue is inactivate and might get closed soon Tuya Request/PR regarding a Tuya device
Projects
None yet
Development

No branches or pull requests

5 participants