question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Device Support Request] TS0601 GDC311ZBQ1 Tuya Loratap Garage Switcher

See original GitHub issue

{ "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.AllocateAddress|RxOnWhenIdle|MainsPowered|FullFunctionDevice: 142>, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, 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": 260, "device_type": "0x0051", "in_clusters": [ "0x0000", "0x0004", "0x0005", "0xef00" ], "out_clusters": [ "0x000a", "0x0019" ] }, "242": { "profile_id": 41440, "device_type": "0x0061", "in_clusters": [], "out_clusters": [ "0x0021" ] } }, "manufacturer": "_TZE200_wfxuhoea", "model": "TS0601", "class": "zigpy.device.Device" }

Tuya device that has no entities/controls in home assistant and its a simple Zigbee Tuya garage switcher. It has a sensor if the garage is opened or not, but it should be very similar to many other devices like this.

Thanks in advance for the support.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:82 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
cvjensencommented, Jun 28, 2022

After switching in HA, the entity returns to the off state or do you need to switch off to switch the entity again?

Yes now I have made an automation that automatically switches it back whenever I use it . Not the most beautiful solution but it works .

Could you post the actual version of the quirk?

"""Tuya based cover and blinds."""
from typing import Dict

from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
import zigpy.types as t
from zigpy.zcl.clusters.general import Basic, GreenPowerProxy, Groups, Ota, Scenes, Time
from zigpy.zcl.clusters.security import IasZone

from zhaquirks.const import (
    DEVICE_TYPE,
    ENDPOINTS,
    INPUT_CLUSTERS,
    MODELS_INFO,
    OUTPUT_CLUSTERS,
    PROFILE_ID,
)
from zhaquirks.tuya import TuyaLocalCluster
from zhaquirks.tuya.mcu import (
    DPToAttributeMapping,
    TuyaDPType,
    TuyaMCUCluster,
    TuyaOnOff
)

from zhaquirks.tuya.ts0601_dimmer import TuyaOnOffNM


ZONE_TYPE = 0x0001


class ContactSwitchCluster(TuyaLocalCluster, IasZone):
    """Tuya ContactSwitch Sensor."""

    _CONSTANT_ATTRIBUTES = {ZONE_TYPE: IasZone.ZoneType.Contact_Switch}

    def _update_attribute(self, attrid, value):
        self.debug("_update_attribute '%s': %s", attrid, value)
        super()._update_attribute(attrid, value)


class TuyaGarageManufCluster(TuyaMCUCluster):
    """Tuya garage door opener."""

    attributes = TuyaMCUCluster.attributes.copy()
    attributes.update(
        {
            # ramdom attribute IDs
            0xEF02: ("dp_2", t.uint32_t, True),
            0xEF04: ("dp_4", t.uint32_t, True),
            0xEF05: ("dp_5", t.uint32_t, True),
            0xEF0B: ("dp_11", t.Bool, True),
            0xEF0C: ("dp_12", t.enum8, True),
        }
    )

    dp_to_attribute: Dict[int, DPToAttributeMapping] = {
        # garage door trigger ¿on movement, on open, on closed?
        1: DPToAttributeMapping(
            TuyaOnOffNM.ep_attribute,
            "on_off",
            dp_type=TuyaDPType.BOOL,
        ),
        2: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "dp_2",
            dp_type=TuyaDPType.VALUE,
        ),
        3: DPToAttributeMapping(
            ContactSwitchCluster.ep_attribute,
            "zone_status",
            dp_type=TuyaDPType.BOOL,
            converter=lambda x: IasZone.ZoneStatus.Alarm_1 if x else 0,
            endpoint_id=2,
        ),
        4: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "dp_4",
            dp_type=TuyaDPType.VALUE,
        ),
        5: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "dp_5",
            dp_type=TuyaDPType.VALUE,
        ),
        11: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "dp_11",
            dp_type=TuyaDPType.BOOL,
        ),
        # garage door status (open, closed, ...)
        12: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "dp_12",
            dp_type=TuyaDPType.ENUM,
        ),
    }

    data_point_handlers = {
        1: "_dp_2_attr_update",
        2: "_dp_2_attr_update",
        3: "_dp_2_attr_update",
        4: "_dp_2_attr_update",
        5: "_dp_2_attr_update",
        11: "_dp_2_attr_update",
        12: "_dp_2_attr_update",
    }


