Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tuya Curtain Motor #744

Closed
tube0013 opened this issue Jan 23, 2021 · 272 comments
Closed

Tuya Curtain Motor #744

tube0013 opened this issue Jan 23, 2021 · 272 comments
Labels
stale Issue is inactivate and might get closed soon Tuya Request/PR regarding a Tuya device

Comments

@tube0013
Copy link
Contributor

tube0013 commented Jan 23, 2021

Is your feature request related to a problem? Please describe.

Request and placehoder for information about the Tuya Curtain motor > specfically:

https://zigbee.blakadder.com/Moes_AM43-0_45_40-ES-EB.html

z2m device: https://github.com/Koenkk/zigbee-herdsman-converters/blob/9e4c36cd79e15449830f5e09540157c0e8d686a1/devices.js#L1481

z2m fromZigbee: https://github.com/Koenkk/zigbee-herdsman-converters/blob/9e4c36cd79e15449830f5e09540157c0e8d686a1/converters/fromZigbee.js#L1490

z2m toZigbee: https://github.com/Koenkk/zigbee-herdsman-converters/blob/9e4c36cd79e15449830f5e09540157c0e8d686a1/converters/toZigbee.js#L3377

Describe the solution you'd like

ZHA support :)

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.

{
  "node_descriptor": "NodeDescriptor(byte1=2, byte2=64, mac_capability_flags=128, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=0)",
  "endpoints": {
    "1": {
      "profile_id": 260,
      "device_type": "0x0051",
      "in_clusters": [
        "0x0000",
        "0x0004",
        "0x0005",
        "0xef00"
      ],
      "out_clusters": [
        "0x000a",
        "0x0019"
      ]
    }
  },
  "manufacturer": "_TZE200_rddyvrci",
  "model": "TS0601",
  "class": "zigpy.device.Device"
}

Additional context
Add any other context or screenshots about the feature request here.

For reference since the only place I found it was in the review comments on Aliexpress. to get into pairing mode, hold the set and down button simultaneously until light blinks.

@Adminiuga
Copy link
Contributor

Tuya has become just one huge PITA. Why they couldn't at least differentiate by device type?
This kills the idea of using "wildcard" manufacturers quirk, because two different devices have exactly the same signature.

@dmulcahey
Copy link
Collaborator

As long as a direct match always wins I wouldn’t say this kills it...

@Adminiuga
Copy link
Contributor

That's true. Just means that we need to pick for which devices to use a wildcard match and for which ones to use model+manufacturer specific matches. I just hate they are that lazy to change at least the device id

@tube0013
Copy link
Contributor Author

all these modules come from tuya with the same TS0601 model to the manufacturing shops.

the manufactures hit up the tuya sdk site flip a couple things or follow steps from tuya to configure the module for the type of device, output a fw, and push it to the devices. they also add their code for the manufacturer possibly based on the PID or derived from it - you see this mentioned in the tuya docs and what the factory I communicated with kept mentioning.

@SHxKM
Copy link

SHxKM commented Jan 31, 2021

I just moved to ZHA from Deconz + Phoscon and I if I'm not mistaken implementing this one will solve the integration for every QS-Zigbee-C01 curtain module? This one needs calibration upon first use, and as mentioned in this Home Assistant Community thread, this attribute isn't exposed at all currently through the clusters.

I'm just getting my feet wet with ZHA quirks and while I've been with Python for a while now, adding functionality etc...seems less intimidating in Zigbee2MQTT than in ZHA quirks. I guess it's just a matter of getting more familiar with Zigbee itself. Any pointers on where I would start to expose the relevant cluster attributes would be super appreciated.

@hertznsk
Copy link

hertznsk commented Feb 7, 2021

I have a curtain Zemismart ZM79E-DT (Tuya).
Signature:

{
  "node_descriptor": "NodeDescriptor(byte1=1, byte2=64, mac_capability_flags=142, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=0)",
  "endpoints": {
    "1": {
      "profile_id": 260,
      "device_type": "0x0051",
      "in_clusters": [
        "0x0000",
        "0x0004",
        "0x0005",
        "0x000a",
        "0xef00"
      ],
      "out_clusters": [
        "0x0019"
      ]
    }
  },
  "manufacturer": "_TZE200_cowvfni3",
  "model": "TS0601",
  "class": "zigpy.device.Device"
}

Protocol description: Koenkk/zigbee-herdsman-converters#1159 (comment)

@rednus
Copy link
Contributor

rednus commented Feb 19, 2021

I have Moeshouse one from here:
https://zigbee.blakadder.com/Moes_AM43-0_45_40-ES-EB.html

Paired to ZHA but doesn't show any entities or services..

Below signature:
{
"node_descriptor": "NodeDescriptor(byte1=2, byte2=64, mac_capability_flags=128, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=0)",
"endpoints": {
"1": {
"profile_id": 260,
"device_type": "0x0051",
"in_clusters": [
"0x0000",
"0x0004",
"0x0005",
"0xef00"
],
"out_clusters": [
"0x000a",
"0x0019"
]
}
},
"manufacturer": "_TZE200_zah67ekd",
"model": "TS0601",
"class": "zigpy.device.Device"
}

@alekslyse
Copy link

Zemismart here https://zigbee.blakadder.com/Zemismart_M515EGB.html

{
"node_descriptor": "NodeDescriptor(byte1=1, byte2=64, mac_capability_flags=142, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=0)",
"endpoints": {
"1": {
"profile_id": 260,
"device_type": "0x0051",
"in_clusters": [
"0x0000",
"0x0004",
"0x0005",
"0xef00"
],
"out_clusters": [
"0x000a",
"0x0019"
]
}
},
"manufacturer": "_TZE200_xuzcvlku",
"model": "TS0601",
"class": "zigpy.device.Device"
}

@alekslyse
Copy link

It seems like if someone make a quirk for one we can just copy them. They seem like the same product, just different manufacturer

@rdhlb
Copy link

rdhlb commented Feb 23, 2021

I've also got roller blinds motor AM43-0.45/40-ES-EB.

Recognized by ZHA as _TZE200_zah67ekd TS0601.

Signature:

{
  "node_descriptor": "NodeDescriptor(byte1=2, byte2=64, mac_capability_flags=128, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=0)",
  "endpoints": {
    "1": {
      "profile_id": 260,
      "device_type": "0x0051",
      "in_clusters": [
        "0x0000",
        "0x0004",
        "0x0005",
        "0xef00"
      ],
      "out_clusters": [
        "0x000a",
        "0x0019"
      ]
    }
  },
  "manufacturer": "_TZE200_zah67ekd",
  "model": "TS0601",
  "class": "zigpy.device.Device"
}

I've got some Python experience, but I'm new to the ecosystem. Will be ready to help if someone guides me from where to start.

@rednus
Copy link
Contributor

rednus commented Feb 28, 2021

I am not an expert but managed to do some copy+paste magic and at least make the first step towards working quirk..

So ZHA recognises my quirk and assigns Up/Down/Stop buttons.. but commands are not in right order clicking Up works, but Stop and Down seems to be swapped..

image

Any advice highly appreciated.. below my code..

Add below code to the end of /usr/local/lib/python3.8/site-packages/zhaquirks/tuya/init.py

########################################################################################

from zigpy.zcl.clusters.closures import WindowCovering

class TuyaOpenClose(CustomCluster, WindowCovering):
    """Tuya Open/Close cluster for Blind Controller device."""

    def __init__(self, *args, **kwargs):
        """Init."""
        super().__init__(*args, **kwargs)
        self.endpoint.device.blind_bus.add_listener(self)

    def switch_event(self, channel, state):
        """Switch event."""
        _LOGGER.info(
            "%s - -----------------Received blind event message, channel: %d, state: %d",
            self.endpoint.device.ieee,
            channel,
            state,
        )
        self._update_attribute(ATTR_ON_OFF, state)

    def command(
        self,
        command_id: Union[foundation.Command, int, t.uint8_t],
        *args,
        manufacturer: Optional[Union[int, t.uint16_t]] = None,
        expect_reply: bool = True,
        tsn: Optional[Union[int, t.uint8_t]] = None,
    ):
        """Override the default Cluster command."""

        if command_id in (0x0000, 0x0001, 0x0002):
            cmd_payload = TuyaManufCluster.Command()
            cmd_payload.status = 0
            cmd_payload.tsn = 0
            cmd_payload.command_id = TUYA_CMD_BASE + self.endpoint.endpoint_id
            cmd_payload.function = 0
            cmd_payload.data = [1, command_id]

            return self.endpoint.tuya_manufacturer.command(
                TUYA_SET_DATA, cmd_payload, expect_reply=True
            )

        return foundation.Status.UNSUP_CLUSTER_COMMAND


class TuyaManufacturerClusterOpenClose(TuyaManufCluster):
    """Manufacturer Specific Cluster of Open/Close device."""

    def handle_cluster_request(
        self,
        hdr: foundation.ZCLHeader,
        args: Tuple[TuyaManufCluster.Command],
        *,
        dst_addressing: Optional[
            Union[t.Addressing.Group, t.Addressing.IEEE, t.Addressing.NWK]
        ] = None,
    ) -> None:
        """Handle cluster request."""

        tuya_payload = args[0]
        if hdr.command_id in (0x0002, 0x0001, 0x0000):
            self.endpoint.device.blind_bus.listener_event(
                SWITCH_EVENT,
                tuya_payload.command_id - TUYA_CMD_BASE,
                tuya_payload.data[1],
            )

class TuyaBlinds(CustomDevice):
    """Generic Tuya thermostat device."""

    def __init__(self, *args, **kwargs):
        """Init device."""
        self.blind_bus = Bus()
        self.ui_bus = Bus()
        self.battery_bus = Bus()
        super().__init__(*args, **kwargs)

Then create a new file called /usr/local/lib/python3.8/site-packages/zhaquirks/tuya/blinds.py with code below:

"""Tuya based blind controller."""
from zigpy.profiles import zha
from zigpy.zcl.clusters.general import Basic, Groups, Ota, Scenes, Time

from ..const import (
    DEVICE_TYPE,
    ENDPOINTS,
    INPUT_CLUSTERS,
    MODELS_INFO,
    OUTPUT_CLUSTERS,
    PROFILE_ID,
)
from ..tuya import TuyaManufacturerClusterOnOff, TuyaManufCluster, TuyaOnOff, TuyaSwitch, TuyaBlinds, TuyaManufacturerClusterOpenClose, TuyaOpenClose

class MoesBlindController(TuyaBlinds):
    """Tuya blind controller device."""

    signature = {
		#"node_descriptor": "NodeDescriptor(byte1=2, byte2=64, mac_capability_flags=128, manufacturer_code=4098, 
		#                    maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, 
		#                    maximum_outgoing_transfer_size=82, descriptor_capability_field=0)",
		# "endpoints": {
		# "1": {
		# "profile_id": 260,
		# "device_type": "0x0051",
		# "in_clusters": [
		#	"0x0000",
        #	"0x0004",
        #	"0x0005",
        #	"0xef00"
		# ],
		# "out_clusters": [
        # 	"0x000a",
        #	"0x0019"
		# ]
		# }
		# },
		# "manufacturer": "_TZE200_zah67ekd",
		# "model": "TS0601",
		# "class": "zigpy.device.Device"
		# }
        MODELS_INFO: [("_TZE200_zah67ekd", "TS0601")],
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaManufCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            }
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_DEVICE,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaManufacturerClusterOpenClose,
                    TuyaOpenClose,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            }
        }
    }

@blauret
Copy link
Contributor

blauret commented Mar 3, 2021

I made a quirks which is working with my Zemismart ZM25TQ. It's here.

If you look at the implementation in mqtt2zigbee there are quite few differences but it should be possible to support all the various devices listed here

@tube0013
Copy link
Contributor Author

tube0013 commented Mar 4, 2021

I made a quirks which is working with my Zemismart ZM25TQ. It's here.

If you look at the implementation in mqtt2zigbee there are quite few differences but it should be possible to support all the various devices listed here

Thank you!

I gave this a shot with my MOES based one after adjusting the signature to match it, it functions however the buttons are not triggering correctly.

Down: motor turns counter clockwise
Stop: motor turns clockwise
Up: motor stops

I saw the mapping in init.py for the command but not picking up on how it's done. if you point me in the right direction I can hopefully add support for the moes as well.

@blauret
Copy link
Contributor

blauret commented Mar 4, 2021

The quirks receives from HA:

    0x0000: ("up_open", (), False),
    0x0001: ("down_close", (), False),
    0x0002: ("stop", (), False),

The motor I tested wants:

  • up: 0
  • stop : 1
  • down : 2

To control properly I map:

1 -> 2
2 -> 1

In your case I guess the right mapping should be

TUYA_COVER_COMMAND = {0x0000: 0x0001, 0x0001: 0x0002, 0x0002: 0x0000}

@alekslyse
Copy link

I made a quirks which is working with my Zemismart ZM25TQ. It's here.

If you look at the implementation in mqtt2zigbee there are quite few differences but it should be possible to support all the various devices listed here

Could you add my model "manufacturer": "_TZE200_xuzcvlku","model": "TS0601" to your PR - From what I can see they are identical, and you can add several models to your quirk (same vendor)

@ScottEgan
Copy link

Excuse my ignorance, as I am no expert, but how do we make these changes work for everyone?

Based on the observations from @tube0013 it seems as though each device might have slightly different control mapping. Reviewing the changes, it looks like the mapping is included in the __init__.py file. Would we have to add a new line like this for every different device?

TUYA_COVER_COMMAND = {0x0000: 0x0000, 0x0001: 0x0002, 0x0002: 0x0001}
TUYA_COVER_COMMAND_2 = {0x0000: 0x0001, 0x0001: 0x0002, 0x0002: 0x0000}

And then somehow reference that line in the manufacturer specific quirk file TS0601.py?
Or do we create another class in the __init__.py file and then reference that in the manufacturer specific file?

Again, sorry if this sounds dumb I'm just trying to wrap my head around this.

@blauret
Copy link
Contributor

blauret commented Mar 4, 2021

Again, sorry if this sounds dumb I'm just trying to wrap my head around this.

I don't claim to have known what I was doing when I wrote this code ;)

It's the first Tuya cover quirks. looking at zigbee2mqtt there are lots of variation. I did not think about how the code would scale for other devices.

blauret added a commit to blauret/zha-device-handlers that referenced this issue Mar 4, 2021
@blauret
Copy link
Contributor

blauret commented Mar 4, 2021

Could you add my model "manufacturer": "_TZE200_xuzcvlku","model": "TS0601" to your PR - From what I can see they are identical, and you can add several models to your quirk (same vendor)

Done

@ScottEgan
Copy link

I don't claim to have known what I was doing when I wrote this code ;)

You got farther than I did! Thank you for getting us this far!

Maybe someone with some more experience can chime in on what the typical procedure is for handling multiple devices with small differences?

@rednus
Copy link
Contributor

rednus commented Mar 4, 2021

@blauret could you please add the below code to ts0601.py The In and out clusters are different on Moes.

PS: I have tested it and it works..

class TuyaMoesCover0601(TuyaWindowCover):
    """Tuya blind controller device."""

    signature = {
        #"node_descriptor": "NodeDescriptor(byte1=2, byte2=64, mac_capability_flags=128, manufacturer_code=4098, 
        #                    maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, 
        #                    maximum_outgoing_transfer_size=82, descriptor_capability_field=0)",
        # "endpoints": {
        # "1": { "profile_id": 260, "device_type": "0x0051", "in_clusters": [ "0x0000", "0x0004","0x0005","0xef00"], "out_clusters": ["0x000a","0x0019"] }
        # },
        # "manufacturer": "_TZE200_zah67ekd",
        # "model": "TS0601",
        # "class": "zigpy.device.Device"
        # }
        MODELS_INFO: [("_TZE200_zah67ekd", "TS0601")],
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaManufCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            }
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_DEVICE,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaManufacturerWindowCover,
                    TuyaWindowCoverControl,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            }
        }
    }

@daniel-sanche
Copy link

Thanks @rednus, I have the same model and confirm that this works for me too. (Even the buttons are correct!)

blauret added a commit to blauret/zha-device-handlers that referenced this issue Mar 5, 2021
@blauret
Copy link
Contributor

blauret commented Mar 5, 2021

Thanks @rednus, I have the same model and confirm that this works for me too. (Even the buttons are correct!)

Added

@rednus
Copy link
Contributor

rednus commented Mar 5, 2021

Thank you @blauret

@hertznsk
Copy link

hertznsk commented Mar 7, 2021

I used a quirk #801 for my Zemismart ZM79E-DT, adding "_TZE200_cowvfni3", but the correct operation of the buttons is provided with the following line:
TUYA_COVER_COMMAND = {0x0000: 0x0002, 0x0001: 0x0000, 0x0002: 0x0001}

@rednus
Copy link
Contributor

rednus commented Mar 7, 2021

@blauret - is your device working with "SET COVER POSITION"???

For me full open and full close working.. but using slider to open to a set position does not.

I am getting below error:

  File "/usr/src/homeassistant/homeassistant/components/zha/core/channels/base.py", line 49, in wrapper,
    result = await command(*args, **kwds),
    res = await self._cover_channel.go_to_lift_percentage(100 - new_pos),
  File "/usr/src/homeassistant/homeassistant/components/zha/cover.py", line 138, in async_set_cover_position,
TypeError: object Status can't be used in 'await' expression,
    await result,
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 679, in _handle_entity_call,
    await coro,
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 681, in async_request_call,
    future.result()  # pop exception if have,
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 642, in entity_service_call,
    await self.hass.helpers.service.entity_service_call(,
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service,
    await handler.job.target(service_call),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1523, in _execute_service,
    task.result(),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1488, in async_call,
    await hass.services.async_call(,
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 137, in handle_call_service,
Traceback (most recent call last):,
2021-03-07 23:42:54 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140254504932400] object Status can't be used in 'await' expression

@blauret
Copy link
Contributor

blauret commented Mar 8, 2021

It won't work. the mapping ("TUYA_COVER_COMMAND") is used for all command ids. Command id 2 should get, I believe a 4 bytes data with the percentage in the lowest byte.

the code should look something like that:

@@ -608,12 +608,13 @@ class TuyaWindowCoverControl(LocalDataCluster, WindowCovering):
     ):
         """Override the default Cluster command."""
 
-        if command_id in (0x0000, 0x0001, 0x0002):
-            cmd_payload = TuyaManufCluster.Command()
-            cmd_payload.status = 0
-            cmd_payload.tsn = 0
-            cmd_payload.command_id = TUYA_CMD_BASE + self.endpoint.endpoint_id
-            cmd_payload.function = 0
+        cmd_payload = TuyaManufCluster.Command()
+        cmd_payload.status = 0
+        cmd_payload.tsn = 0
+        cmd_payload.command_id = TUYA_CMD_BASE + self.endpoint.endpoint_id
+        cmd_payload.function = 0
+
+        if command_id == 0x0001:
             cmd_payload.data = [
                 1,
                 TUYA_COVER_COMMAND[command_id],
@@ -622,6 +623,16 @@ class TuyaWindowCoverControl(LocalDataCluster, WindowCovering):
             return self.endpoint.tuya_manufacturer.command(
                 TUYA_SET_DATA, cmd_payload, expect_reply=True
             )
+        elif command_id == 0x0002:
+            cmd_payload.data = [
+                4,
+                100 - position,
+            ]  # remap the command to the Tuya command
+
+            return self.endpoint.tuya_manufacturer.command(
+                TUYA_SET_DATA, cmd_payload, expect_reply=True
+            )
+            
 
         return foundation.Status.UNSUP_CLUSTER_COMMAND

To be honnest, I never used that so I'm not really looking at implementing. Also, I cannot test it at the moment. If you confirm you have something working and I can test, I'll add it to the PR

@jochim-vd
Copy link
Contributor

jochim-vd commented Jan 11, 2022

@quadrupole1988 @Jrjy3 I have the same motor you have and opened a PR #1278 to add support for it. However, I also haven't got it to calibrate yet (top and bottom position). Did you manage to get it working using the remote?

@rob1981forest
Copy link

rob1981forest commented Jan 11, 2022 via email

@Kiread-work
Copy link

Kiread-work commented Jan 12, 2022

Your device have Green Power Proxy end point and need one new device class. I have making one and also one new INIT for adding the key combinations TS0601_Covertest.zip .

Got error in custom quirks >

Source: custom_zha_quirks/TS0601_Covertest.py:296
.....
  File "/config/custom_zha_quirks/TS0601_Covertest.py", line 296, in TuyaCover0601_TO_GPP
    OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
NameError: name 'GreenPowerProxy' is not defined

Solved this by adding GreenPowerProxy to import section

My model is _TZE200_r0jdjrvi

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

I have HAOS in VM, there is no /usr/local/lib/python...

SOLVED

Open terminal on VM
type "login"
docker exec -u 0 -it homeassistant bash
cp /usr/local/lib/python3.9/site-packages/zhaquirks/tuya/__init__.py /config/custom_zha_quirks/
ln -s /config/custom_zha_quirks/__init__.py /usr/local/lib/python3.9/site-packages/zhaquirks/tuya/__init__.py -f
now we can edit file in /config/custom_zha_quirks/__init__.py
Restart HA.

Now buttons can be pressed without errors. But the motor won't work
Can't find any logs, so I give up :(
Buttons pressed, but nothing happens

@quadrupole1988
Copy link

quadrupole1988 commented Jan 13, 2022

@quadrupole1988 @Jrjy3 I have the same motor you have and opened a PR #1278 to add support for it. However, I also haven't got it to calibrate yet (top and bottom position). Did you manage to get it working using the remote?

Hi,

Yes, my motors work. I bought the remote from zemismart, but I mainly use it with homeassistant. I did have to use the remote to set the top and bottom positions (calibration)

I'm using zigbee2mqtt. I can get it to open fully, stop or close fully. I cannot get the slider thing to work and open it a certain percentage.

let me know if you need any help.

@jochim-vd
Copy link
Contributor

@quadrupole1988 thanks for the info! I guess I will have to buy a remote too then.

Do you get the battery % in Home Assistant from the motor using zigbee2mqtt?

@Kiread-work
Copy link

Kiread-work commented Jan 22, 2022

Still trying...
Found documentation https://developer.tuya.com/en/docs/iot-device-dev/zigbee-curtain-switch-access-standard?id=K9ik6zvra3twv

I can see a curtains motor status in HA (inverted, but nvm at this moment), but still unable to control it

Found debug log

2022-01-22 18:18:14 WARNING (MainThread) [zhaquirks.tuya] a4:c1:38:da:19:c6:c7:1b Sending Tuya Command. Paylod values [endpoint_id : 1, Status : 0, TSN: 0, Command: 0x0401, Function: 0, Data: [1, 1]]
2022-01-22 18:18:14 DEBUG (MainThread) [bellows.ezsp.protocol] Send command sendUnicast: (<EmberOutgoingMessageType.OUTGOING_DIRECT: 0>, 0x7218, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY|APS_OPTION_RETRY: 320>, groupId=0, sequence=25), 26, b'\x05A\x11\x19\x00\x00\x00\x01\x04\x00\x01\x01')
2022-01-22 18:18:14 DEBUG (bellows.thread_0) [bellows.uart] Sending: b'00a521a9602a15aa2b904b25455493099d4e27b2f7c262caecdf6389fc7f3ba7eacc98297e'
2022-01-22 18:18:15 DEBUG (Recorder) [homeassistant.components.recorder] Sending keepalive
2022-01-22 18:18:15 DEBUG (bellows.thread_0) [bellows.uart] Data frame: b'01a5a1a9602a150ee9487e'
2022-01-22 18:18:15 DEBUG (bellows.thread_0) [bellows.uart] Sending: b'8160597e'
2022-01-22 18:18:15 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame 52 (sendUnicast) received: b'00bc'
2022-01-22 18:18:15 DEBUG (bellows.thread_0) [bellows.uart] Data frame: b'11a5b1a96b2a15aa2b904b25455493099d4e2717f7ce67e6e97e'
2022-01-22 18:18:15 DEBUG (bellows.thread_0) [bellows.uart] Sending: b'82503a7e'
2022-01-22 18:18:15 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame 63 (messageSentHandler) received: b'001872040100ef010140010000bc1a0000'
2022-01-22 18:18:15 DEBUG (MainThread) [bellows.zigbee.application] Received messageSentHandler frame with [<EmberOutgoingMessageType.OUTGOING_DIRECT: 0>, 29208, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY|APS_OPTION_RETRY: 320>, groupId=0, sequence=188), 26, <EmberStatus.SUCCESS: 0>, b'']
2022-01-22 18:18:15 DEBUG (bellows.thread_0) [bellows.uart] Data frame: b'21a5b1a9112a15b65894a524ab5593499c7eb76bf5bc9874f8de7a82fcfd81627e'
2022-01-22 18:18:15 DEBUG (bellows.thread_0) [bellows.uart] Sending: b'83401b7e'
2022-01-22 18:18:15 DEBUG (MainThread) [bellows.ezsp.protocol] Application frame 69 (incomingMessageHandler) received: b'00040100ef0101000100003090c01872ffff0518190b0083'
2022-01-22 18:18:15 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=48), 144, -64, 0x7218, 255, 255, b'\x18\x19\x0b\x00\x83']
2022-01-22 18:18:15 DEBUG (MainThread) [zigpy.zcl] [0x7218:1:0xef00] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=25 command_id=Command.Default_Response>
2022-01-22 18:18:15 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0x7218](TS0601): Issued cluster command: cluster_id: 258 command: 1 command_type: server args: () cluster_id: in manufacturer: None endpoint_id: 1
2022-01-22 18:18:15 DEBUG (MainThread) [homeassistant.components.zha.api] Issued command for: cluster_id: [258] cluster_type: [in] endpoint_id: [1] command: [1] command_type: [server] args: [] manufacturer: [None] response: [0, <Status.UNSUP_MANUF_CLUSTER_COMMAND: 131>]
2022-01-22 18:18:15 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [140481010299952] Sending {"id": 52, "type": "result", "success": true, "result": {"context": {"id": "f230d930af6d3a61ccb43a1af617b304", "parent_id": null, "user_id": "1c3403c8af1e4809ae20db836138b927"}}}
2022-01-22 18:18:15 DEBUG (Recorder) [homeassistant.components.recorder.pool.RecorderPool] Connection <sqlite3.Connection object at 0x7fc452f1e8a0> being returned to pool
2022-01-22 18:18:15 DEBUG (Recorder) [homeassistant.components.recorder.pool.RecorderPool] Connection <sqlite3.Connection object at 0x7fc452f1e8a0> rollback-on-return

Status.UNSUP_MANUF_CLUSTER_COMMAND sounds not good

It was added to Zigbee2Mqtt here Koenkk/zigbee2mqtt#9895

@Igorockkk
Copy link

Hi, guys, I'm new here. Have also no "Controls" after adding TS0601 by _TZE200_r0jdjrvi
Have HA running as Container and ConBee II Stick with ZHA.
Is this problem already solved for this device TS0601?
Could you please tell me, what I should do in this case.... Thanx...

@Kiread-work
Copy link

@Igorockkk
Your device same as mine - _TZE200_r0jdjrvi
There is no solution at this moment

@Igorockkk
Copy link

@Kiread-work thanks for the answer!
Very pity. Is there any hope, that it will be solved in the nearest future?

@Kiread-work
Copy link

@Igorockkk I don't know
With my instruction above you can connect the device to the Home Assistant and check the status of the curtains.
This is not so useful, but more than nothing.

@quadrupole1988
Copy link

@quadrupole1988 thanks for the info! I guess I will have to buy a remote too then.

Do you get the battery % in Home Assistant from the motor using zigbee2mqtt?

@jochim-vd

No I don't.

I've attached what I see in zigbee2mqtt. Unfortunately I also get these red box errors but it does what I need it to do.

Screenshot_20220127-235613_Home Assistant
Screenshot_20220127-235558_Home Assistant
Screenshot_20220127-235641_Home Assistant

@shohart
Copy link

shohart commented Feb 12, 2022

Any progress on these motors? I happened to get one of those....

@Kiread-work
Copy link

@shohart nope. We need some kind of programmer here =)

@Tovrin
Copy link

Tovrin commented Feb 13, 2022

I have no idea why, but one of the most recent patches to HS broke this. It's just stopped working and nothing I do fixes it. Looks like I may be scrapping this thing and getting a SOMA or something that doesn't give me grief.

@helgek
Copy link

helgek commented Mar 31, 2022

Just received mine today and now realized it’s not supported (yet)…

@christovic
Copy link

Hope this helps someone, I just spent about 2 hours figuring it out. You can change the speed of the motor by going to developer tools > services, choosing Zigbee Home Automation: Issue zigbee cluster command and use YAML mode to enter this

service: zha.issue_zigbee_cluster_command
data:
  ieee: IEEE of your device, find it in the integration page
  endpoint_id: 1
  command_type: server
  cluster_id: 258
  command: 0x0006
  args:
      - 0
      - 0
      - 0x69
      - 0
      - [4, 0, 0, 0, {integer between 0 - 100}]

@Kiread-work
Copy link

@christovic maybe you can help us with a custom quirk in the #1294

@smarthomemakers
Copy link

Added request for Tuya Tubular Roller Blind

manufacturer": "_TZE200_uzinxci0

(#1528 (comment))

Would it be possible to add this to?? Thanks YOU!!!

@christovic
Copy link

christovic commented Apr 25, 2022

I wish! Not sure how these things are added to devices as attributes - would it have to be another entity? What kind of entity would we be looking at? Happy to give it a crack but if you could point me in the right direction I might have a bit more luck. Currently I'm just using a couple of templates to automate changing the speed and a helper to have some GUI control.

Edit:

Just looked at the definition for a cover in Home Assistant Core. There's no attribute for speed so it would have to be implemented there first: https://github.com/home-assistant/core/tree/dev/homeassistant/components/cover

@rossco555
Copy link

rossco555 commented Aug 4, 2022

@quadrupole1988 @Jrjy3 I have the same motor you have and opened a PR #1278 to add support for it. However, I also haven't got it to calibrate yet (top and bottom position). Did you manage to get it working using the remote?

Hi,

Yes, my motors work. I bought the remote from zemismart, but I mainly use it with homeassistant. I did have to use the remote to set the top and bottom positions (calibration)

I'm using zigbee2mqtt. I can get it to open fully, stop or close fully. I cannot get the slider thing to work and open it a certain percentage.

let me know if you need any help.

Could you please point me to any reference for setting limits with the RF remote? (I have one, but not the requisite bridge and the supplier cannot provide seemingly.)

@TheJulianJES TheJulianJES added the Tuya Request/PR regarding a Tuya device label Jan 4, 2023
@JIBYC
Copy link

JIBYC commented Apr 24, 2023

Hi,

I've got an issue with an AM43 Tuya Motor Curtain with ZHA.

I pair the device successfully and use it, but then after a few hours it's declared unavailable.

Reinitialising ZHA fixes it for a few hours then the behaviour repeats itself.

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Issue is inactivate and might get closed soon label Oct 21, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 28, 2023
@david-romero
Copy link

Hi! I have a pair of tuya curtain motors and I'd like to integrate via zha. I was able to integrate with a quirk but I'm not able to calibrate or use the light sensor.
Captura de pantalla 2024-01-23 a las 15 23 41

Captura de pantalla 2024-01-23 a las 15 24 30

@gsdovali
Copy link

gsdovali commented Mar 7, 2024

Hope this helps someone, I just spent about 2 hours figuring it out. You can change the speed of the motor by going to developer tools > services, choosing Zigbee Home Automation: Issue zigbee cluster command and use YAML mode to enter this

service: zha.issue_zigbee_cluster_command
data:
  ieee: IEEE of your device, find it in the integration page
  endpoint_id: 1
  command_type: server
  cluster_id: 258
  command: 0x0006
  args:
      - 0
      - 0
      - 0x69
      - 0
      - [4, 0, 0, 0, {integer between 0 - 100}]

I can't set the speed on HA 2024.3.0. paste your code on yaml, changed {integer between 0 - 100} to 30 and got an error. I removed the {} -[4, 0, 0, 0, 30] is this correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issue is inactivate and might get closed soon Tuya Request/PR regarding a Tuya device
Projects
None yet
Development

No branches or pull requests