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] TS0041 needs quirk from TS0044

See original GitHub issue

Tried adding a switch very similar to the Tuya 1 button switch (TS0041) but failed. Quirk does not get loaded due to endpoints mismatch. link to switch on Ali : https://nl.aliexpress.com/item/1005002858374901.html

However the endpoints are matching those present in TS0044.py Seems that these buttons are created in mass with 4 buttons and depending on housing and soldering only 1, 2, 3 or 4 are active.

Device signature
{
  "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, 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=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)",
  "endpoints": {
    "1": {
      "profile_id": 260,
      "device_type": "0x0000",
      "in_clusters": [
        "0x0000",
        "0x0001",
        "0x0006",
        "0xe000"
      ],
      "out_clusters": [
        "0x000a",
        "0x0019"
      ]
    },
    "2": {
      "profile_id": 260,
      "device_type": "0x0000",
      "in_clusters": [
        "0x0001",
        "0x0006"
      ],
      "out_clusters": []
    },
    "3": {
      "profile_id": 260,
      "device_type": "0x0000",
      "in_clusters": [
        "0x0001",
        "0x0006"
      ],
      "out_clusters": []
    },
    "4": {
      "profile_id": 260,
      "device_type": "0x0000",
      "in_clusters": [
        "0x0001",
        "0x0006"
      ],
      "out_clusters": []
    }
  },
  "manufacturer": "_TZ3000_x7mej5oc",
  "model": "TS0041",
  "class": "zigpy.device.Device"
Diagnostic information
{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.5.3",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.9.9",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Brussels",
    "os_name": "Linux",
    "os_version": "5.10.108",
    "supervisor": "2022.05.1",
    "host_os": "Home Assistant OS 7.6",
    "docker_version": "20.10.9",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "hacs": {
      "version": "1.24.5",
      "requirements": [
        "aiogithubapi>=21.11.0"
      ]
    },
    "eufy_security": {
      "version": "1.0.0",
      "requirements": [
        "python-eufy-security==0.3.1"
      ]
    }
  },
  "integration_manifest": {
    "domain": "zha",
    "name": "Zigbee Home Automation",
    "config_flow": true,
    "documentation": "https://www.home-assistant.io/integrations/zha",
    "requirements": [
      "bellows==0.29.0",
      "pyserial==3.5",
      "pyserial-asyncio==0.6",
      "zha-quirks==0.0.73",
      "zigpy-deconz==0.16.0",
      "zigpy==0.45.1",
      "zigpy-xbee==0.14.0",
      "zigpy-zigate==0.7.4",
      "zigpy-znp==0.7.0"
    ],
    "usb": [
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*2652*",
        "known_devices": [
          "slae.sh cc2652rb stick"
        ]
      },
      {
        "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": "10C4",
        "pid": "8B34",
        "description": "*bv 2010/10*",
        "known_devices": [
          "Bitron Video AV2010/10"
        ]
      }
    ],
    "codeowners": [
      "@dmulcahey",
      "@adminiuga"
    ],
    "zeroconf": [
      {
        "type": "_esphomelib._tcp.local.",
        "name": "tube*"
      }
    ],
    "after_dependencies": [
      "usb",
      "zeroconf"
    ],
    "iot_class": "local_polling",
    "loggers": [
      "aiosqlite",
      "bellows",
      "crccheck",
      "pure_pcapy3",
      "zhaquirks",
      "zigpy",
      "zigpy_deconz",
      "zigpy_xbee",
      "zigpy_zigate",
      "zigpy_znp"
    ],
    "is_built_in": true
  },
  "data": {
    "ieee": "**REDACTED**",
    "nwk": 43773,
    "manufacturer": "_TZ3000_x7mej5oc",
    "model": "TS0041",
    "name": "_TZ3000_x7mej5oc TS0041",
    "quirk_applied": false,
    "quirk_class": "zigpy.device.Device",
    "manufacturer_code": 4417,
    "power_source": "Battery or Unknown",
    "lqi": null,
    "rssi": null,
    "last_seen": "2022-05-11T20:02:01",
    "available": true,
    "device_type": "EndDevice",
    "signature": {
      "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, 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=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)",
      "endpoints": {
        "1": {
          "profile_id": 260,
          "device_type": "0x0000",
          "in_clusters": [
            "0x0000",
            "0x0001",
            "0x0006",
            "0xe000"
          ],
          "out_clusters": [
            "0x000a",
            "0x0019"
          ]
        },
        "2": {
          "profile_id": 260,
          "device_type": "0x0000",
          "in_clusters": [
            "0x0001",
            "0x0006"
          ],
          "out_clusters": []
        },
        "3": {
          "profile_id": 260,
          "device_type": "0x0000",
          "in_clusters": [
            "0x0001",
            "0x0006"
          ],
          "out_clusters": []
        },
        "4": {
          "profile_id": 260,
          "device_type": "0x0000",
          "in_clusters": [
            "0x0001",
            "0x0006"
          ],
          "out_clusters": []
        }
      }
    },
    "entities": [
      {
        "entity_id": "sensor.hall_switch_power",
        "name": "_TZ3000_x7mej5oc TS0041"
      },
      {
        "entity_id": "switch.hall_switch_on_off",
        "name": "_TZ3000_x7mej5oc TS0041"
      },
      {
        "entity_id": "switch.hall_switch_on_off_2",
        "name": "_TZ3000_x7mej5oc TS0041"
      },
      {
        "entity_id": "switch.hall_switch_on_off_3",
        "name": "_TZ3000_x7mej5oc TS0041"
      },
      {
        "entity_id": "switch.hall_switch_on_off_4",
        "name": "_TZ3000_x7mej5oc TS0041"
      }
    ],
    "neighbors": [],
    "endpoint_names": [
      {
        "name": "ON_OFF_SWITCH"
      },
      {
        "name": "ON_OFF_SWITCH"
      },
      {
        "name": "ON_OFF_SWITCH"
      },
      {
        "name": "ON_OFF_SWITCH"
      }
    ],
    "user_given_name": "Hall switch",
    "device_reg_id": "74288230d087e0ca4b6cebcf1273e0c8",
    "area_id": "hall"
  }
}