class TuyaGarageSwitchTO(CustomDevice):
    """Tuya Garage switch."""

    signature = {
        MODELS_INFO: [
            ("_TZE200_nklqjk62", "TS0601"),
        ],
        ENDPOINTS: {
            # <SimpleDescriptor endpoint=1 profile=260 device_type=0x0051
            # input_clusters=[0, 4, 5, 61184]
            # output_clusters=[10, 25]>
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaGarageManufCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
            # <SimpleDescriptor endpoint=242 profile=41440 device_type=97
            # input_clusters=[]
            # output_clusters=[33]
            242: {
                PROFILE_ID: 41440,
                DEVICE_TYPE: 97,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
            },
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaGarageManufCluster,
                    TuyaOnOffNM,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
            2: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.IAS_ZONE,
                INPUT_CLUSTERS: [
                    ContactSwitchCluster
                ],
                OUTPUT_CLUSTERS: [],
            },
            242: {
                PROFILE_ID: 0xA1E0,
                DEVICE_TYPE: 0x0061,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [0x0021],
            },
        },
    }

If I’m not wrong, now you have a switch that can trigger the garage door and a contact sensor that report the door sensor state, is it like that?

Yes thats correct . It is actually working for me . I went from having a device that didnt work at all and now I can use it so thats good . Thanks alot.

It will be better if you try to grep the log with the device ID. In your case it seems to be 0x9acc. Maybe this way you can get some info from others DPs.

garageport.log

2reactions
toxic0berlinercommented, Nov 28, 2022

Grrr, sorry, I’m gonna learn to read someday… I’m gonna look into it’s it’s still not loading…

homeassistant.log
2022-11-28 11:24:13.193 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-11-28 11:24:13.194 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration zha_toolkit which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-11-28 11:24:13.194 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration monitor_docker which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-11-28 11:24:13.195 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration zha which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-11-28 11:24:13.195 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration roborock which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-11-28 11:24:13.196 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration xiaomi_cloud_map_extractor which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-11-28 11:24:13.196 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration frigate which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-11-28 11:24:18.291 WARNING (MainThread) [homeassistant.components.meteo_france] 1 hour rain forecast not available. Clermont-Ferrand - Auvergne (63) - FR is not in covered zone
2022-11-28 11:24:18.301 INFO (MainThread) [Jellyfin] ---[ START JELLYFINCLIENT ]---
2022-11-28 11:24:24.697 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Lamp15 0xece8f14' for yeelight integration not ready yet: Failed to read from the socket at 10.0.60.131:55443: [Errno 113] Connect call failed ('10.0.60.131', 55443).; Retrying in background
2022-11-28 11:24:41.800 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration zha: Unable to import component: cannot import name 'ScannerEntity' from 'homeassistant.components.device_tracker' (/usr/src/homeassistant/homeassistant/components/device_tracker/__init__.py)
2022-11-28 11:24:41.813 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: Integration 'zha' does not support device automation triggers. Got OrderedDict([('default_config', {}), ('tts', [OrderedDict([('platform', 'google_translate')])]), ('automation', [OrderedDict([('alias', 'TestWebhook'), ('trigger', OrderedDict([('platform', 'webhook'), ('webhook_id', 'testwebhook')])), ('action', OrderedDict([('service', 'camera.enable_motion_detection'), ('data', OrderedDict()), ('target', OrderedDict([('device_id', '31762c17e94d0a59134633d4d1a3633f')]))])), ('id', '3033e90dd5ce4433b4ae9088f19eca43')]), OrderedDict([('id', '1658777183554'), .... (See /config/configuration.yaml, line 8). 
2022-11-28 11:24:41.818 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of zha_toolkit. Setup failed for dependencies: zha
2022-11-28 11:24:41.819 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration zha_toolkit: (DependencyError(...), 'Could not setup dependencies: zha')
2022-11-28 11:24:47.190 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration zha: cannot import name 'ScannerEntity' from 'homeassistant.components.device_tracker' (/usr/src/homeassistant/homeassistant/components/device_tracker/__init__.py)
2022-11-28 11:24:47.238 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration zha: cannot import name 'ScannerEntity' from 'homeassistant.components.device_tracker' (/usr/src/homeassistant/homeassistant/components/device_tracker/__init__.py)
2022-11-28 11:24:47.241 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 808, in async_create_flow
    integration.get_platform("config_flow")
  File "/usr/src/homeassistant/homeassistant/loader.py", line 728, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 745, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/zha/__init__.py", line 19, in <module>
    from . import api
  File "/config/custom_components/zha/api.py", line 68, in <module>
    from .core.gateway import EntityReference
  File "/config/custom_components/zha/core/__init__.py", line 3, in <module>
    from .device import ZHADevice
  File "/config/custom_components/zha/core/device.py", line 34, in <module>
    from . import channels
  File "/config/custom_components/zha/core/channels/__init__.py", line 28, in <module>
    from .. import (
  File "/config/custom_components/zha/core/discovery.py", line 20, in <module>
    from .. import (  # noqa: F401 pylint: disable=unused-import,
  File "/config/custom_components/zha/device_tracker.py", line 7, in <module>
    from homeassistant.components.device_tracker import ScannerEntity, SourceType
ImportError: cannot import name 'ScannerEntity' from 'homeassistant.components.device_tracker' (/usr/src/homeassistant/homeassistant/components/device_tracker/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 225, in async_init
    flow, result = await task
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 243, in _async_init
    flow = await self.async_create_flow(handler, context=context, data=data)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 815, in async_create_flow
    raise data_entry_flow.UnknownHandler
homeassistant.data_entry_flow.UnknownHandler
2022-11-28 11:24:47.295 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 808, in async_create_flow
    integration.get_platform("config_flow")
  File "/usr/src/homeassistant/homeassistant/loader.py", line 728, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 745, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/zha/__init__.py", line 19, in <module>
    from . import api
  File "/config/custom_components/zha/api.py", line 68, in <module>
    from .core.gateway import EntityReference
  File "/config/custom_components/zha/core/__init__.py", line 3, in <module>
    from .device import ZHADevice
  File "/config/custom_components/zha/core/device.py", line 34, in <module>
    from . import channels
  File "/config/custom_components/zha/core/channels/__init__.py", line 28, in <module>
    from .. import (
  File "/config/custom_components/zha/core/discovery.py", line 20, in <module>
    from .. import (  # noqa: F401 pylint: disable=unused-import,
  File "/config/custom_components/zha/device_tracker.py", line 7, in <module>
    from homeassistant.components.device_tracker import ScannerEntity, SourceType
ImportError: cannot import name 'ScannerEntity' from 'homeassistant.components.device_tracker' (/usr/src/homeassistant/homeassistant/components/device_tracker/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 225, in async_init
    flow, result = await task
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 243, in _async_init
    flow = await self.async_create_flow(handler, context=context, data=data)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 815, in async_create_flow
    raise data_entry_flow.UnknownHandler
homeassistant.data_entry_flow.UnknownHandler
2022-11-28 11:25:37.511 ERROR (MainThread) [frontend.js.latest.202211080] :0:0 ResizeObserver loop completed with undelivered notifications.

Will have to wait for this evening to come back home and sort this out if I can.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TUYA TS0601 Zigbee garage door opener
I saw this garage door opener device on Ali Express, ... [Device Support Request] TS0601 GDC311ZBQ1 Tuya Loratap Garage Switcher.
Read more >
Tuya ZigBee 3.0 Garage Door Wireless Sensor Opener ...
Tuya ZigBee 3.0 Garage Door Wireless Sensor Opener Controller Switch Control by Smart Life Works with Google Home Echo Alexa,ZigBee Series,Garage Door ...
Read more >
Tuya Zigbee Garage Door Opener - Integrations - Hubitat
What is the process for requesting support for new devices? I tried changing the device type, and I even added a driver code...
Read more >
TuYa GDC311ZBQ1 control via MQTT - Zigbee2MQTT
Description, LoraTap garage door opener with wireless sensor. Exposes, trigger, garage_door_contact, linkquality. Picture, TuYa GDC311ZBQ1.
Read more >
Intégration Automatisme de porte de garage Zigbee de ...
Tuya ZigBee 3.0 Garage Door Wireless Sensor Opener Controller Switch Control. ... [Device Support Request] TS0601 GDC311ZBQ1 Tuya Loratap Garage Switcher.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found