Repository: zigpy/zha-device-handlers

Issue:
[Device Support Request]  TCP-Smart Zigbee TRV Radiator Valve (Tuya/Zigbee Quirks) [Old Integration Supported, testing/debugging new integration]
Edit: to make this make a bit more sense.

The old integration method and quirks file works with the TCP-Smart Zigbee TRV Valve, which I've added to my github at https://github.com/accessiblepixel/TCP-Smart-TRV/blob/master/ts0601_trv.py

To get this valve working with the old integration, create a folder in your config directory called custom_zha_quirks and upload the ts0601_trv.py there.

Then edit your main configuration.yaml to include
zha:
  custom_quirks_path: /config/custom_zha_quirks/

and restart, and add/pair the device as usual.

Later on in the thread we are testing the 'new' integration and trying to get support for all features of the device :)


Original post is as follows:

**Is your feature request related to a problem? Please describe.**
I cannot pair and access features of a TCP-Smart ZigBee TRV Valve. Originally it came with a Tuya compatible WiFi gateway, but I've since picked up a CC2531 USB Zigbee Gateway, but when I try and find the device in home assistant it says This Device Has No Entities.

**Describe the solution you'd like**
It looks like it's very similar to a model listed on https://zigbee.blakadder.com/Alecto_SMART-HEAT10.html it physically looks the same.

**Device signature - this can be acquired by removing the device from ZHA and pairing it again from the add 
{
  "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=0, maximum_buffer_size=82, maximum_incoming_transfer_size=255, server_mask=11264, maximum_outgoing_transfer_size=255, 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",
        "0x0003"
      ],
      "out_clusters": [
        "0x0003",
        "0x0019"
      ]
    }
  },
  "manufacturer": "_TYST11_czk78ptr",
  "model": "zk78ptr",
  "class": "zigpy.device.Device"
}

**Additional context**
If I have put this in the wrong place, please move it to the correct one. I'm very new to zigbee integration but if you need any other logfiles, please let me know. I think one of the quirks that exists for similar devices might work for this one, but it's all a bit beyond me. I hope someone can help, I'd like to move my thermostats away from the Tuya Zigbee gateway to local control with Home Assistant.

Kind regards,
Jessica

Edit: Here's a link to the product page on Amazon (UK) for the valve itself https://www.amazon.co.uk/gp/product/B0898FVKMT
and here's a link to the first device you buy that comes with the gateway that it uses: https://www.amazon.co.uk/gp/product/B0898CHSZS

It appears to be Zigbee, and I can search and find it with ZHA in Home Assistant, just no controls are created. I've been trying to look at other quirks, and since it's similar to other devices that are the same, it could just be a case of adding the IDs to one of them (but I'm just guessing. This is all new to me!)



Discussion:
Updated my original post, because apparently I can't github properly.
Added some links to the device on Amazon, and corrected the device manufacturer.

Have looked at the device, and without disassembly, I can't find any additional model numbers on it, which is a pain.

The device (as bought) is a TRV smart radiator valve, which claimed at one point on it's listing page Zigbee 3 support. It's supposed to connect to the TCP Smart Wireless Hub, which is a Zigbee to Tuya/Smart Life (or TCP Smart's own branded version of Tuya/Smart Life) via WiFi, so any control requires the cloud.

My thought was to get a USB Zigbee gateway to remove the problems I'm having getting local control of the device with Home Assistant, but looks like it's going to be more "plug 'n' pray" to someone smarter than I am with these things. If I can give any more info, let me know as we might stop someone else wanting to pull their hair out :D

Kind regards,
Jessica
Hi Jessica your device looks 100% like my Siterwell white labeled so i think its it shall being no problem getting it working with ZHA.

Do you have one brand and name of the TRV ?

I have patched 2 feles that need being added in your system and one is easy and the second its little tricky getting in right place..

First configuring "local quirks" https://github.com/zigpy/zha-device-handlers/discussions/693#discussioncomment-857274.
Copy the `ts0601_trv.py` the the new local quirk folder.
Next you need getting access to your HA docker container with CLI https://github.com/zigpy/zha-device-handlers/discussions/693#discussion-1237451.
Copy the `climate.py` to your HA config folder and then from the HA docker container CLI copy it in to the folder with this command:
```
cp /config/climate.py /usr/src/homeassistant/homeassistant/components/zha/climate.py
```
Restart HA and if all is going OK you shall getting one TRV device in ZHA.

If you is getting problem  pleas ask !!

This is the current "old" implementation with not all in place and not working but we have one with more function that  you can trying later if you like.
Sorry i was writing one wrong thing !!
The `climate.py` you shall not copy for using the "normal" quirk only if you later like testing the new updated quirk !!

Only copy the `ts0601_trv.py` to the local quirk folder and it shall working.

Its being little late for my and need little sleep i think ;-)
@MattWestb 
Thanks for the reply.

Where do I find ts0601_trv.py ?

The manufacturer is TCP-Smart and model number on Amazon is TBUWTRVZIG and has the Zigbee Device Fingerprint as above.

Other than that it doesn't have a model number, it's just called the TCP Smart Thermostatic Radiator Valve & Wireless Hub (linked both the kit and the extra valves in first comment)

Kind regards,
Jessica
Some where under the . . .
[ts0601_trv_new.zip](https://github.com/zigpy/zha-device-handlers/files/7605385/ts0601_trv_new.zip)
 
You see im needing little sleep ;-(

Config local quirk and copy the `ts0601_trv.py` to the new folder and restart HA.

I can helping more tomorrow if needed.
I have putting it in the tuya TRV matrix with brand and model
https://github.com/zigpy/zigpy/discussions/653#discussioncomment-314395 so other user can see its supported (then we have doing one working PR for it).
Ahh, thank you. Just trying it out now.

I've copied over the ts0601_trv.py to the custom folder in config and added the entry to my configuration yaml, tried doing a restart from "server control" but haven't had any success yet, so I'm trying a host reboot.

There's no real rush in fixing this, given I should probably sleep too :)
Thanks for your help so far, you're a star.

Kind regards,
Jessica.
If ZHA is matching the device OK for the quirk and loading it you shall getting in the last line on the device card like (not exact)  `Quirk: ts0601_trv_siterwell.SiterwellGS361_Type1` and also in the device signature.
@MattWestb Hmm, after putting that folder and copying the ts061_trv.py file into /config/custom_zha_quirks now when I try and use the ZHA integrations thing it says "Failed to set up" and gives a link to view the logs, which are blank. I must be doing something wrong!

Is the tr061_trv file the only one I need to put in to get it working, or do I need to put the climate.py in there too?

Don't need an answer right now, though, I'll just update my trials as I go on for a bit before I crash :)

Kind regards,
Jessica
Can you posting the error from HA ?
Local quirk can caching ZHA and its not starting but normally its mismatch of versions or bad copy paste from my side.
What I posted was the error, it's not showing anything in my HA logfile.

The only entries I get are unrealated (about having HACS loaded and localtuya)

It looks like it's crashing out the ZHA integration, just says "Failed to setup click for logs" so I click logs, and there aren't any :(

Is there a way to turn a "debug" mode on, so I can help a bit better?
These are screenshots of what I can see... (which are as useless as a chocolate fire guard!)

[https://i.lowrex.com/i/CzTa.png](Logs)
[https://i.lowrex.com/i/CFoh.png](Integration)
No `climate.py` for the "old" quirk that we is testing first.

OK its one updated line that is not updated in HA 2021.11.
Can you looking for `TuyaPowerConfigurationCluster2AA`  and relapsing it with `TuyaPowerConfigurationCluster` in all lines you can finding (its only the `2AA` that is changed) ?
That seems to have worked, it seems to be responding now 👯 

Thank you very much. After you and I have had some sleep, I'm more than willing to help you test out the "new" integration to help support another device.

Thank you so much <3

Until tomorrow.

Jessica.
The first is 2 warning that you is using external components = OK then its no error.
The second can being that the quirk is not OK and crashing ZHA.
For eliminating the problem with the local quirk you can renaming it to `ts0601_trv.Xpy` then ZHA is not trying loading it.

You can also clicking "load full home assistant log" in the log window and you can see more.
That was with the full home assistant log shown. I only have two errors, and they're both for custom compoenents (hacs and localtuya)... however, it indeed looks like the custom zha "quirk" was casuing an issue in the ZHA integration, but those edits you got me to make have made it respond (and seemingly respond pretty well!)

Go have some well deserved rest. Can pick up the next testing tomorrow. <3
So just to log some things I've noticed for us tomorrow.

It doesn't seem to communicate with ZHA very often, and seems a bit... "laggy", and doesn't accept updates as fast as I would expect, but I'm all out of energy so will check in tomorrow :) Definitely closer to a solution than we were 👍 

Edit: Gonna just keep editing this post with updates to hopefully prevent update email spam.

Hmm... Deleting the integration and re-adding it seems to have made things work a bit better (than not at all). I'm wondering if this could be a range issue? Although I never did have a problem with range with the original Zigbee>Wireless gateway.

HA says LQI is 99, but not sure what that means, but it doesn't seem communicate with ZHA after it has been paired and will no doubt go back to sleep (it being a battery device?)

and under power % in the device info it says "unknown", so I think... maybe we're missing something?
I'm a total noob when it comes to Zigbee though, so I'm very much just guessing.

Hmm, further testing seems to indicate it only sends temperature updates at every 0.5C? Certainly it only sends a "same temperature" if you change a control, then it responds almost straight away.... so... I guess it is working?

Here's the pairing log after I repaired the device.

> New device 0xce92 (ec:1b:bd:ff:fe:c2:8b:fe) joined the network
[0xce92] Scheduling initialization
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCE92 ieee=ec:1b:bd:ff:fe:c2:8b:fe is_initialized=False> from ep 0 to ep 0, cluster ZDOCmd.Device_annce: b'\xFF\x92\xCE\xFE\x8B\xC2\xFE\xFF\xBD\x1B\xEC\x80'
[0xce92:zdo] ZDO request ZDOCmd.Device_annce: [0xCE92, ec:1b:bd:ff:fe:c2:8b:fe, 128]
Tries remaining: 3
[0xce92] Requesting 'Node Descriptor'
Tries remaining: 2
[0xce92] Extending timeout for 0x07 request
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCE92 ieee=ec:1b:bd:ff:fe:c2:8b:fe is_initialized=False> from ep 0 to ep 0, cluster ZDOCmd.Node_Desc_rsp: b'\x07\x00\x92\xCE\x02\x40\x80\x00\x00\x52\xFF\x00\x00\x2C\xFF\x00\x00'
[0xce92] Got 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=0, maximum_buffer_size=82, maximum_incoming_transfer_size=255, server_mask=11264, maximum_outgoing_transfer_size=255, 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)
[0xce92] Discovering endpoints
Tries remaining: 3
[0xce92] Extending timeout for 0x08 request
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCE92 ieee=ec:1b:bd:ff:fe:c2:8b:fe is_initialized=False> from ep 0 to ep 0, cluster ZDOCmd.Active_EP_rsp: b'\x08\x00\x92\xCE\x01\x01'
[0xce92] Discovered endpoints: [1]
[0xce92] Initializing endpoints [<Endpoint id=1 in=[] out=[] status=<Status.NEW: 0>>]
[0xce92:1] Discovering endpoint information
Tries remaining: 3
[0xce92] Extending timeout for 0x09 request
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCE92 ieee=ec:1b:bd:ff:fe:c2:8b:fe is_initialized=False> from ep 0 to ep 0, cluster ZDOCmd.Simple_Desc_rsp: b'\x09\x00\x92\xCE\x10\x01\x04\x01\x00\x00\x00\x02\x00\x00\x03\x00\x02\x03\x00\x19\x00'
[0xce92:1] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=0, device_version=0, input_clusters=[0, 3], output_clusters=[3, 25])
[0xce92] Extending timeout for 0x0a request
[0xce92:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=10 command_id=Command.Read_Attributes_rsp>
[0xce92] Read model 'zk78ptr' and manufacturer '_TYST11_czk78ptr' from <Endpoint id=1 in=[basic:0x0000, identify:0x0003] out=[identify:0x0003, ota:0x0019] status=<Status.ZDO_INIT: 1>>
[0xce92] Discovered basic device information for <Device model='zk78ptr' manuf='_TYST11_czk78ptr' nwk=0xCE92 ieee=ec:1b:bd:ff:fe:c2:8b:fe is_initialized=True>
Device is initialized <Device model='zk78ptr' manuf='_TYST11_czk78ptr' nwk=0xCE92 ieee=ec:1b:bd:ff:fe:c2:8b:fe is_initialized=True>
Checking quirks for _TYST11_czk78ptr zk78ptr (ec:1b:bd:ff:fe:c2:8b:fe)
Considering <class 'ts0601_trv.SiterwellGS361_Type1'>
Found custom device replacement for ec:1b:bd:ff:fe:c2:8b:fe: <class 'ts0601_trv.SiterwellGS361_Type1'>
'climate' component -> 'Thermostat' using ['thermostat']
'sensor' component -> 'ThermostatHVACAction' using ['thermostat']
device - 0xCE92:ec:1b:bd:ff:fe:c2:8b:fe entering async_device_initialized - is_new_join: True
device - 0xCE92:ec:1b:bd:ff:fe:c2:8b:fe has joined the ZHA zigbee network
[0xCE92](zk78ptr): started configuration
[0xCE92:ZDO](zk78ptr): 'async_configure' stage succeeded
[0xCE92:1:0x0201]: bound 'thermostat' cluster: Status.SUCCESS
[0xCE92:1:0x0201]: Successfully configured reporting for '{'local_temp': (30, 900, 25), 'occupied_cooling_setpoint': (30, 900, 25), 'occupied_heating_setpoint': (30, 900, 25)}' on 'thermostat' cluster: [ConfigureReportingResponseRecord(status=0)]
[0xCE92:1:0x0201]: Successfully configured reporting for '{'unoccupied_cooling_setpoint': (30, 900, 25), 'unoccupied_heating_setpoint': (30, 900, 25), 'running_mode': (30, 900, 25)}' on 'thermostat' cluster: [ConfigureReportingResponseRecord(status=0)]
[0xCE92:1:0x0201]: Successfully configured reporting for '{'running_state': (30, 900, 5), 'system_mode': (30, 900, 25), 'occupancy': (30, 900, 1)}' on 'thermostat' cluster: [ConfigureReportingResponseRecord(status=0)]
[0xCE92:1:0x0201]: Successfully configured reporting for '{'pi_cooling_demand': (30, 900, 5), 'pi_heating_demand': (30, 900, 5)}' on 'thermostat' cluster: [ConfigureReportingResponseRecord(status=0)]
[0xCE92:1:0x0201]: finished channel configuration
[0xCE92:1:0x0000]: finished channel configuration
[0xCE92:1:0x0001]: bound 'power' cluster: Status.SUCCESS
[0xCE92:1:0x0001]: Successfully configured reporting for '{'battery_voltage': (3600, 10800, 1), 'battery_percentage_remaining': (3600, 10800, 1)}' on 'power' cluster: [ConfigureReportingResponseRecord(status=0)]
[0xCE92:1:0x0001]: finished channel configuration
[0xCE92:1:0x0019]: finished channel configuration
Error handling '_save_attribute' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 0, 4, '_TYST11_czk78ptr') params: FOREIGN KEY constraint failed
[0xCE92:1:0x0201]: 'async_configure' stage succeeded
[0xCE92:1:0x0000]: 'async_configure' stage succeeded
[0xCE92:1:0x0001]: 'async_configure' stage succeeded
[0xCE92:1:0x0019]: 'async_configure' stage succeeded
Error handling '_save_attribute' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 0, 5, 'zk78ptr') params: FOREIGN KEY constraint failed
[0xCE92](zk78ptr): completed configuration
[0xCE92](zk78ptr): stored in registry: ZhaDeviceEntry(name='_TYST11_czk78ptr zk78ptr', ieee='ec:1b:bd:ff:fe:c2:8b:fe', last_seen=1637921673.628254)
[0xce92] Extending timeout for 0x0b request
[0xce92:1:0x0003] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=11 command_id=Command.Default_Response>
[0xCE92:1:0x0003]: executed 'trigger_effect' command with args: '(2, 0)' kwargs: '{}' result: [64, <Status.UNSUP_CLUSTER_COMMAND: 129>]
[0xCE92](zk78ptr): started initialization
[0xCE92:ZDO](zk78ptr): 'async_initialize' stage succeeded
[0xCE92:1:0x0201]: initializing channel: from_cache: False
[0xCE92:1:0x0201]: Attribute report 'SiterwellThermostat'[ctrl_seqe_of_oper] = ControlSequenceOfOperation.Heating_Only
[0xCE92:1:0x0201]: Attribute report 'SiterwellThermostat'[ctrl_seqe_of_oper] = ControlSequenceOfOperation.Heating_Only
[0xCE92:1:0x0201]: Attribute report 'SiterwellThermostat'[ctrl_seqe_of_oper] = ControlSequenceOfOperation.Heating_Only
[0xCE92:1:0x0201]: finished channel initialization
[0xCE92:1:0x0000]: initializing channel: from_cache: False
[0xCE92:1:0x0000]: finished channel initialization
[0xCE92:1:0x0001]: initializing channel: from_cache: False
[0xCE92:1:0x0001]: finished channel initialization
[0xCE92:1:0x0019]: initializing channel: from_cache: False
[0xCE92:1:0x0019]: finished channel initialization
[0xCE92:1:0x0201]: 'async_initialize' stage succeeded
[0xCE92:1:0x0000]: 'async_initialize' stage succeeded
[0xCE92:1:0x0001]: 'async_initialize' stage succeeded
[0xCE92:1:0x0019]: 'async_initialize' stage succeeded
[0xCE92](zk78ptr): power source: Battery or Unknown
[0xCE92](zk78ptr): completed initialization
Error handling '_unsupported_attribute_added' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 513, 0) params: FOREIGN KEY constraint failed
Error handling '_unsupported_attribute_added' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 513, 17) params: FOREIGN KEY constraint failed
Error handling '_unsupported_attribute_added' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 513, 18) params: FOREIGN KEY constraint failed
Error handling '_unsupported_attribute_added' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 513, 19) params: FOREIGN KEY constraint failed
Error handling '_unsupported_attribute_added' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 513, 20) params: FOREIGN KEY constraint failed
Error handling '_unsupported_attribute_added' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 513, 30) params: FOREIGN KEY constraint failed
Error handling '_unsupported_attribute_added' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 513, 41) params: FOREIGN KEY constraint failed
Error handling '_unsupported_attribute_added' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 513, 28) params: FOREIGN KEY constraint failed
Error handling '_unsupported_attribute_added' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 513, 2) params: FOREIGN KEY constraint failed
Error handling '_unsupported_attribute_added' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 513, 7) params: FOREIGN KEY constraint failed
Error handling '_unsupported_attribute_added' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 513, 8) params: FOREIGN KEY constraint failed
Error handling '_unsupported_attribute_added' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 1, 32) params: FOREIGN KEY constraint failed
Error handling '_unsupported_attribute_added' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 1, 33) params: FOREIGN KEY constraint failed
Error handling '_unsupported_attribute_added' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 1, 49) params: FOREIGN KEY constraint failed
Error handling '_unsupported_attribute_added' event with (ec:1b:bd:ff:fe:c2:8b:fe, 1, 1, 51) params: FOREIGN KEY constraint failed
[0xce92:1:0xef00] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=0 command_id=1>
[0xce92:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=62, command_id=257, function=0, data=[1, 1])]
[0xce92:1:0xef00] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=1 command_id=1>
[0xce92:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=63, command_id=1293, function=0, data=[1, 2])]
[0xce92:1:0xef00] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=2 command_id=1>
[0xce92:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=64, command_id=1038, function=0, data=[1, 1])]
[0xce92:1:0xef00] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=3 command_id=1>
[0xce92:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=65, command_id=1028, function=0, data=[1, 0])]
[0xCE92:1:0x0201]: Attribute report 'SiterwellThermostat'[system_mode] = SystemMode.Off
[0xCE92:1:0x0201]: Attribute report 'SiterwellThermostat'[running_mode] = RunningMode.Off
[0xCE92:1:0x0201]: Attribute report 'SiterwellThermostat'[running_state] = RunningState.Idle
climate.tyst11_czk78ptr_zk78ptr_fe8bc2fe_thermostat: Attribute 'system_mode' = SystemMode.Off update
climate.tyst11_czk78ptr_zk78ptr_fe8bc2fe_thermostat: Attribute 'running_mode' = RunningMode.Off update
climate.tyst11_czk78ptr_zk78ptr_fe8bc2fe_thermostat: Attribute 'running_state' = RunningState.Idle update
[0xce92:1:0xef00] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=4 command_id=1>
[0xce92:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=66, command_id=514, function=0, data=[4, 0, 0, 0, 190])]
[0xCE92:1:0x0201]: Attribute report 'SiterwellThermostat'[occupied_heating_setpoint] = 1900
climate.tyst11_czk78ptr_zk78ptr_fe8bc2fe_thermostat: Attribute 'occupied_heating_setpoint' = 1900 update
[0xce92:1:0xef00] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=5 command_id=1>
[0xce92:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=67, command_id=274, function=0, data=[1, 1])]
[0xce92:1:0xef00] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=6 command_id=1>
[0xce92:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=68, command_id=263, function=0, data=[1, 0])]
[0xce92:1:0xef00] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=7 command_id=1>
[0xce92:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=69, command_id=1041, function=0, data=[1, 1])]
[0xce92:1:0xef00] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=8 command_id=1>
[0xce92:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=70, command_id=515, function=0, data=[4, 0, 0, 0, 154])]
[0xCE92:1:0x0201]: Attribute report 'SiterwellThermostat'[local_temp] = 1540
climate.tyst11_czk78ptr_zk78ptr_fe8bc2fe_thermostat: Attribute 'local_temp' = 1540 update

So I put lots of updates in the previous comment to avoid loads of comment notifications...

It seems to be working alright, just a bit slow on the temperature updates, but I guess that's just because it's battery powered.

Whenever you're ready let me know how to test the new integration :)

Also, does the ZHA-Device_Handlers project have a 'coffee donation' type thing, or a charity that they'd prefer donations to be sent to (in their name)? Feel like sending a couple of bucks in support.

Kind regards,
Jessica
The last question you can find in https://github.com/zigpy/zigpy/blob/dev/CONTRIBUTING.md#how-to-contribute-as-an-end-user.

And all tuya TRV is sleeping end devices so they is not have the radio on all the time and can taking some seconds before they is catching waiting commands from its parent.

"Normal" Zigbee device is its possible configuration of attribute reporting all normal clusters. But tuya is reusing  MCUs from other platforms like WiFi and BT and is only using the ZIgbee module a one tunnel for there "MQTT to cloud" service (sending DP commands = Data Points).
So on the Zigbee level we cant do any thing at all. My TRV  is reporting local temperature around 60 min and if the temperature is changing more then 1°C its updating it faster.

Some TRVs is possible sending one updating local temperature calibration and the MCU is sending one old and new local temperature but our MCU have that not implanted.

Now to the funny thing !!
The TRV was added in the first commit for 10 mount ago but with only basic function and most other have getting updates from nice coding user but  our not.
I have starting trying copy and paste for getting things working but it was not 100% but now one very good code warier have fixing nearly all lost broken things plus implanting some new good things.

Dow load the new quirk from this post https://github.com/zigpy/zha-device-handlers/discussions/1084#discussioncomment-1701973 and deleting the "old one" and restart HA.
If you can copy the `climate.py` you is also getting presets working in ZHA but is not  one must.

You is getting some new switches and sensors that needs being renamed but is not easy to finding them.
I can explaining later how to finding the function but i must looking little on the last version before i writing that.

If all is going well you shall getting somthing like this on the device card (after adding new custom classed and icon to the entry's:
![TRV_ZHA18](https://user-images.githubusercontent.com/49618193/143578078-1c3d43e2-56b6-40d1-8dac-801096880e3e.PNG)

And from loverns card with TRV and sensor graf:
![TRV_ZHA19](https://user-images.githubusercontent.com/49618193/143578272-5a31a0a5-6a62-42d0-aaa9-a76685fe506f.PNG)
I posting more info for doing the custom things !!


The switches and sensors is having this configuration in the quirk:
EP 1: Window Detection switch On / Off
EP 2: Valve Detection switch On / Off
EP 3: Window Open Alarm sensor
EP 4: Valve Jammed Alarm sensor
EP 5: Child Lock switch On / Off
EP 6: Install Mode (FI) Switch On / Off
EP 7: Local Temp Calibration sensor (slider + - 10 ° / 0.1°)

And the first on/off is the window detection and you can trying switching it on and off and you shall see it changing on the TRV display.
The second is val detect is have no icon in the display so you cant see it.
The third Children lock you can pressing the button on the TRV for 5 seconds and the switch is toggled in ZHA.
The forth is FI (= taking the battery out and putting them back and doing calibration of the valve) and if you is switching it on the TRV is showing FI1 and you must calibrating the valve.

The sensors is:
First Window Open / anti freeze Alarm sensor
Second Valve Jammed Alarm sensor
and the last is one slider for local temperature calibration.

The name of all is not 110% but its possible finding them out.

For valve jammed put the setpoint to high and the TRV is sending valve jammed and one ` ! ` in the window (if activated).
Putting the TRV in the freezer and you is getting window open / antifreeze alarm (if activated).

I have making this customization in HA for getting good icons and functions:
```
From my customize.yaml in HA:

binary_sensor.tyst11_trv_binary_input_2:
  device_class: problem
binary_sensor.tyst11_trv_binary_input:
  device_class: opening
switch.tyst11_trv_on_off:
  icon: mdi:window-open-variant
switch.tyst11_trv_on_off_2:
  icon: mdi:pipe-valve
switch.tyst11_trv_on_off_3:
  icon: mdi:lock
switch.tyst11_kfvq6avy_fvq6avy_c1db03fe_on_off:
  icon: mdi:wrench
```
The name of the sensors / switches is always little trickey.

Its also possible giving all names and and looking / editing in `\.storage\core.entity_registry` and finding the right end point:
```
            {
                "entity_id": "switch.tyst11_kfvq6avy_fvq6avy_c1db03fe_on_off",
                "config_entry_id": "1509216dc5c6aac3464ac35895885f7b",
                "device_id": "55b2995a1e4187422eef81c61b572b3f",
                "area_id": null,
                "unique_id": "bc:33:ac:ff:fe:03:db:c1-6-6",
                "platform": "zha",
                "name": "TYST11 TRV FI",
                "icon": "mdi:wrench",
                "disabled_by": null,
                "capabilities": {},
                "supported_features": 0,
                "device_class": null,
                "unit_of_measurement": null,
                "original_name": "_TYST11_kfvq6avy fvq6avy c1db03fe on_off",
                "original_icon": null,
                "entity_category": null
            }
        ]
    }
```
Then the `unique_id` `bc:33:ac:ff:fe:03:db:c1` is the long address for the device and in the end the end point and cluster number `6-6`. Cross reference with the En point list.
`name` is the name the entry is having in the HA GUI.


The local temperature calibration is only for ZHA showing heating / idle and also getting the graf looking nice. I have -0.9° for the moment and it can being adjusted for making it looks right then the TRV is not sending  any status of the valve is open or closed so the quirk is comparing and saying heating or idle.
Sorry i was missing your communicating problems (sorry TRV . . ).
Sending commands can being little tricky but resiving is normal working very fast.
But its one sleeping end device and we can do so much about it.
If having larger problem delete the device in ZHA waiting one minute and restarting HA.
Then ZHA is stable adding the device and look if all looks OK.
If the quirk is not loaded OK restart HA and it shall doing it OK.
Sorry if I was a little confusing!

I'll try using the new climate.py as suggested and report back :)

Edit: Do I use the climate.py from the first zip file you gave me?
Yes !  :-)
This folder
`/usr/src/homeassistant/homeassistant/components/zha/`
doesn't exist. Should I create it?

This is the output when searching for a 'zha' directory.
`[core-ssh /]$ find | grep zha
./config/custom_zha_quirks
./config/custom_zha_quirks/climate.py
./config/custom_zha_quirks/ts0601_trv_siterwell.py
./config/custom_zha_quirks/__pycache__
./config/custom_zha_quirks/__pycache__/ts0601_trv_siterwell.cpython-39.pyc
./config/custom_zha_quirks/__pycache__/ts0601_trv.cpython-39.pyc
./config/.storage/zha.storage`
Its not existing in the OS.
You must connecting to the docker container and open one CLI in it for getting  it then its only in the container.

Do you running on bare metal , VM or OS ?
You looks being much better in the Linux CLI then my ;-((
It's running in a virtual machine. I'm running Home Assistant OS 6.5.

I've installed the addon to let me SSH to it. I'll try having a look from the CLI.

Ah... Yes. I can see that folder if I login from the CLI, but I don't have SSH access to that with the addon SSH thing... so I needed to setup a private key and insert a usb stick to get access to the "real" SSH...

Anyway, I have copied that file over and am now rebooting... Certainly nothing simple about HA is there? 🤣 

Edit: To anyone else reading, to get access to the Supervisor, the place where you need to update the climate.py you have to create an SSH key, and put it on a USB stick with the label "CONFIG" in a file called authorized_keys (no extension) and it must be ANSI with Linux line terminations, and then reboot the host. Then you can SSH in on port 22222 and use the command 
`docker exec -it homeassistant /bin/bash`
which will get you into the console for the Supervisor Docker Container. These instructions I found at this address: https://developers.home-assistant.io/docs/operating-system/debugging/ 
Okay, now I've replaced climate.py and used that file from the linked thread, but now the integration isn't working again, it just says 
Failed to set up
Check the logs

And when I check the logs, nothing is listed there :(

Am I allowed to hit it yet? 🤣 
I hope you was only copying the  `climate.py` to the container and not the quirk for the device.

You can delete the quirk in the local quirk folder so its not making problems.

If you is not having one very large set up little more debug logging like:
```
logger:
  default: info
  logs:
    homeassistant.core: info
    homeassistant.components.zha: debug
    zigpy: debug
    zhaquirks: debug
```
Yes, only copied the climate.py to /usr/src/homeassistant/homeassistant/components/zha/climate.py.

D'oh! I only COPIED climate.py to that folder, I didn't delete it from the custom_zha_components folder where I uploaded it to :( 🤦 

Okay so the integration had loaded up again, but now there's no controls shown, so I don't think it's recognising to use the new quirk file with the device.
Perhaps `some one` was forgetting adding your device id in the quirk ?

Adding  it in or after line 648 (you can using one of the old one than you dont having then if you like)
(copy the string from the first quirk in the zip is best)

I can get enough sleep . . . 

> Perhaps `some one` was forgetting adding your device id in the quirk ?
> 
> Adding it in or after line 648 (you can using one of the old one than you dont having then if you like)
> 
> I can get enough sleep . . .

Whoops! Well, adding it has got some functionality working again :)

I think it's just it doesn't know what the names of the things are like you said in one of your other posts.

Here's a screenshot of the device in ZHA. I've gotta disappear for a bit, but I'll have a crack at figuring out what is what when I get back.

https://i.lowrex.com/i/C0aA.png

I'm super appreciative of your help, thanks just doesn't seem to be enough.
Hopefully since we've gone through this, the next person who tries to do what I'm doing won't have to lose so much hair xD
The grayed out you can delete its some old thing from the old quirk.
The first with the slider is local temperature correction set it to -0.9° and adjusting it later if you need.
I hope your device is communicating OK but you dont have  any battery reading but its only reported one or 2 times  day.

Try switching the children lock on the TRV and see if you is getting on of the switches changing state.

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
@@ -964,6 +964,7 @@ class SiterwellGS361_Type1(TuyaThermostat):
             ("_TYST11_ps5v5jor", "s5v5jor"),
             ("_TYST11_owwdxjbx", "wwdxjbx"),
             ("_TYST11_8daqwrsj", "daqwrsj"),
+            ("_TYST11_czk78ptr", "zk78ptr"),
         ],
         ENDPOINTS: {
             1: {
@@ -1008,6 +1009,7 @@ class SiterwellGS361_Type2(TuyaThermostat):
             ("_TZE200_ps5v5jor", "TS0601"),
             ("_TZE200_owwdxjbx", "TS0601"),
             ("_TZE200_8daqwrsj", "TS0601"),
+            ("_TZE200_czk78ptr", "TS0601"),
         ],
         ENDPOINTS: {
             1: {
@@ -1059,6 +1061,7 @@ def __init__(self, *args, **kwargs):
             ("_TZE200_ckud7u2l", "TS0601"),
             ("_TZE200_ywdxldoj", "TS0601"),
             ("_TZE200_cwnjrr72", "TS0601"),
+            ("_TZE200_2atgpdho", "TS0601"),
         ],
         ENDPOINTS: {
             1: {
@@ -1157,7 +1160,7 @@ class MoesHY368_Type2(TuyaThermostat):
             ("_TYST11_ckud7u2l", "kud7u2l"),
             ("_TYST11_ywdxldoj", "wdxldoj"),
             ("_TYST11_cwnjrr72", "wnjrr72"),
-            ("_TYST11_b6wax7g0", "6wax7g0"),
+            ("_TYST11_2atgpdho", "atgpdho"),
         ],
         ENDPOINTS: {
             1: {


Test patch: