Repository: zigpy/zha-device-handlers

Issue:
Add generic tuya trv device 
New tiya trv device _TZE200_xby0s3ta needs adding to ZHA. I've currently fudged it using a current quirk and included this device name in the list in the current tuya trv quirk. But the functionality isn't 100%. Firstly the device type isn't recognised and so I have manually changed the zha device type in the HA config, to be "climate". This didn't ultimately fix the device either, the ability to increase the temperature, like a usual climate device is missing and so is the battery level. 

Funnily enough with this device, I got the same device bit a few months ago, and ZHA is reading this new one differently hence the workaround above. The previous device is covered by a quirk already, this device shows as _TZE200_cwnjrr72. 

Having _TZE200_xby0s3ta implemented into ZHA would be a great help, with all the standard trv functionality. Thanka


Discussion:
Please fill out the issue template. Provide the device signature and the diagnostic information for the device.
Add it on one new line after this https://github.com/zigpy/zha-device-handlers/blob/84d02be7abde55a6cee80fa155f0cbbc20347c40/zhaquirks/tuya/ts0601_trv.py#L1532
If the quirk i loaded OK it shall not being needed changing the type then it getting the TRV / climate cluster from the quirk.
If its not looking OK try restarting HA.
Also put debug logging and post the log here.
**Is your feature request related to a problem? Please describe.**
As above in first post

**Describe the solution you'd like**
for this device, generic tuya TRV to be recognised by ZHA

<details>

```json
{
  "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=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=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"
      ]
    }
  },
  "manufacturer": "_TZE200_xby0s3ta",
  "model": "TS0601",
  "class": "zigpy.device.Device"
}

```

</details>

<details>

```json
{
  "home_assistant": {
    "installation_type": "Home Assistant Container",
    "version": "2023.2.0",
    "dev": false,
    "hassio": false,
    "virtualenv": false,
    "python_version": "3.10.7",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/London",
    "os_name": "Linux",
    "os_version": "5.10.28-Unraid",
    "run_as_root": true
  },
  "custom_components": {
    "fontawesome": {
      "version": "2.1.5",
      "requirements": []
    },
    "anniversaries": {
      "version": "4.5.0",
      "requirements": [
        "python-dateutil>=2.8.1",
        "integrationhelper>=0.2.2",
        "voluptuous>=0.12.1"
      ]
    },
    "govee": {
      "version": "0.2.2",
      "requirements": [
        "govee-api-laggat==0.2.2",
        "dacite==1.6.0"
      ]
    },
    "webrtc": {
      "version": "v2.2.0",
      "requirements": []
    },
    "hisense_tv": {
      "version": "22.05.09",
      "requirements": [
        "wakeonlan==2.0.1"
      ]
    },
    "first_bus": {
      "version": "1.1.2",
      "requirements": []
    },
    "frigate": {
      "version": "3.0.0",
      "requirements": []
    },
    "alarmo": {
      "version": "v1.9.7",
      "requirements": []
    },
    "xiaomi_cloud_map_extractor": {
      "version": "v2.2.0",
      "requirements": [
        "pillow",
        "pybase64",
        "python-miio",
        "requests",
        "pycryptodome"
      ]
    },
    "browser_mod": {
      "version": "2.2.0",
      "requirements": []
    },
    "localtuya": {
      "version": "5.0.0",
      "requirements": []
    },
    "homewhiz": {
      "version": "0.0.6",
      "requirements": [
        "bleak",
        "bleak_retry_connector",
        "dacite",
        "aiohttp",
        "bidict"
      ]
    },
    "eufy_security": {
      "version": "6.2.0",
      "requirements": [
        "websocket-client==1.1.0",
        "aiortsp==1.3.6"
      ]
    },
    "hildebrandglow_dcc": {
      "version": "1.0.3",
      "requirements": [
        "pyglowmarkt==0.5.5"
      ]
    },
    "roborock": {
      "version": "0.0.27",
      "requirements": [
        "paho-mqtt",
        "pycryptodome",
        "ndg-httpsclient",
        "pyopenssl",
        "pyasn1",
        "pillow"
      ]
    },
    "spotcast": {
      "version": "v3.6.30",
      "requirements": []
    },
    "govee_lan": {
      "version": "1.0.0",
      "requirements": [
        "govee-led-wez>=0.0.14"
      ]
    },
    "hacs": {
      "version": "1.30.1",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "asusrouter": {
      "version": "0.18.3",
      "requirements": [
        "asusrouter==0.19.7"
      ]
    },
    "sonic": {
      "version": "v0.1.5",
      "requirements": [
        "herolabsapi==0.3.9"
      ]
    },
    "alexa_media": {
      "version": "4.6.0",
      "requirements": [
        "alexapy==1.26.4",
        "packaging>=20.3",
        "wrapt>=1.12.1"
      ]
    },
    "mass": {
      "version": "2023.2.1",
      "requirements": [
        "music-assistant==1.8.7.4"
      ]
    },
    "watchman": {
      "version": "0.5.1",
      "requirements": [
        "prettytable==3.0.0"
      ]
    }
  },
  "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": 39620,
    "manufacturer": "_TZE200_xby0s3ta",
    "model": "TS0601",
    "name": "_TZE200_xby0s3ta TS0601",
    "quirk_applied": false,
    "quirk_class": "zigpy.device.Device",
    "manufacturer_code": 4098,
    "power_source": "Battery or Unknown",
    "lqi": 135,
    "rssi": null,
    "last_seen": "2023-02-06T16:57:48",
    "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=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=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": "Bathroom Radiator",
    "device_reg_id": "28df1e1e903f6dc1e65a79b8654bd347",
    "area_id": null,
    "cluster_details": {
      "1": {
        "device_type": {
          "name": "SMART_PLUG",
          "id": 81
        },
        "profile_id": 260,
        "in_clusters": {
          "0x0000": {
            "endpoint_attribute": "basic",
            "attributes": {
              "0x0004": {
                "attribute_name": "manufacturer",
                "value": "_TZE200_xby0s3ta"
              },
              "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": {}
          }
        }
      }
    }
  }
}

```

