zigpy / zha-device-handlers

ZHA device handlers bridge the functionality gap created when manufacturers deviate from the ZCL specification, handling deviations and exceptions by parsing custom messages to and from Zigbee devices.
Apache License 2.0
689 stars 638 forks source link

[Device Support Request] MIR-TE100-TY temp and humidity sensor no entities in ZHA #2174

Closed pbvdven closed 1 year ago

pbvdven commented 1 year ago

Is your feature request related to a problem? Please describe. The device shows no entities image

Describe the solution you'd like Would be nice that this device would work with zha. i thought it would because it says here its supported https://zigbee.blakadder.com/Tuya_MIR-TE100.html but maybe its a newer version?

{
  "home_assistant": {
    "installation_type": "Home Assistant Supervised",
    "version": "2023.2.1",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.7",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Amsterdam",
    "os_name": "Linux",
    "os_version": "5.10.0-21-amd64",
    "supervisor": "2023.01.1",
    "host_os": "Debian GNU/Linux 11 (bullseye)",
    "docker_version": "20.10.23",
    "chassis": "desktop",
    "run_as_root": true
  },
  "custom_components": {
    "helium": {
      "version": "0.3.8",
      "requirements": [
        "beautifulsoup4>=4.9.0",
        "jsonpath>=0.82",
        "xmltodict>=0.12.0",
        "httpx>=0.16.1"
      ]
    },
    "watchman": {
      "version": "0.5.1",
      "requirements": [
        "prettytable==3.0.0"
      ]
    },
    "webrtc": {
      "version": "v3.0.2",
      "requirements": []
    },
    "sonoff": {
      "version": "3.3.1",
      "requirements": [
        "pycryptodome>=3.6.6"
      ]
    },
    "auth_header": {
      "version": "1.4",
      "requirements": []
    },
    "smartir": {
      "version": "1.17.6",
      "requirements": [
        "aiofiles==0.6.0"
      ]
    },
    "ezviz_cloud": {
      "version": "0.1.0.6",
      "requirements": [
        "pyezviz==0.2.0.12"
      ]
    },
    "hacs": {
      "version": "1.30.1",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "buienalarm": {
      "version": "1.9",
      "requirements": [
        "pybuienalarm==0.1.1"
      ]
    },
    "localtuya": {
      "version": "5.0.0",
      "requirements": []
    },
    "browser_mod": {
      "version": "2.2.0",
      "requirements": []
    },
    "ui_lovelace_minimalist": {
      "version": "v1.1.6-hotfix",
      "requirements": [
        "aiofiles==0.8.0",
        "aiogithubapi>=22.2.4"
      ]
    },
    "dahua": {
      "version": "0.5.0",
      "requirements": []
    },
    "frigate": {
      "version": "3.0.0",
      "requirements": []
    },
    "fglair_heatpump_controller": {
      "version": "0.1.8",
      "requirements": [
        "pyfujitseu==0.9.3.2"
      ]
    },
    "blueiris": {
      "version": "1.0.15",
      "requirements": []
    },
    "alarmo": {
      "version": "v1.9.7",
      "requirements": []
    },
    "jumbo": {
      "version": "0.8.0",
      "requirements": [
        "python-jumbo-api==0.8.0"
      ]
    },
    "home_connect_alt": {
      "version": "0.5.10",
      "requirements": [
        "home-connect-async==0.7.5"
      ]
    },
    "dwains_dashboard": {
      "version": "3.3.0",
      "requirements": []
    },
    "climate_group": {
      "version": "0.4.2",
      "requirements": []
    }
  },
  "integration_manifest": {
    "domain": "zha",
    "name": "Zigbee Home Automation",
    "config_flow": true,
    "documentation": "https://www.home-assistant.io/integrations/zha",
    "requirements": [
      "bellows==0.34.7",
      "pyserial==3.5",
      "pyserial-asyncio==0.6",
      "zha-quirks==0.0.92",
      "zigpy-deconz==0.19.2",
      "zigpy==0.53.0",
      "zigpy-xbee==0.16.2",
      "zigpy-zigate==0.10.3",
      "zigpy-znp==0.9.2"
    ],
    "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"
        ]
      }
    ],
    "codeowners": [
      "@dmulcahey",
      "@adminiuga",
      "@puddly"
    ],
    "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*"
      }
    ],
    "dependencies": [
      "file_upload"
    ],
    "after_dependencies": [
      "onboarding",
      "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": 28345,
    "manufacturer": "_TZE200_zl1kmjqx",
    "model": "TS0601",
    "name": "_TZE200_zl1kmjqx TS0601",
    "quirk_applied": false,
    "quirk_class": "zigpy.device.Device",
    "manufacturer_code": 4417,
    "power_source": "Battery or Unknown",
    "lqi": 255,
    "rssi": -63,
    "last_seen": "2023-02-04T21:43:32",
    "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": "0x0051",
          "in_clusters": [
            "0x0000",
            "0x0004",
            "0x0005",
            "0xef00"
          ],
          "out_clusters": [
            "0x000a",
            "0x0019"
          ]
        }
      }
    },
    "active_coordinator": false,
    "entities": [],
    "neighbors": [],
    "routes": [],
    "endpoint_names": [
      {
        "name": "SMART_PLUG"
      }
    ],
    "user_given_name": null,
    "device_reg_id": "05106bdad4214e63280c54a6c3572311",
    "area_id": null,
    "cluster_details": {
      "1": {
        "device_type": {
          "name": "SMART_PLUG",
          "id": 81
        },
        "profile_id": 260,
        "in_clusters": {
          "0x0004": {
            "endpoint_attribute": "groups",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0005": {
            "endpoint_attribute": "scenes",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0xef00": {
            "endpoint_attribute": null,
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0000": {
            "endpoint_attribute": "basic",
            "attributes": {
              "0x0001": {
                "attribute_name": "app_version",
                "value": 72
              },
              "0x0004": {
                "attribute_name": "manufacturer",
                "value": "_TZE200_zl1kmjqx"
              },
              "0x0005": {
                "attribute_name": "model",
                "value": "TS0601"
              }
            },
            "unsupported_attributes": {}
          }
        },
        "out_clusters": {
          "0x0019": {
            "endpoint_attribute": "ota",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x000a": {
            "endpoint_attribute": "time",
            "attributes": {},
            "unsupported_attributes": {}
          }
        }
      }
    }
  }
}
javicalle commented 1 year ago