Big thanks to @dmulcahey for guiding me trough and helping out!

Please shout if more info is needed!

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
MattWestbcommented, May 12, 2022

Very likely its coming TS042 and TS0043 device with the same cluster / endpoint config but is having different model info. One new thing its having one “0xe000” cluster but i think the manufacture is using the same PCB for remotes and switches (at least the “old” version was having it) and is planing using the new firmware the same way.

For the TS004F is having the same PCB as the “normal” ts004X device and is having the same commands and 3 EP as the ts0044 only that it is having dimmer functionality in the firmware (with working touch link functionality).

My point was / is keep the quirks and not putting devices in wrong classes then its making all worse. So ts0041 with 4 EP is still one TS0041 and not one TS0044 device.

Add the new signature in one new device class and i think all is working OK

1reaction
dmulcaheycommented, May 11, 2022

So, I scratched something out that may help us in the future: https://github.com/zigpy/zha-device-handlers/blob/9e0fb0e7d0664cc6e097989e1c541196034bd8e3/quirk_generator/locate_matches.py

this will take a diagnostics file from ZHA and attempt to find existing quirks that may match the device. It’s still very rough but I did test it with this case.

to solve this… should we import the matching class into ts0041.py and just override MODEL?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Help adding a variation of Tuya TS0044, TS004F to ZHA
The steps as I understand them: Create a custom quirk dir in HA, e.g., /config/custom_zha_quirks; In configuration.yaml, point to this directory ...
Read more >
zigbee2mqtt: Versions - Openbase
This release adds support for 41 new devices: 14153806L Lidl Livarno smart LED ceiling light; 3315-L Iris Water sensor; 43023 VBLED ZigBee AC...
Read more >
Chinese TS0041 1-bang zigbee scene switch on ZHA ...
So after playing with quirks I found a solution. I took a quirk for ts0044 (same switch, but with 4 gangs) replaced all...
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