-
Notifications
You must be signed in to change notification settings - Fork 749
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
Moes 3 Gang Light Dimmer Switch ZS-USD3-WH-MS (Tuya "_TZE200_vm1gyrso", "TS0601") #1461
Comments
Another Tuya dimmer device. This one with a 3 gang type device
Probably also:
Please, enable debug logging and attach the logs from interact with the physical switch: Logs from three buttons are needed to get the necessary data. |
Log information as requestedButton-1 Press (ON)
BUtton-1 Press (OFF)
BUtton-2 Press (ON)
BUtton-2 Press (OFF)
BUtton-3 Press (ON)
BUtton-3 Press (OFF)
Button 3 - (Dim (100%->0%)
Button 3 - (Dim(0%->100%)
|
A lot of info (thanks for that) but not exactly the one I expected. That's what we are going to do, you need to enable the
Copy the And add this class at the bottom of your local file: class TuyaTripleSwitchDimmerGPP(TuyaDimmerSwitch):
"""Tuya double channel dimmer device."""
signature = {
# "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=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752,
# maximum_outgoing_transfer_size=66, 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)",
# "endpoints": {
# "1": {"profile_id": 260, "device_type": "0x0051", "in_clusters": ["0x0000","0x0004","0x0005","0xef00"],"out_clusters": ["0x000a","0x0019"]},
# "242": {"profile_id": 41440,"device_type": "0x0061","in_clusters": [],"out_clusters": ["0x0021"]}
# },
# "manufacturer": "_TZE200_vm1gyrso",
# "model": "TS0601",
# "class": "zigpy.device.Device"
MODELS_INFO: [
("_TZE200_vm1gyrso", "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],
},
242: {
PROFILE_ID: 41440,
DEVICE_TYPE: 97,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
},
},
}
replacement = {
ENDPOINTS: {
1: {
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
INPUT_CLUSTERS: [
Basic.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
TuyaLevelControlManufCluster,
TuyaOnOffMCU,
TuyaInWallLevelControl,
],
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
},
2: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
INPUT_CLUSTERS: [
TuyaOnOffMCU,
TuyaInWallLevelControl,
],
OUTPUT_CLUSTERS: [],
},
3: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
INPUT_CLUSTERS: [
TuyaOnOffMCU,
TuyaInWallLevelControl,
],
OUTPUT_CLUSTERS: [],
},
242: {
PROFILE_ID: 41440,
DEVICE_TYPE: 97,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
},
}
} You will need to import the from zigpy.zcl.clusters.general import Basic, GreenPowerProxy, Groups, LevelControl, Ota, Scenes, Time Restart HA and test. If the quirk load, the device signature will change. |
I've managed to decode the messages from the third button, so we could have the quirk fully functional. But that requires extra work... (The steps in the comment above should also be done) You'll need to copy the In this file you have to modify the class TuyaLevelControlManufCluster(TuyaMCUCluster):
"""Tuya with Level Control data points."""
dp_to_attribute: Dict[int, DPToAttributeMapping] = {
1: DPToAttributeMapping(
TuyaOnOff.ep_attribute,
"on_off",
dp_type=TuyaDPType.BOOL,
),
2: DPToAttributeMapping(
TuyaLevelControl.ep_attribute,
"current_level",
dp_type=TuyaDPType.VALUE,
converter=lambda x: (x * 255) // 1000,
dp_converter=lambda x: (x * 1000) // 255,
),
3: DPToAttributeMapping(
TuyaLevelControl.ep_attribute,
"minimum_level",
dp_type=TuyaDPType.VALUE,
converter=lambda x: (x * 255) // 1000,
dp_converter=lambda x: (x * 1000) // 255,
),
4: DPToAttributeMapping(
TuyaLevelControl.ep_attribute,
"bulb_type",
dp_type=TuyaDPType.ENUM,
),
7: DPToAttributeMapping(
TuyaOnOff.ep_attribute,
"on_off",
dp_type=TuyaDPType.BOOL,
endpoint_id=2,
),
8: DPToAttributeMapping(
TuyaLevelControl.ep_attribute,
"current_level",
dp_type=TuyaDPType.VALUE,
converter=lambda x: (x * 255) // 1000,
dp_converter=lambda x: (x * 1000) // 255,
endpoint_id=2,
),
9: DPToAttributeMapping(
TuyaLevelControl.ep_attribute,
"minimum_level",
dp_type=TuyaDPType.VALUE,
converter=lambda x: (x * 255) // 1000,
dp_converter=lambda x: (x * 1000) // 255,
endpoint_id=2,
),
10: DPToAttributeMapping(
TuyaLevelControl.ep_attribute,
"bulb_type",
dp_type=TuyaDPType.ENUM,
endpoint_id=2,
),
15: DPToAttributeMapping(
TuyaOnOff.ep_attribute,
"on_off",
dp_type=TuyaDPType.BOOL,
endpoint_id=3,
),
16: DPToAttributeMapping(
TuyaLevelControl.ep_attribute,
"current_level",
dp_type=TuyaDPType.VALUE,
converter=lambda x: (x * 255) // 1000,
dp_converter=lambda x: (x * 1000) // 255,
endpoint_id=3,
),
17: DPToAttributeMapping(
TuyaLevelControl.ep_attribute,
"minimum_level",
dp_type=TuyaDPType.VALUE,
converter=lambda x: (x * 255) // 1000,
dp_converter=lambda x: (x * 1000) // 255,
endpoint_id=3,
),
18: DPToAttributeMapping(
TuyaLevelControl.ep_attribute,
"bulb_type",
dp_type=TuyaDPType.ENUM,
endpoint_id=3,
),
} Modify (a little further down) the data_point_handlers = {
1: "_dp_2_attr_update",
2: "_dp_2_attr_update",
3: "_dp_2_attr_update",
4: "_dp_2_attr_update",
7: "_dp_2_attr_update",
8: "_dp_2_attr_update",
9: "_dp_2_attr_update",
10: "_dp_2_attr_update",
15: "_dp_2_attr_update",
16: "_dp_2_attr_update",
17: "_dp_2_attr_update",
18: "_dp_2_attr_update",
} Now you can go back to your local # from zhaquirks.tuya.mcu import (
from custom_zha_quirks import (
TuyaInWallLevelControl,
TuyaLevelControlManufCluster,
TuyaOnOff as TuyaOnOffMCU,
) Delete cache (any |
Thanks for the info. I do this later today when I am back at my desk and let you know. THanks again for the quick response. |
Probably related to #1302 |
When I replace
with
My installation brakes. Up to this point it detected the Quirk on the device and loaded three switches but I did not work from HA yet. I could not turn any switch on/off from HA or when I switch any of the switches on/off on the physical device if also did not change the status in HA. I am getting the following error when I press a button on the physical light switch:
And this is the startup error when I add the last change:
|
What is the content of your |
I have the following files in my
ts0601_dimmer.py
tuya.mcu.init.py
|
Ok, rename the file |
THe name was correct. It is just the copy to Bit that changed it. I also do not have a |
P.S When I look at the device in HA it also still show the device as a "Router" and not an "EndDevice" |
Ummmm, not sure
|
That's what the
Did you expect something different? |
It is very likely that the control from HA will not work. That issue is the one addressed in #1302 Maybe you can help us to test the solution 😉 |
I have now rename the file to
|
THis is my root folder:
|
Ok, now the files are in place, but the Github version is updated from yours HA version. Let me see how fix it. Would it be possible for you to upgrade to the beta version of HA? (while I check how can I fix it) |
Ok, you can get the file previous version from here: Then implement the changes from #1461 (comment) |
I am running the Ha OS version on a PI. |
No, the If you have access to the cli it can be done as:
|
OK I made the changes and it now loads correct without errors. What is not working is that I can change the switch status in HA and then the physical switch also change. It just jump back to its original state. P.S Just to be clear. I have not upgraded to the beta version, I just updated the init file and re-apply the changes to the previous version's file. |
I have not upgraded, do you want me to try this still? |
Is the dimmer part working also?
This part is expected, but to test it you need to update the |
OK. Lets wait to tomorrow then. After tomorrows update must I change to the original init file you provided or should I keep the one I have now? |
If it's not too much trouble, it would be very useful to us. (I'll be back here in a while) |
You will need to replace with the actual one (and perform again all the modifications): |
@freemanm Edit title so it says -> "Moes 3 Gang Light Dimmer Switch ZS-USD3-WH-MS (Tuya "_TZE200_vm1gyrso", "TS0601")" The current title says "Moer Dimmer LIght Switch" which wrong spelling and lack of info will not make anyone else fins this issue. |
And just to make easier to read and scroll the thread, could you edit your #1461 (comment) to put the class definitions in collapsed sections? It would be something like:
Thanks in advanced. refs: |
I have now done the following
Current working status
Not working
Log data
|
I can't see how can be related to the quirk. |
The new version is being tested here too: If you want to try it, the changes to make are the following:
from typing import Optional, Union
from zigpy.profiles import zha
from zigpy.quirks import CustomCluster
import zigpy.types as t
from zigpy.zcl import foundation
from zigpy.zcl.clusters.general import Basic, GreenPowerProxy, Groups, LevelControl, Ota, Scenes, Time
from zhaquirks.const import (
.../...
class NoManufacturerCluster(CustomCluster):
"""Forces the NO manufacturer id in command."""
async def command(
self,
command_id: Union[foundation.GeneralCommand, 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."""
self.debug("Setting the NO manufacturer id in command: %s", command_id)
return await super().command(
command_id,
*args,
foundation.ZCLHeader.NO_MANUFACTURER_ID,
expect_reply,
tsn,
)
class TuyaInWallLevelControlNM(NoManufacturerCluster, TuyaInWallLevelControl):
"""Tuya Level cluster for inwall dimmable device with NoManufacturerID."""
pass
replacement = {
ENDPOINTS: {
1: {
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
INPUT_CLUSTERS: [
Basic.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
TuyaLevelControlManufCluster,
TuyaOnOffMCU,
TuyaInWallLevelControlNM,
],
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
},
2: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
INPUT_CLUSTERS: [
TuyaOnOffMCU,
TuyaInWallLevelControlNM,
],
OUTPUT_CLUSTERS: [],
},
3: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
INPUT_CLUSTERS: [
TuyaOnOffMCU,
TuyaInWallLevelControlNM,
],
OUTPUT_CLUSTERS: [],
},
242: {
PROFILE_ID: 41440,
DEVICE_TYPE: 97,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
},
}
} Test the dimm function from HA and report. Thanks in advanced. |
@puddly Sorry to ping you directly, but I think that this error can be related with the zigpy version bump and all the changes related to ZCLv7:
Does it rings you any bell? Probably the fault is in any Thanks in advanced. |
No worries, they probably are. What does the debug log show? Is any Tuya light class returning a list or status code directly? Any way to set a breakpoint to see what exactly |
An affected user has open an issue. We can continue from there: |
One more interesting posting for our @javicalle about MCU dimmers Z2M user have "finding" Koenkk/zigbee-herdsman#519. |
I have made the additional changes you requested with the same results.
Example: When I try and turn on or off a switch from HA I get an error. Debug information
|
It's fine, the On/Off cluster is not fixed yet. Can you attach the logs dimming the device from HA? |
@freemanm I have ajusted the code. self.debug("Setting the NO manufacturer id in command: %s", command_id)
return await super().command(
command_id,
*args,
manufacturer=zcl.foundation.ZCLHeader.NO_MANUFACTURER_ID,
expect_reply=expect_reply,
tsn=tsn,
) (also updated in original comment) |
I'm messing everything up because I have parallel conversations in several threads. Sorry for the inconvenience. |
@freemanm I think this issue can be closed, since it is continued in the other one |
No need to close now. When PR is created it can be linked to this (an others issues) just putting in the PR body: Fixes: #1461 |
Yes and another reason not to close is that sometimes can also happen that a PR is closed without being accepted and merged. |
@javicalle @Hedda Okay, sorry, my mistake. |
I got this working in zigbee2mqtt. Not perfect, but does the job. Here's a custom converter: https://gist.github.com/muxa/94e29b8896c89da910e4e4a80fc44894 (code needs a cleanup) It detects and controls state (on/off) and brightness for all 3 gangs. Known issues:
|
I like to request support for the Moer Zigbee Dimmer Light Switch. see signature detail below.
THe switch I have is a 3-gang version
It is currently pick up as a router and not an End-Device. THis is a link to the vendor website.
Signature
The text was updated successfully, but these errors were encountered: