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
705 stars 650 forks source link

[Device Support Request] Moes Zigbee + RF Smart Curtain Switch #1527

Closed mdiazgoncalves closed 2 years ago

mdiazgoncalves commented 2 years ago

https://www.moeshouse.com/collections/new-arrivals/products/zigbee-rf-smart-touch-curtain-roller-blinds-shutter-switch-tuya-smart-life-app-wireless-control-works-with-alexa-and-google-home-eu?variant=39793319411793

Is your feature request related to a problem? Please describe. Device is detected but no cover entity is exposed only basic_lqi and basic_rssi

Describe the solution you'd like Add support for Moes Zigbee + RF Smart Curtain Switch

Device signature - this can be acquired by clicking on the "Zigbee Device Signature" button in the device settings ``` { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=, *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)", "endpoints": { "1": { "profile_id": 260, "device_type": "0x0051", "in_clusters": [ "0x0000", "0x0004", "0x0005", "0xef00" ], "out_clusters": [ "0x000a", "0x0019" ] } }, "manufacturer": "_TZE200_nhyj64w2", "model": "TS0601", "class": "zigpy.device.Device" } ```
Diagnostic information - this can be acquired by clicking on the "Download Diagnostics" button in the device settings ``` { "home_assistant": { "installation_type": "Home Assistant Supervised", "version": "2022.4.6", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.9.9", "docker": true, "arch": "x86_64", "timezone": "Europe/Lisbon", "os_name": "Linux", "os_version": "5.10.0-13-amd64", "supervisor": "2022.04.0", "host_os": "Debian GNU/Linux 11 (bullseye)", "docker_version": "20.10.14", "chassis": "", "run_as_root": true }, "custom_components": { "authenticated": { "version": "21.9.0", "requirements": [] }, "webrtc": { "version": "v2.3.0", "requirements": [] }, "sonoff": { "version": "v2.4.7", "requirements": [ "pycryptodome>=3.6.6" ] }, "openweathermap_all": { "version": "0.0.1", "requirements": [ "owm2json==0.1.89" ] }, "zha_toolkit": { "version": "v0.8.4", "requirements": [] }, "watchman": { "version": "0.5.0", "requirements": [ "prettytable==3.0.0" ] }, "hacs": { "version": "1.24.5", "requirements": [ "aiogithubapi>=21.11.0" ] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/zha", "requirements": [ "bellows==0.29.0", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.72", "zigpy-deconz==0.14.0", "zigpy==0.44.2", "zigpy-xbee==0.14.0", "zigpy-zigate==0.7.4", "zigpy-znp==0.7.0" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "vid": "10C4", "pid": "EA60", "description": "*sonoff*plus*", "known_devices": [ "sonoff zigbee dongle plus" ] }, { "vid": "10C4", "pid": "EA60", "description": "*tubeszb*", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "*tubeszb*", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "*zigstar*", "known_devices": [ "ZigStar Coordinators" ] }, { "vid": "1CF1", "pid": "0030", "description": "*conbee*", "known_devices": [ "Conbee II" ] }, { "vid": "10C4", "pid": "8A2A", "description": "*zigbee*", "known_devices": [ "Nortek HUSBZB-1" ] }, { "vid": "10C4", "pid": "8B34", "description": "*bv 2010/10*", "known_devices": [ "Bitron Video AV2010/10" ] } ], "codeowners": [ "@dmulcahey", "@adminiuga" ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" } ], "after_dependencies": [ "usb", "zeroconf" ], "iot_class": "local_polling", "loggers": [ "aiosqlite", "bellows", "crccheck", "pure_pcapy3", "zhaquirks", "zigpy", "zigpy_deconz", "zigpy_xbee", "zigpy_zigate", "zigpy_znp" ], "is_built_in": true }, "data": { "ieee": "**REDACTED**", "nwk": 10900, "manufacturer": "_TZE200_nhyj64w2", "model": "TS0601", "name": "_TZE200_nhyj64w2 TS0601", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "manufacturer_code": 4098, "power_source": "Mains", "lqi": 184, "rssi": -54, "last_seen": "2022-04-24T19:46:25", "available": true, "device_type": "Router", "signature": { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=, *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)", "endpoints": { "1": { "profile_id": 260, "device_type": "0x0051", "in_clusters": [ "0x0000", "0x0004", "0x0005", "0xef00" ], "out_clusters": [ "0x000a", "0x0019" ] } } }, "entities": [], "neighbors": [ { "device_type": "Coordinator", "rx_on_when_idle": "On", "relationship": "Parent", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x0000", "permit_joining": "Unknown", "depth": "0", "lqi": "199" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x0B12", "permit_joining": "Unknown", "depth": "15", "lqi": "196" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x2A3F", "permit_joining": "Unknown", "depth": "15", "lqi": "134" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x4C76", "permit_joining": "Unknown", "depth": "15", "lqi": "65" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x5688", "permit_joining": "Unknown", "depth": "15", "lqi": "99" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x5E73", "permit_joining": "Unknown", "depth": "15", "lqi": "165" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x72B6", "permit_joining": "Unknown", "depth": "15", "lqi": "61" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x905E", "permit_joining": "Unknown", "depth": "15", "lqi": "46" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0xE21E", "permit_joining": "Unknown", "depth": "15", "lqi": "60" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0xEF19", "permit_joining": "Unknown", "depth": "15", "lqi": "124" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0xFFA1", "permit_joining": "Unknown", "depth": "15", "lqi": "142" } ], "endpoint_names": [ { "name": "SMART_PLUG" } ], "user_given_name": "estore_sala_estar", "device_reg_id": "b865462fe1e36765183e03c79e6c0067", "area_id": "8655c42078554434b66a10c1b0c6baaa" } } ```
Additional logs ``` Paste any additional debug logs here. ```

Additional context I tried using TuyaMoesCover0601 quirk but doesn't work.

javicalle commented 2 years ago

The device signature seems to match the TuyaMoesCover0601 one (just some diferences in node_descriptor). Is the device loading the quirk? (you will see at the device signature) Any error log when quirk is loaded and you interacts with the cover (via remote for example)?

mdiazgoncalves commented 2 years ago

Hi javicalle

Yes, it loads the quirk and with the new quirk it exposes a cover entity. When I interact with the cover, I get "failed to call service cover/open _TZE200_nhyj64w2"

In the logs:

2022-04-25 17:45:46 DEBUG (MainThread) [zhaquirks.tuya] 2c:11:65:ff:fe:9e:60:8b Sending Tuya Cluster Command.. Manufacturer is _TZE200_nhyj64w2 Cluster Command is 0x0000, Arguments are ()
2022-04-25 17:45:46 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140411244942384] '_TZE200_nhyj64w2'
KeyError: '_TZE200_nhyj64w2'
MattWestb commented 2 years ago

The device need being added in the INIT for working OK and also if needed as inverted. https://github.com/zigpy/zha-device-handlers/blob/ae8377749383648bc8b806de0b3e1e258b6ef85a/zhaquirks/tuya/__init__.py#L104 https://github.com/zigpy/zha-device-handlers/blob/ae8377749383648bc8b806de0b3e1e258b6ef85a/zhaquirks/tuya/__init__.py#L129

mdiazgoncalves commented 2 years ago

The buttons don't work, but the slider works. It is not calibrated, but it works.

mdiazgoncalves commented 2 years ago

The device need being added in the INIT for working OK and also if needed as inverted.

https://github.com/zigpy/zha-device-handlers/blob/ae8377749383648bc8b806de0b3e1e258b6ef85a/zhaquirks/tuya/__init__.py#L104

https://github.com/zigpy/zha-device-handlers/blob/ae8377749383648bc8b806de0b3e1e258b6ef85a/zhaquirks/tuya/__init__.py#L129

Its in the init

    "_TZE200_nhyj64w2": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001},

The slider works in the right directions but I will try as inverted.

MattWestb commented 2 years ago

The buttons cant working if not adding the device in the button map in the tuya INIT i was pointing at and also it can being needed adding it in the inverted section if its inverted.

Also if making changes in tuya INIT it must being made in the HA container if not patching the local quirk.

Also trying up/down and stop for the buttons so its right mapped or its not working OK (pressing up and its going down or somthing like that).

mdiazgoncalves commented 2 years ago

It is defenitly not inverted.

The buttons aren't working but the position slider works.

What is the meaning of the values in TUYA_COVER_COMMAND?

"_TZE200_nhyj64w2": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001},

Maybe something to do with the values?

MattWestb commented 2 years ago

From: https://github.com/zigpy/zha-device-handlers/blob/ae8377749383648bc8b806de0b3e1e258b6ef85a/zhaquirks/tuya/__init__.py#L103 Its mapping buttons to function then standard is 0 up , 1 stop and 3 down.

mdiazgoncalves commented 2 years ago

It is strange because the position slider is working but not the buttons Should I try different values for the buttons in TUYA_COVER_COMMAND?

MattWestb commented 2 years ago

Ýes

javicalle commented 2 years ago

Should I try different values for the buttons in TUYA_COVER_COMMAND?

Or you can began with the normal values ("_TZE200_nhyj64w2": {0x0000: 0x0000, 0x0001: 0x0001, 0x0002: 0x0002},) and then try to figure which buttons are switched. If open/close are switched, then the cover is inverted. If there are the open/stop, switch the 0x0000 and 0x0001 If there are the stop/close, switch the 0x0001 and 0x0002

mdiazgoncalves commented 2 years ago

It's working now. Somehow, I was not editing the correct init.py The correct command values are: ("_TZE200_nhyj64w2": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001},) Now I just have to figure how to calibrate it

Thanks guys for your support

Cas7or commented 1 month ago

It's working now. Somehow, I was not editing the correct init.py The correct command values are: ("_TZE200_nhyj64w2": {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001},) Now I just have to figure how to calibrate it

Thanks guys for your support

Hey,

Did you ever figure out how to calibrate?

mdiazgoncalves commented 1 month ago

Nope. I think the only way is to connect it to Tuya and calibrate. I don't have a Tuya ZigBee bridge.

Cas7or commented 1 month ago

Nope. I think the only way is to connect it to Tuya and calibrate. I don't have a Tuya ZigBee bridge.

Nope, did not work. I just tried it. Interestingly enough within the smart life app it works fine once calibrated. The other curious bit of information is that I have now seen two options to calibrate and sometimes one of the option is missing on some of the devices.

Option 1: set time in seconds to Open/close Option 2: detailed calibration - asks you to set the blinds to fully open, then pause, then fully close then pause and that calibrates the blinds.

For anyone working on this, I am willing to help with anything I can so do let me know if I can be of assistance.