I would suggest to add your device in the TuyaTempHumiditySensor quirk: https://github.com/zigpy/zha-device-handlers/blob/1bfe93211342b370aa0c3ab37f384c35fceb4c32/zhaquirks/tuya/ts0601_sensor.py#L78-L103

Here are a good guide to config your local quirk folder. Put the current ts0601_sensor.py inside: https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts0601_sensor.py Edit the TuyaTempHumiditySensor class adding your device like:

class TuyaTempHumiditySensor(CustomDevice):
    """Custom device representing tuya temp and humidity sensor with e-ink screen."""

    # RelativeHumidity multiplier
    RH_MULTIPLIER = 10

    signature = {
        # <SimpleDescriptor endpoint=1, profile=260, device_type=81
        # device_version=1
        # input_clusters=[4, 5, 61184, 0]
        # output_clusters=[25, 10]>
        MODELS_INFO: [
            ("_TZE200_bjawzodf", "TS0601"),
            ("_TZE200_zl1kmjqx", "TS0601"),
        ],
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TemperatureHumidityManufCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [Ota.cluster_id, Time.cluster_id],
            }
        },
    }
    .../...

Save changes, restart HA and repair your device.

pbvdven commented 1 year ago

@javicalle i only put the quirk in the folder and restarted ha not changed anything but i get this error in home assistant after reboot and zha entities are not available any idea what im doing wrong?

Logger: homeassistant.config_entries Source: custom_zha_quirks/ts0601_sensor.py:54 First occurred: 22:51:46 (1 occurrences) Last logged: 22:51:46

Error setting up entry ConBee II, s/n: DE2423162 - dresden elektronik ingenieurtechnik GmbH for zha Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 382, in async_setup result = await component.async_setup_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/zha/init.py", line 100, in async_setup_entry setup_quirks(config) File "/usr/local/lib/python3.10/site-packages/zhaquirks/init.py", line 409, in setup importer.find_module(modname).load_module(modname) File "", line 548, in _check_name_wrapper File "", line 1063, in load_module File "", line 888, in load_module File "", line 290, in _load_module_shim File "", line 719, in _load File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/config/custom_zha_quirks/ts0601_sensor.py", line 50, in class TemperatureHumidityManufCluster(TuyaMCUCluster): File "/config/custom_zha_quirks/ts0601_sensor.py", line 54, in TemperatureHumidityManufCluster 1: DPToAttributeMapping( TypeError: DPToAttributeMapping.init() missing 1 required positional argument: 'dp_type'

pbvdven commented 1 year ago

@javicalle thanks for helping someone changed the file https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts0601_sensor.py and that's not working for me but i took a previous version and edit that one and now the device is working.

javicalle commented 1 year ago

i took a previous version and edit that one and now the device is working.

👍🏻 I didn't realize that this change was pending.

Can you confirm that RH values are fine too?

pbvdven commented 1 year ago

i took a previous version and edit that one and now the device is working.

👍🏻 I didn't realize that this change was pending.

Can you confirm that RH values are fine too?

Yes the values are correct. Thanks

image image

tof92130 commented 1 year ago

@javicalle thanks for helping someone changed the file https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts0601_sensor.py and that's not working for me but i took a previous version and edit that one and now the device is working.

Hello,

I am facing same problem. Which previous version did you take ?

Logger: homeassistant.config_entries Source: custom_zha_quirks/ts0601_sensor.py:54 First occurred: 19:04:46 (1 occurrences) Last logged: 19:04:46

Error setting up entry Sonoff Zigbee 3.0 USB Dongle Plus, s/n: ac5316c0b819ec1182847fe5f01c6278 - ITead for zha Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 382, in async_setup result = await component.async_setup_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/zha/init.py", line 100, in async_setup_entry setup_quirks(config) File "/usr/local/lib/python3.10/site-packages/zhaquirks/init.py", line 409, in setup importer.find_module(modname).load_module(modname) File "", line 548, in _check_name_wrapper File "", line 1063, in load_module File "", line 888, in load_module File "", line 290, in _load_module_shim File "", line 719, in _load File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/config/custom_zha_quirks/ts0601_sensor.py", line 50, in class TemperatureHumidityManufCluster(TuyaMCUCluster): File "/config/custom_zha_quirks/ts0601_sensor.py", line 54, in TemperatureHumidityManufCluster 1: DPToAttributeMapping( TypeError: DPToAttributeMapping.init() missing 1 required positional argument: 'dp_type'

javicalle commented 1 year ago

That would be fixed in the 2022.03 HA release.