</details>

<details>
<summary>Additional logs</summary>

```
Paste any additional debug logs here.
Don't remove the extra line breaks outside the ``` marks.
```

</details>

**Additional context**
I have managed to add others, by doing as @MattWestb  has suggested with adding the device into the existing quirk, and also by changing the device class to climate. But this is all manual work around which took me days to figure out, and others may not be able to, or know how to, do the work around, so it would be good to just include this new device into the ZHA device handler. Thanks

> Add it on one new line after this
> 
> https://github.com/zigpy/zha-device-handlers/blob/84d02be7abde55a6cee80fa155f0cbbc20347c40/zhaquirks/tuya/ts0601_trv.py#L1532
> 
> 
> If the quirk i loaded OK it shall not being needed changing the type then it getting the TRV / climate cluster from the quirk.
> If its not looking OK try restarting HA.
> Also put debug logging and post the log here.

Thanks @MattWestb  this did work, as I just stated in my comment I have just previously posted. I thought it would only be fair to reply directly to your comment also. Thanks
> Please fill out the issue template. Provide the device signature and the diagnostic information for the device.

As above, in separate comment. Thanks
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.
I've just bought one of these and would be delighted to see it fully supported in ZHA.

Resolving patch:
diff --git a/zhaquirks/tuya/ts0601_trv.py b/zhaquirks/tuya/ts0601_trv.py
--- a/zhaquirks/tuya/ts0601_trv.py
+++ b/zhaquirks/tuya/ts0601_trv.py
@@ -1536,6 +1536,7 @@ def __init__(self, *args, **kwargs):
             ("_TZE200_9sfg7gm0", "TS0601"),
             ("_TZE200_8whxpsiw", "TS0601"),
             ("_TZE200_8thwkzxl", "TS0601"),  # Tervix Pro Line EVA 2
+            ("_TZE200_xby0s3ta", "TS0601"),  # Sandy Beach HY367
         ],
         ENDPOINTS: {
             1: {


Test patch: