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
711 stars 660 forks source link

[Device Support Request] Pull Bead Curtain Motor M515EGZT -V2 (Tuya?) #1158

Closed PremiumUsername closed 2 years ago

PremiumUsername commented 2 years ago

The manual included with the device says the model is: M515EGZT -V2version-12v. When I bought it it said Tuya in the listing but The product is not branded. The device says TM616EGZT on the back.

Device signature - this can be acquired by removing the device from ZHA and pairing it again from the add devices screen. Be sure to add the entire content of the log panel after pairing the device to a code block below this line.

[0x0000:zdo] ZDO request ZDOCmd.Mgmt_Permit_Joining_req: [60, <Bool.false: 0>]
[0x3a33:1:0x0006] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=114 command_id=Command.Report_Attributes>
[0x3a33:1:0x0006] ZCL request 0x000a: [[Attribute(attrid=0, value=<TypeValue type=Bool, value=Bool.true>)]]
[0x3a33:1:0x0006] Attribute report received: on_off=1
[0x3a33:1:0x0008] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=115 command_id=Command.Report_Attributes>
[0x3a33:1:0x0008] ZCL request 0x000a: [[Attribute(attrid=0, value=<TypeValue type=uint8_t, value=131>)]]
[0x3a33:1:0x0008] Attribute report received: current_level=131
[0x3A33:1:0x0008]: received attribute: 0 update with value: 131
[0x2929:1:0x0006] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=21 command_id=Command.Report_Attributes>
[0x2929:1:0x0006] ZCL request 0x000a: [[Attribute(attrid=0, value=<TypeValue type=Bool, value=Bool.true>)]]
[0x2929:1:0x0006] Attribute report received: on_off=1
[0x8417:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=True is_reply=True disable_default_response=True> manufacturer=4447 tsn=196 command_id=Command.Report_Attributes>
[0x8417:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=65281, value=<TypeValue type=LVBytes, value=b'\x01!\xbd\x0b\x03(\x1c\x04!\xa8\x13\x05!%\x04\x06$\x01\x00\x00\x00\x00\n!\x00\x00d\x10\x00'>)]]
[0x8417:1:0x0000] Attribute report received: 65281=b'\x01!\xbd\x0b\x03(\x1c\x04!\xa8\x13\x05!%\x04\x06$\x01\x00\x00\x00\x00\n!\x00\x00d\x10\x00'
[0x8417:1:0x0001] Voltage mV: [Min]:2820 < [RAW]:3005 < [Max]:3100, Battery Percent: 66.0
New device 0xcbea (b4:e3:f9:ff:fe:f4:f8:2e) joined the network
[0xcbea] Scheduling initialization
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 0 to ep 0, cluster 19: b'\x85\xea\xcb.\xf8\xf4\xfe\xff\xf9\xe3\xb4\x8e'
[0xcbea:zdo] ZDO request ZDOCmd.Device_annce: [0xCBEA, b4:e3:f9:ff:fe:f4:f8:2e, 142]
Tries remaining: 3
[0xcbea] Requesting 'Node Descriptor'
Tries remaining: 2
[0xcbea] Extending timeout for 0x27 request
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 10: b'\x00,\x00\x07\x00'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0x000a id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=44 command_id=Command.Read_Attributes>, payload: b'\x07\x00'
[0xcbea] Uninitialized device command 'Command.Read_Attributes' args: [[7]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 10: b'\x00,\x00\x07\x00'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0x000a id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=44 command_id=Command.Read_Attributes>, payload: b'\x07\x00'
[0xcbea] Uninitialized device command 'Command.Read_Attributes' args: [[7]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 10: b'\x00,\x00\x07\x00'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0x000a id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=44 command_id=Command.Read_Attributes>, payload: b'\x07\x00'
[0xcbea] Uninitialized device command 'Command.Read_Attributes' args: [[7]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 10: b'\x00,\x00\x07\x00'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0x000a id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=44 command_id=Command.Read_Attributes>, payload: b'\x07\x00'
[0xcbea] Uninitialized device command 'Command.Read_Attributes' args: [[7]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 10: b'\x00,\x00\x07\x00'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0x000a id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=44 command_id=Command.Read_Attributes>, payload: b'\x07\x00'
[0xcbea] Uninitialized device command 'Command.Read_Attributes' args: [[7]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 10: b'\x00,\x00\x07\x00'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0x000a id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=44 command_id=Command.Read_Attributes>, payload: b'\x07\x00'
[0xcbea] Uninitialized device command 'Command.Read_Attributes' args: [[7]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 10: b'\x00,\x00\x07\x00'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0x000a id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=44 command_id=Command.Read_Attributes>, payload: b'\x07\x00'
[0xcbea] Uninitialized device command 'Command.Read_Attributes' args: [[7]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 10: b'\x00,\x00\x07\x00'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0x000a id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=44 command_id=Command.Read_Attributes>, payload: b'\x07\x00'
[0xcbea] Uninitialized device command 'Command.Read_Attributes' args: [[7]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 10: b'\x00,\x00\x07\x00'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0x000a id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=44 command_id=Command.Read_Attributes>, payload: b'\x07\x00'
[0xcbea] Uninitialized device command 'Command.Read_Attributes' args: [[7]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 10: b'\x00,\x00\x07\x00'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0x000a id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=44 command_id=Command.Read_Attributes>, payload: b'\x07\x00'
[0xcbea] Uninitialized device command 'Command.Read_Attributes' args: [[7]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 10: b'\x00,\x00\x07\x00'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0x000a id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=44 command_id=Command.Read_Attributes>, payload: b'\x07\x00'
[0xcbea] Uninitialized device command 'Command.Read_Attributes' args: [[7]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 10: b'\x00,\x00\x07\x00'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0x000a id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=44 command_id=Command.Read_Attributes>, payload: b'\x07\x00'
[0xcbea] Uninitialized device command 'Command.Read_Attributes' args: [[7]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 10: b'\x00,\x00\x07\x00'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0x000a id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=44 command_id=Command.Read_Attributes>, payload: b'\x07\x00'
[0xcbea] Uninitialized device command 'Command.Read_Attributes' args: [[7]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 10: b'\x00,\x00\x07\x00'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0x000a id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=44 command_id=Command.Read_Attributes>, payload: b'\x07\x00'
[0xcbea] Uninitialized device command 'Command.Read_Attributes' args: [[7]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 10: b'\x00,\x00\x07\x00'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0x000a id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=44 command_id=Command.Read_Attributes>, payload: b'\x07\x00'
[0xcbea] Uninitialized device command 'Command.Read_Attributes' args: [[7]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 61184: b'\t-\x01\x00\x03\x01\x04\x00\x01\x01'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0xef00 id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=45 command_id=1>, payload: b'\x00\x03\x01\x04\x00\x01\x01'
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 61184: b'\t-\x01\x00\x03\x01\x04\x00\x01\x01'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0xef00 id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=45 command_id=1>, payload: b'\x00\x03\x01\x04\x00\x01\x01'
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 61184: b'\t-\x01\x00\x03\x01\x04\x00\x01\x01'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0xef00 id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=45 command_id=1>, payload: b'\x00\x03\x01\x04\x00\x01\x01'
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 61184: b'\t-\x01\x00\x03\x01\x04\x00\x01\x01'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0xef00 id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=45 command_id=1>, payload: b'\x00\x03\x01\x04\x00\x01\x01'
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 61184: b'\t-\x01\x00\x03\x01\x04\x00\x01\x01'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0xef00 id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=45 command_id=1>, payload: b'\x00\x03\x01\x04\x00\x01\x01'
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 0 to ep 0, cluster 32770: b"'\x00\xea\xcb\x01@\x8e\x02\x10RR\x00\x00,R\x00\x00"
[0xcbea] Got 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=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=False, *is_full_function_device=True, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=True, *is_security_capable=False)
[0xcbea] Discovering endpoints
Tries remaining: 3
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 1 to ep 1, cluster 61184: b'\t-\x01\x00\x03\x01\x04\x00\x01\x01'
[0xcbea] Received ZCL while uninitialized on endpoint id 1, cluster 0xef00 id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=45 command_id=1>, payload: b'\x00\x03\x01\x04\x00\x01\x01'
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 0 to ep 0, cluster 32773: b')\x00\xea\xcb\x01\x01'
[0xcbea] Discovered endpoints: [1]
[0xcbea] Initializing endpoints [<Endpoint id=1 in=[] out=[] status=<Status.NEW: 0>>]
[0xcbea:1] Discovering endpoint information
Tries remaining: 3
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=False> from ep 0 to ep 0, cluster 32772: b'+\x00\xea\xcb\x14\x01\x04\x01Q\x00\x01\x04\x00\x00\x04\x00\x05\x00\x00\xef\x02\x19\x00\n\x00'
[0xcbea:1] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=81, device_version=1, input_clusters=[0, 4, 5, 61184], output_clusters=[25, 10])
Unknown cluster 61184
[0xcbea: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=45 command_id=1>
[0xcbea:1:0xef00] Unknown cluster-specific command 1
[0xcbea: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=45 command_id=Command.Read_Attributes_rsp>
[0xcbea:1:0x0000] ZCL request 0x0001: [[ReadAttributeRecord(attrid=4, status=<Status.SUCCESS: 0>, value=<TypeValue type=CharacterString, value=_TZE200_hsgrhjpf>), ReadAttributeRecord(attrid=5, status=<Status.SUCCESS: 0>, value=<TypeValue type=CharacterString, value=TS0601>)]]
[0xcbea: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=45 command_id=1>
[0xcbea:1:0xef00] Unknown cluster-specific command 1
[0xcbea:1:0xef00] ZCL request 0x0001: b'\x00\x03\x01\x04\x00\x01\x01'
[0xcbea:1:0xef00] No handler for cluster command 1
[0xcbea: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=47 command_id=Command.Read_Attributes_rsp>
Error handling '_save_attribute' event with (b4:e3:f9:ff:fe:f4:f8:2e, 1, 0, 4, '_TZE200_hsgrhjpf') params: FOREIGN KEY constraint failed
[0xcbea: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=45 command_id=1>
[0xcbea:1:0xef00] Unknown cluster-specific command 1
[0xcbea:1:0xef00] ZCL request 0x0001: b'\x00\x03\x01\x04\x00\x01\x01'
[0xcbea:1:0xef00] No handler for cluster command 1
[0xcbea: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=49 command_id=Command.Read_Attributes_rsp>
[0xcbea] Read model 'TS0601' and manufacturer '_TZE200_hsgrhjpf' from <Endpoint id=1 in=[basic:0x0000, groups:0x0004, scenes:0x0005, None:0xEF00] out=[ota:0x0019, time:0x000A] status=<Status.ZDO_INIT: 1>>
[0xcbea] Discovered basic device information for <Device model='TS0601' manuf='_TZE200_hsgrhjpf' nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=True>
Device is initialized <Device model='TS0601' manuf='_TZE200_hsgrhjpf' nwk=0xCBEA ieee=b4:e3:f9:ff:fe:f4:f8:2e is_initialized=True>
Checking quirks for _TZE200_hsgrhjpf TS0601 (b4:e3:f9:ff:fe:f4:f8:2e)
Considering <class 'ts0601.TuyaMoesCover0601'>
Found custom device replacement for b4:e3:f9:ff:fe:f4:f8:2e: <class 'ts0601.TuyaMoesCover0601'>
device - 0xCBEA:b4:e3:f9:ff:fe:f4:f8:2e entering async_device_initialized - is_new_join: True
device - 0xCBEA:b4:e3:f9:ff:fe:f4:f8:2e has joined the ZHA zigbee network
[0xCBEA](TS0601): started configuration
[0xCBEA:ZDO](TS0601): 'async_configure' stage succeeded
Error handling '_save_attribute' event with (b4:e3:f9:ff:fe:f4:f8:2e, 1, 0, 5, 'TS0601') params: FOREIGN KEY constraint failed
[0xCBEA:1:0x0102]: bound 'window_covering' cluster: Status.SUCCESS
[0xCBEA:1:0x0102]: Successfully configured reporting for '{'current_position_lift_percentage': (0, 900, 1)}' on 'window_covering' cluster: [ConfigureReportingResponseRecord(status=0)]
[0xCBEA:1:0x0102]: finished channel configuration
[0xCBEA:1:0x0000]: finished channel configuration
[0xCBEA:1:0x0019]: finished channel configuration
[0xCBEA:1:0x0102]: 'async_configure' stage succeeded
[0xCBEA:1:0x0000]: 'async_configure' stage succeeded
[0xCBEA:1:0x0019]: 'async_configure' stage succeeded
[0xcbea: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=45 command_id=1>
[0xcbea:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=3, command_id=1025, function=0, data=[1, 1])]
[0xCBEA](TS0601): completed configuration
[0xCBEA](TS0601): stored in registry: ZhaDeviceEntry(name='_TZE200_hsgrhjpf TS0601', ieee='b4:e3:f9:ff:fe:f4:f8:2e', last_seen=1637234015.6077633)
[0xCBEA](TS0601): started initialization
[0xCBEA:ZDO](TS0601): 'async_initialize' stage succeeded
[0xCBEA:1:0x0102]: initializing channel: from_cache: False
[0xCBEA:1:0x0102]: finished channel initialization
[0xCBEA:1:0x0000]: initializing channel: from_cache: False
[0xCBEA:1:0x0000]: finished channel initialization
[0xCBEA:1:0x0019]: initializing channel: from_cache: False
[0xCBEA:1:0x0019]: finished channel initialization
[0xCBEA:1:0x0102]: 'async_initialize' stage succeeded
[0xCBEA:1:0x0000]: 'async_initialize' stage succeeded
[0xCBEA:1:0x0019]: 'async_initialize' stage succeeded
[0xCBEA](TS0601): power source: Mains
[0xCBEA](TS0601): completed initialization
[0xCBEA:1:0x0102]: read current position: None
polling current state
read pos=None
[0xcbea: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=45 command_id=1>
[0xcbea:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=3, command_id=1025, function=0, data=[1, 1])]
Error handling '_unsupported_attribute_added' event with (b4:e3:f9:ff:fe:f4:f8:2e, 1, 258, 8) params: FOREIGN KEY constraint failed
[0xcbea: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=45 command_id=1>
[0xcbea:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=3, command_id=1025, function=0, data=[1, 1])]
[0xcbea: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=45 command_id=1>
[0xcbea:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=3, command_id=1025, function=0, data=[1, 1])]
[0xcbea: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=45 command_id=1>
[0xcbea:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=3, command_id=1025, function=0, data=[1, 1])]
[0xcbea: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=45 command_id=1>
[0xcbea:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=3, command_id=1025, function=0, data=[1, 1])]
[0xcbea: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=45 command_id=1>
[0xcbea:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=3, command_id=1025, function=0, data=[1, 1])]
[0xcbea: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=45 command_id=1>
[0xcbea:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=3, command_id=1025, function=0, data=[1, 1])]
[0xcbea: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=45 command_id=1>
[0xcbea:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=3, command_id=1025, function=0, data=[1, 1])]
[0xcbea: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=45 command_id=1>
[0xcbea:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=3, command_id=1025, function=0, data=[1, 1])]
[0xcbea: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=45 command_id=1>
[0xcbea:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=3, command_id=1025, function=0, data=[1, 1])]
[0xcbea: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=46 command_id=1>
[0xcbea:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=4, command_id=1031, function=0, data=[1, 0])]
[0xcbea: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=47 command_id=1>
[0xcbea:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=5, command_id=514, function=0, data=[4, 0, 0, 0, 100])]
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[current_position_lift_percentage] = 0
setting position: 0
[0xcbea: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=48 command_id=1>
[0xcbea:1:0xef00] ZCL request 0x0001: [Command(status=0, tsn=6, command_id=1029, function=0, data=[1, 0])]
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[motor_direction] = 0
[0xcbea:1:0xef00] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=49 command_id=36>
[0xcbea:1:0xef00] ZCL request 0x0024: [[0, 44]]
[0xcbea:1:0xef00] No handler for cluster command 36
[0xcbea: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=50 command_id=17>
[0xcbea:1:0xef00] Unknown cluster-specific command 17
[0xcbea:1:0xef00] ZCL request 0x0011: b'\x00-@'
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[current_position_lift_percentage] = 100
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[motor_direction] = 0
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[cover_inverted] = 0
setting position: 100
[0xcbea: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=50 command_id=17>
[0xcbea:1:0xef00] Unknown cluster-specific command 17
[0xcbea:1:0xef00] ZCL request 0x0011: b'\x00-@'
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[current_position_lift_percentage] = 100
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[motor_direction] = 0
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[cover_inverted] = 0
setting position: 100
[0xcbea: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=50 command_id=17>
[0xcbea:1:0xef00] Unknown cluster-specific command 17
[0xcbea:1:0xef00] ZCL request 0x0011: b'\x00-@'
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[current_position_lift_percentage] = 100
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[motor_direction] = 0
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[cover_inverted] = 0
setting position: 100
[0xcbea: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=50 command_id=17>
[0xcbea:1:0xef00] Unknown cluster-specific command 17
[0xcbea:1:0xef00] ZCL request 0x0011: b'\x00-@'
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[current_position_lift_percentage] = 100
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[motor_direction] = 0
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[cover_inverted] = 0
setting position: 100
[0xcbea: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=50 command_id=17>
[0xcbea:1:0xef00] Unknown cluster-specific command 17
[0xcbea:1:0xef00] ZCL request 0x0011: b'\x00-@'
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[current_position_lift_percentage] = 100
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[motor_direction] = 0
[0xCBEA:1:0x0102]: Attribute report 'Window Covering'[cover_inverted] = 0
setting position: 100

Additional context It pairs OK. No buttons at first. Tried using a custom quirk using the same key settings as for TZE200_nueqqe6k: TUYA_COVER_COMMAND = { "_TZE200_hsgrhjpf": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001}, } ... then I see buttons but they can't be used.

When I chose a point on the slider the device blinks once but nothing happens. I haven't set limits for the device (don't know how), so I can't see how the slider could ever work. Pressing the stop, up or down buttons just gives an error message "Failed to call service..."

PremiumUsername commented 2 years ago

I see now that my custom quirk doesn't seem to be loading ok.

File "/usr/local/lib/python3.9/site-packages/zhaquirks/tuya/__init__.py", line 917, in command
    TUYA_COVER_COMMAND[manufacturer][command_id],
KeyError: '_TZE200_hsgrhjpf'

Seems to me like it's not using the init file I put in the local folder. Why is that?

MattWestb commented 2 years ago

The INIT must being put in the HA docker container or your local quirk can getting data from it (local quirks is getting all from the container and cant getting from local quirks).

Instruction editing files in the HA container: https://github.com/zigpy/zha-device-handlers/discussions/693

PremiumUsername commented 2 years ago

I've now edited the init file directly in the container and now the buttons work.

in the file ts0601.py I used:

        MODELS_INFO: [
            ("_TZE200_zah67ekd", "TS0601"),
            ("_TZE200_xuzcvlku", "TS0601"),
            ("_TZE200_rddyvrci", "TS0601"),
            ("_TZE200_nueqqe6k", "TS0601"),
            ("_TZE200_gubdgai2", "TS0601"),
            ("_TZE200_yenbr4om", "TS0601"),
            ("_TZE200_5sbebbzs", "TS0601"),
            ("_TZE200_hsgrhjpf", "TS0601"),
        ], 

and in init.py:

TUYA_COVER_COMMAND = {
    "_TZE200_zah67ekd": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001},
    "_TZE200_fzo2pocs": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001},
    "_TZE200_xuzcvlku": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001},
    "_TZE200_rddyvrci": {0x0000: 0x0002, 0x0001: 0x0001, 0x0002: 0x0000},
    "_TZE200_3i3exuay": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001},
    "_TZE200_nueqqe6k": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001},
    "_TZE200_gubdgai2": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001},
    "_TZE200_zpzndjez": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001},
    "_TZE200_cowvfni3": {0x0000: 0x0002, 0x0001: 0x0000, 0x0002: 0x0001},
    "_TYST11_wmcdj3aq": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001},
    "_TZE200_yenbr4om": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001},
    "_TZE200_5sbebbzs": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001},
    "_TZE200_hsgrhjpf": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001},
}

I still don't know how or if it is possible to calibrate the end positions somehow. So the slider doesn't work. How is it I'm supposed to set the end positions, what clusters/commands should I use?

MattWestb commented 2 years ago

I dont knowing but i think it can being made with the buttons but you need reading in the forum how to do that.

If the Up, Down and Stop working OK (then 100% open the up is grayed out and the down is grayed out then 100% closed) ?

If it OK i can doing one PR for adding it do it being supported in next release of HA.

PremiumUsername commented 2 years ago

I dont knowing but i think it can being made with the buttons but you need reading in the forum how to do that.

If the Up, Down and Stop working OK (then 100% open the up is grayed out and the down is grayed out then 100% closed) ?

If it OK i can doing one PR for adding it do it being supported in next release of HA.

If I manually set the slider to somewhere in the middle I can use both the UP and Down button, otherwise one button is greyed out. I think this part is working ok. The missing functionality stems form me not having limits set so I think adding it would be fine.

I may add that the manual only shows how to set the limits via the Queqi gateway. There are no instructions for using the set-buttons and the method for first version of M515EGZT doesn't seem to work, so I think I need to do this via zigbee. Maybe someone could sniff what the gateway is doing when it sets the limits.

dhc25 commented 2 years ago

@PremiumUsername did you have any luck in finding out how to set limits manually (with buttons on the device), instead of through Tuya app? Or have you found an inx manual for TM616EGZT? Thanks

PremiumUsername commented 2 years ago

Sadly, I haven't found a way to do so. I also tried to use a remote from a zemismart zigbee curtain motor, but I wasn't able to pair it, the manuals for these products seems incomplete.

I did find this on the zemismart website:

/**
 *  Tuya Window Shade (v.0.1.0)
 *  Copyright 2020 iquix
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 This DTH is coded based on iquix's tuya-window-shade DTH.
 https://github.com/iquix/Smartthings/blob/master/devicetypes/iquix/tuya-window-shade.src/tuya-window-shade.groovy
 */

import groovy.json.JsonOutput
import physicalgraph.zigbee.zcl.DataType

metadata {
    definition(name: "ZemiSmart Vertical Blind", namespace: "ShinJjang", author: "ShinJjang-iquix", ocfDeviceType: "oic.d.blind", vid: "generic-shade") {
        capability "Actuator"
        capability "Configuration"
        capability "Window Shade"
        capability "Window Shade Preset"
        capability "Switch Level"
        capability "Sensor"

        command "pause"
        command "levelOpenClose"

        attribute "Direction", "enum", ["Reverse","Forward"]
        attribute "OCcommand", "enum", ["Replace","Original"]
        attribute "stapp", "enum", ["Reverse","Forward"]
        attribute "remote", "enum", ["Reverse","Forward"]

        fingerprint endpointId: "0x01", profileId: "0104", inClusters: "0000 0004 0005 EF00", outClusters: "0019, 000A", manufacturer: "_TZE200_xuzcvlku", model: "TS0601", deviceJoinName: "Zemismart Vertical Blind"        
    }

    preferences {
        input "preset", "number", title: "Preset position", description: "Set the window shade preset position", defaultValue: 50, range: "0..100", required: false, displayDuringSetup: false
        input name: "Direction", type: "enum", title: "Direction Set", options:["01": "Reverse", "00": "Forward"], required: true, displayDuringSetup: true
        input name: "OCcommand", type: "enum", title: "Replace Open and Close commands", options:["2": "Replace", "0": "Original"], required: true, displayDuringSetup: true
        input name: "stapp", type: "enum", title: "app opening,closing Change", options:["2": "Reverse", "0": "Forward"], required: true, displayDuringSetup: true
        input name: "remote", type: "enum", title: "RC opening,closing Change", options:["1": "Reverse", "0": "Forward"], required: true, displayDuringSetup: true
    }

    tiles(scale: 2) {
        multiAttributeTile(name:"windowShade", type: "generic", width: 6, height: 4) {
            tileAttribute("device.windowShade", key: "PRIMARY_CONTROL") {
                attributeState "open", label: 'Open', action: "close", icon: "http://www.ezex.co.kr/img/st/window_open.png", backgroundColor: "#00A0DC", nextState: "closing"
                attributeState "closed", label: 'Closed', action: "open", icon: "http://www.ezex.co.kr/img/st/window_close.png", backgroundColor: "#ffffff", nextState: "opening"
                attributeState "partially open", label: 'Partially open', action: "close", icon: "http://www.ezex.co.kr/img/st/window_open.png", backgroundColor: "#d45614", nextState: "closing"
                attributeState "opening", label: 'Opening', action: "close", icon: "http://www.ezex.co.kr/img/st/window_open.png", backgroundColor: "#00A0DC", nextState: "closing"
                attributeState "closing", label: 'Closing', action: "open", icon: "http://www.ezex.co.kr/img/st/window_close.png", backgroundColor: "#ffffff", nextState: "opening"
            }
        }
        standardTile("contPause", "device.switch", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
            state "pause", label:"", icon:'st.sonos.pause-btn', action:'pause', backgroundColor:"#cccccc"
        }
        standardTile("presetPosition", "device.presetPosition", width: 2, height: 2, decoration: "flat") {
            state "default", label: "Preset", action:"presetPosition", icon:"st.Home.home2"
        }
        standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 2, height: 1) {
            state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
        }
        valueTile("shadeLevel", "device.level", width: 4, height: 1) {
            state "level", label: 'Shade is ${currentValue}% up', defaultState: true
        }
        controlTile("levelSliderControl", "device.level", "slider", width:2, height: 1, inactiveLabel: false) {
            state "level", action:"switch level.setLevel"
        }

        main "windowShade"
        details(["windowShade", "contPause", "presetPosition", "shadeLevel", "levelSliderControl", "refresh"])
    }
}

private getCLUSTER_TUYA() { 0xEF00 }
private getSETDATA() { 0x00 }

// Parse incoming device messages to generate events
def parse(String description) {
log.debug description
    if (description?.startsWith('catchall:') || description?.startsWith('read attr -')) {
        Map descMap = zigbee.parseDescriptionAsMap(description)      
        if (descMap?.clusterInt==CLUSTER_TUYA) {
            if ( descMap?.command == "01" || descMap?.command == "02" ) {
                def dp = zigbee.convertHexToInt(descMap?.data[3]+descMap?.data[2])
                log.debug "dp = " + dp
                switch (dp) {
                    case 1025: 
                        def parData = descMap.data[6] as int
                        if(parData != 1){
                        def stappVal = (stapp ?:"0") as int
                        def data = Math.abs(parData - stappVal)
                        sendEvent([name:"windowShade", value: (data == 0 ? "opening":"closing"), displayed: true])
                        log.debug "App control=" + (data == 0 ? "opening":"closing")
                        }
                        break
                    case 1031: // 0x04 0x07: Confirm opening/closing/stopping (triggered from remote)
                        def parData = descMap.data[6] as int
                        def remoteVal = remote as int
                        def data = Math.abs(parData - remoteVal)
                        sendEvent([name:"windowShade", value: (data == 0 ? "opening":"closing"), displayed: true])
                        log.debug "Remote control=" + (data == 0 ? "opening":"closing")
                        break
                    case 514: // 0x02 0x02: Started moving to position (triggered from Zigbee)
                        def setLevel = zigbee.convertHexToInt(descMap.data[9])
                        def lastLevel = device.currentValue("level")
                        //sendEvent([name:"windowShade", value: (setLevel >= lastLevel ? "opening":"closing"), displayed: true])
                        log.debug "Remote control=" + (setLevel >= lastLevel ? "opening":"closing")
                        log.debug "setLevel : $setLevel"
                        log.debug "lastLevel : $lastLevel"
                        if (setLevel > 0 && setLevel <100) 
                        {
                            sendEvent(name: "windowShade", value: "partially open")
                        } 
                        else 
                        {
                            if (setLevel == 0) 
                            sendEvent([name:"windowShade", value: "open", displayed: true])
                            if (setLevel == 100)
                            sendEvent([name:"windowShade", value: "closed", displayed: true])                           
                        }                        
                        //log.debug "arrived at position :"+pos

                        sendEvent(name: "level", value: (setLevel))
                        break
                    case 515: // 0x02 0x03: Arrived at position
                        def pos = zigbee.convertHexToInt(descMap.data[9])
                        log.debug "arrived at position :"+pos
                        if (pos > 0 && pos <100) {
                            sendEvent(name: "windowShade", value: "partially open")
                        } else {
                            sendEvent([name:"windowShade", value: (pos == 100 ? "open":"closed"), displayed: true])
                        }
                        sendEvent(name: "level", value: (pos))
                        break
                    default: log.debug "abnormal case : $dp" 
                        break
                }
            }
        }
    }
}

def close() {
    log.info "close()"
    def cm = (OCcommand ?:"0") as int
    log.debug "cm=${cm}"
    def val = Math.abs(2 - cm)
    sendTuyaCommand("0104", "00", "010" + val)
}

def open() {
    log.info "open()"
    def cm = (OCcommand ?:"0") as int
    def val = Math.abs(0 - cm)
    sendTuyaCommand("0104", "00", "010" + val)
}

def pause() {
    log.info "pause()"
    sendTuyaCommand("0104", "00", "0101")
}

def setLevel(data, rate = null) {
    log.info "setLevel("+data+")"
    def currentLevel = device.currentValue("level")
    if (currentLevel == data) {
        sendEvent(name: "level", value: currentLevel, displayed: true)
        return
    }
    sendTuyaCommand("0202", "00", "04000000"+zigbee.convertToHexString(data, 2))
}

def refresh() {
    zigbee.readAttribute(CLUSTER_TUYA, 0x00, )
}

def presetPosition() {
    setLevel(preset ?: 50)
}

def installed() {
    sendEvent(name: "supportedWindowShadeCommands", value: JsonOutput.toJson(["open", "close", "pause"]), displayed: false)
}

def updated() {
    log.debug "val(${Direction}),valC(${OCcommand}),valR(${remote})"
    DirectionSet(Direction ?:"00")
}   

def DirectionSet(Dval) {
    log.info "Dset(${Dval})"
   sendHubCommand(zigbee.command(CLUSTER_TUYA, SETDATA, "00" + zigbee.convertToHexString(rand(256), 2) + "05040001" + Dval))
}

def configure() {
    log.info "configure()"
}

private sendTuyaCommand(dp, fn, data) {
    log.info "${zigbee.convertToHexString(rand(256), 2)}=${dp},${fn},${data}"
    zigbee.command(CLUSTER_TUYA, SETDATA, "00" + zigbee.convertToHexString(rand(256), 2) + dp + fn + data)
}

private rand(n) {
    return (new Random().nextInt(n))
}

Maybe that could be of some help.

dhc25 commented 2 years ago

Thanks for getting back to me. Yes - I am using iquix DH in Smartthings, and it works well. Unfortunately, still not found a way to set the limits using physical buttons, or through Smartthings. Only option is to set limits in Smart Life. Thanks

JudahBella commented 2 years ago

Ran into the same issue today not being able to set upper and lower limits, the device says "V2-RA" at the back: IMG_8935

However, devices labeled "ZM" at the back are able to set upper and lower limits at the device itself: IMG_8936

@dhc25 you mentioned that you used "Smart Life" to set the upper and lower limits. Do you have to use a Tuya ZigBee gateway with it? I am using a CC2652P2 Zigbee Coordinator from @tube0013.

JudahBella commented 2 years ago

I'm using Zigbee2MQTT, so https://github.com/Koenkk/zigbee2mqtt/issues/12300 helped.