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 651 forks source link

[Device Support Request] Moes dimmer switches _TZE200_ip2akl4w & _TZE200_fjjbhx9d #1302

Closed Daandeve closed 2 years ago

Daandeve commented 2 years ago

This is a Tuya device that has no entities and/or controls in home assistant and its a simple Zigbee Tuya dimmer. It should be very similar to many other devices like this.

1 Gang _TZE200_ip2akl4w

{
  "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_ip2akl4w",
  "model": "TS0601",
  "class": "zigpy.device.Device"
}

2 Gang _TZE200_fjjbhx9d

{
  "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_fjjbhx9d",
  "model": "TS0601",
  "class": "zigpy.device.Device"
}

Thanks in advance for the support.

javicalle commented 2 years ago

I did see this Logger: zigpy.zcl, Unknown cluster 61184 in my log could this warning be related?

I get that message sometimes during HA restart. I think it is related to some message that is received before loading the quirks or maybe when initializing the device from the entity_registry, but I don't know, just assumptions.

Your logs are saying that the device broadcast their status (or changes), but there is no cluster to handle the message (and that is why it forwards it several times: same TSN).

These are messages from 'switch 2'. On/Off events goes to dp=7. Dimm events goes to dp=8.

I must have left something half done in the example implementation, but I can't see it.

Does (for that device) 'switch 1' behave the same way?

You have also commented that you have a single-gang button (the _TZE200_ip2akl4w), does it behave just as badly?

Daandeve commented 2 years ago

I did see this Logger: zigpy.zcl, Unknown cluster 61184 in my log could this warning be related?

I get that message sometimes during HA restart. I think it is related to some message that is received before loading the quirks or maybe when initializing the device from the entity_registry, but I don't know, just assumptions.

Your logs are saying that the device broadcast their status (or changes), but there is no cluster to handle the message (and that is why it forwards it several times: same TSN).

These are messages from 'switch 2'. On/Off events goes to dp=7. Dimm events goes to dp=8.

I must have left something half done in the example implementation, but I can't see it.

Does (for that device) 'switch 1' behave the same way?

You have also commented that you have a single-gang button (the _TZE200_ip2akl4w), does it behave just as badly?

The switch 1 & 2 from the 2 gang and the 1 gang switch behave the same. Here the logs from the 1 gang switch, first I turned it on then dimmed then turned it off.

2022-01-25 00:15:02 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=128 command_id=1>
2022-01-25 00:15:02 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=7, dp=1, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>))]
2022-01-25 00:15:02 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=128 command_id=1>
2022-01-25 00:15:03 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=128 command_id=1>
2022-01-25 00:15:03 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x80 seq -- probably duplicate response
2022-01-25 00:15:03 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=128 command_id=1>
2022-01-25 00:15:03 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x80 seq -- probably duplicate response
2022-01-25 00:15:03 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=128 command_id=1>
2022-01-25 00:15:03 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x80 seq -- probably duplicate response
2022-01-25 00:15:03 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=128 command_id=1>
2022-01-25 00:15:03 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x80 seq -- probably duplicate response
2022-01-25 00:15:03 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=128 command_id=1>
2022-01-25 00:15:03 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x80 seq -- probably duplicate response
2022-01-25 00:15:04 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=128 command_id=1>
2022-01-25 00:15:04 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x80 seq -- probably duplicate response
2022-01-25 00:15:05 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=129 command_id=1>
2022-01-25 00:15:05 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=8, dp=2, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'T\x01\x00\x00', *payload=340))]
2022-01-25 00:15:05 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xF51B:1:0x0008]: received attribute: 0 update with value: 86
2022-01-25 00:15:06 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=129 command_id=1>
2022-01-25 00:15:06 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=129 command_id=1>
2022-01-25 00:15:06 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x81 seq -- probably duplicate response
2022-01-25 00:15:06 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=129 command_id=1>
2022-01-25 00:15:06 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x81 seq -- probably duplicate response
2022-01-25 00:15:06 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=129 command_id=1>
2022-01-25 00:15:06 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x81 seq -- probably duplicate response
2022-01-25 00:15:06 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=129 command_id=1>
2022-01-25 00:15:06 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x81 seq -- probably duplicate response
2022-01-25 00:15:07 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=129 command_id=1>
2022-01-25 00:15:07 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x81 seq -- probably duplicate response
2022-01-25 00:15:07 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=129 command_id=1>
2022-01-25 00:15:07 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x81 seq -- probably duplicate response
2022-01-25 00:15:07 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=130 command_id=1>
2022-01-25 00:15:07 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=9, dp=2, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b',\x01\x00\x00', *payload=300))]
2022-01-25 00:15:07 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xF51B:1:0x0008]: received attribute: 0 update with value: 76
2022-01-25 00:15:07 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=130 command_id=1>
2022-01-25 00:15:07 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=130 command_id=1>
2022-01-25 00:15:07 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x82 seq -- probably duplicate response
2022-01-25 00:15:07 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=130 command_id=1>
2022-01-25 00:15:07 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x82 seq -- probably duplicate response
2022-01-25 00:15:08 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=131 command_id=1>
2022-01-25 00:15:08 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=10, dp=2, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'\x04\x01\x00\x00', *payload=260))]
2022-01-25 00:15:08 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xF51B:1:0x0008]: received attribute: 0 update with value: 66
2022-01-25 00:15:08 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=132 command_id=1>
2022-01-25 00:15:08 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=11, dp=2, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'\xdc\x00\x00\x00', *payload=220))]
2022-01-25 00:15:08 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xF51B:1:0x0008]: received attribute: 0 update with value: 56
2022-01-25 00:15:09 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=133 command_id=1>
2022-01-25 00:15:09 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=12, dp=2, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'\xb4\x00\x00\x00', *payload=180))]
2022-01-25 00:15:09 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xF51B:1:0x0008]: received attribute: 0 update with value: 45
2022-01-25 00:15:09 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=134 command_id=1>
2022-01-25 00:15:09 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=13, dp=2, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'\x8c\x00\x00\x00', *payload=140))]
2022-01-25 00:15:09 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xF51B:1:0x0008]: received attribute: 0 update with value: 35
2022-01-25 00:15:09 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=135 command_id=1>
2022-01-25 00:15:09 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=14, dp=1, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>))]
2022-01-25 00:15:10 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=135 command_id=1>
2022-01-25 00:15:10 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=135 command_id=1>
2022-01-25 00:15:10 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x87 seq -- probably duplicate response
2022-01-25 00:15:10 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=135 command_id=1>
2022-01-25 00:15:10 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x87 seq -- probably duplicate response
2022-01-25 00:15:10 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=135 command_id=1>
2022-01-25 00:15:10 DEBUG (MainThread) [zigpy.device] [0xf51b] Invalid state on future for 0x87 seq -- probably duplicate response
javicalle commented 2 years ago

I'm sorry to continually ask questions that may seem stupid, but there must be something I've overlooked.

Could you show me the signature of the device with the quirks applied?

It's the same you do in comment

Daandeve commented 2 years ago

Don't be sorry haha, when I can't find something myself I get that too. 1 gang 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": "0x0100",
      "in_clusters": [
        "0x0000",
        "0x0004",
        "0x0005",
        "0x0006",
        "0x0008",
        "0xef00"
      ],
      "out_clusters": [
        "0x000a",
        "0x0019"
      ]
    },
    "242": {
      "profile_id": 41440,
      "device_type": "0x0061",
      "in_clusters": [],
      "out_clusters": [
        "0x0021"
      ]
    }
  },
  "manufacturer": "_TZE200_ip2akl4w",
  "model": "TS0601",
  "class": "ts0601_dimmer.TuyaSingleSwitchDimmerGP"
}

2 gang 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": "0x0100",
      "in_clusters": [
        "0x0000",
        "0x0004",
        "0x0005",
        "0x0006",
        "0x0008",
        "0xef00"
      ],
      "out_clusters": [
        "0x000a",
        "0x0019"
      ]
    },
    "2": {
      "profile_id": 260,
      "device_type": "0x0100",
      "in_clusters": [
        "0x0006",
        "0x0008"
      ],
      "out_clusters": []
    },
    "242": {
      "profile_id": 41440,
      "device_type": "0x0061",
      "in_clusters": [],
      "out_clusters": [
        "0x0021"
      ]
    }
  },
  "manufacturer": "_TZE200_fjjbhx9d",
  "model": "TS0601",
  "class": "ts0601_dimmer.TuyaDoubleSwitchDimmerGP"
}
javicalle commented 2 years ago

The last silly check for tonight, would you be so kind as to check that the new classes have exactly this definition in the replacement part, inside the enpoint 1 definition:

                    TuyaLevelControlManufCluster,
                    TuyaOnOffMCU,
                    TuyaInWallLevelControl,
Daandeve commented 2 years ago

In the ts0601_dimmer.py?

javicalle commented 2 years ago

Yes, in the ts0601_dimmer.py file inside the 2 new classes TuyaSingleSwitchDimmerGP and TuyaDoubleSwitchDimmerGP.

Daandeve commented 2 years ago

Okay, yes both the single and the double are correct

javicalle commented 2 years ago

Aaaaaaargggghhh! 💣

Nothing else comes to mind today. I'm going to leave it until tomorrow. Thanks for trying.

Daandeve commented 2 years ago

Aaaaaaargggghhh! 💣

Nothing else comes to mind today. I'm going to leave it until tomorrow. Thanks for trying.

😅 Sure, I'll try to look into it as well

Daandeve commented 2 years ago

I just noticed this in my log [0x80c1:2:0x0006] Unsupported command_id: 2

javicalle commented 2 years ago

I have checked my traces and (if I omit the additional logs that I have on my installation) they are identical to yours. Buuuuuut, in my case it is working 😅 (my device is a switch, not a dimmer)

Some of your traces indicate that the values are being updated (although the device does not react):

2022-01-25 00:15:09 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=134 command_id=1>
2022-01-25 00:15:09 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=13, dp=2, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'\x8c\x00\x00\x00', *payload=140))]
2022-01-25 00:15:09 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xF51B:1:0x0008]: received attribute: 0 update with value: 35

That is:

Can you check if cluster change his attributes values: image

From device --> admin clusters --> select cluster --> select attribute --> get zigbee attribute

Check for clusters TuyaLevelControl (att: current_level) and TuyaOnOff (att: on_off)

javicalle commented 2 years ago

I just noticed this in my log [0x80c1:2:0x0006] Unsupported command_id: 2

That must be a toggle command at On/Off cluster (0x0006) of switch2 (endpoint: 2). It's not implemented and it's normal that you get that message.

Daandeve commented 2 years ago

I have checked my traces and (if I omit the additional logs that I have on my installation) they are identical to yours. Buuuuuut, in my case it is working 😅 (my device is a switch, not a dimmer)

Some of your traces indicate that the values are being updated (although the device does not react):

2022-01-25 00:15:09 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=134 command_id=1>
2022-01-25 00:15:09 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=13, dp=2, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'\x8c\x00\x00\x00', *payload=140))]
2022-01-25 00:15:09 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xF51B:1:0x0008]: received attribute: 0 update with value: 35

That is:

  • device: 0xF51B
  • endpoint: 1 (1 for swith 1, 2 for 2)
  • cluster: 0x0008 (levelcontrol cluster for dimm events, OnOff is cluster 6)

Can you check if cluster change his attributes values: image

From device --> admin clusters --> select cluster --> select attribute --> get zigbee attribute

Check for clusters TuyaLevelControl (att: current_level) and TuyaOnOff (att: on_off)

From TuyaOnOff: When I turn the switch on the value is Bool.true, when turned off Bool.false

From TuyaInWallLevelControl: The value is an integer and it changes when I dim the light

javicalle commented 2 years ago

From TuyaInWallLevelControl: The value is an integer and it changes when I dim the light

Not important for the analisys but, can you check the min and max values?

javicalle commented 2 years ago

From TuyaOnOff: When I turn the switch on the value is Bool.true, when turned off Bool.false

From TuyaInWallLevelControl: The value is an integer and it changes when I dim the light

This is from HA o with the phisycal device?

Daandeve commented 2 years ago

From TuyaOnOff: When I turn the switch on the value is Bool.true, when turned off Bool.false From TuyaInWallLevelControl: The value is an integer and it changes when I dim the light

This is from HA o with the phisycal device?

Yes

Daandeve commented 2 years ago

From TuyaInWallLevelControl: The value is an integer and it changes when I dim the light

Not important for the analisys but, can you check the min and max values?

Min is 2, max is not present image

javicalle commented 2 years ago

Min is 2, max is not present

Sorry, my fault. I mean which are the max and min value for current_level when you dim the light to the max and min.

Daandeve commented 2 years ago

Okay, minimum is 2 and maximum is 255

javicalle commented 2 years ago

Let's recap what we have so far (correct me if something is wrong):

Would it be like this? Any other information you think is relevant?

Daandeve commented 2 years ago

The only thing is that I cannot control the lights (On/Off and dim) in HA

javicalle commented 2 years ago

Ok, I need to focus in sending the commands from HA to device.

I would need you to make some changes in the TuyaMCUCluster calls (custom_zha_quirks/tuya/mcu/__init__.py file):

Delete all the __pycache__ folders:

And restart HA.

It would be great if you could get traces as in the comment (zigpy.zcl: debug I think)

Daandeve commented 2 years ago

Same result, logs:

2022-01-25 21:30:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=25 command_id=Command.Report_Attributes>
2022-01-25 21:30:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=1, value=<TypeValue type=uint8_t, value=64>), Attribute(attrid=65506, value=<TypeValue type=uint8_t, value=32>), Attribute(attrid=65508, value=<TypeValue type=uint8_t, value=0>)]]
2022-01-25 21:30:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] Attribute report received: app_version=64, 65506=32, 65508=0
2022-01-25 21:30:37 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=25 command_id=Command.Report_Attributes>
2022-01-25 21:30:37 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=1, value=<TypeValue type=uint8_t, value=64>), Attribute(attrid=65506, value=<TypeValue type=uint8_t, value=32>), Attribute(attrid=65508, value=<TypeValue type=uint8_t, value=0>)]]
2022-01-25 21:30:37 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] Attribute report received: app_version=64, 65506=32, 65508=0
2022-01-25 21:30:37 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=25 command_id=Command.Report_Attributes>
2022-01-25 21:30:37 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=1, value=<TypeValue type=uint8_t, value=64>), Attribute(attrid=65506, value=<TypeValue type=uint8_t, value=32>), Attribute(attrid=65508, value=<TypeValue type=uint8_t, value=0>)]]
2022-01-25 21:30:37 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] Attribute report received: app_version=64, 65506=32, 65508=0
2022-01-25 21:30:37 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=25 command_id=Command.Report_Attributes>
2022-01-25 21:30:37 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=1, value=<TypeValue type=uint8_t, value=64>), Attribute(attrid=65506, value=<TypeValue type=uint8_t, value=32>), Attribute(attrid=65508, value=<TypeValue type=uint8_t, value=0>)]]
2022-01-25 21:30:37 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] Attribute report received: app_version=64, 65506=32, 65508=0
2022-01-25 21:30:37 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=25 command_id=Command.Report_Attributes>
2022-01-25 21:30:37 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=1, value=<TypeValue type=uint8_t, value=64>), Attribute(attrid=65506, value=<TypeValue type=uint8_t, value=32>), Attribute(attrid=65508, value=<TypeValue type=uint8_t, value=0>)]]
2022-01-25 21:30:37 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] Attribute report received: app_version=64, 65506=32, 65508=0
2022-01-25 21:30:38 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=25 command_id=Command.Report_Attributes>
2022-01-25 21:30:38 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=1, value=<TypeValue type=uint8_t, value=64>), Attribute(attrid=65506, value=<TypeValue type=uint8_t, value=32>), Attribute(attrid=65508, value=<TypeValue type=uint8_t, value=0>)]]
2022-01-25 21:30:38 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] Attribute report received: app_version=64, 65506=32, 65508=0
2022-01-25 21:30:38 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=25 command_id=Command.Report_Attributes>
2022-01-25 21:30:38 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=1, value=<TypeValue type=uint8_t, value=64>), Attribute(attrid=65506, value=<TypeValue type=uint8_t, value=32>), Attribute(attrid=65508, value=<TypeValue type=uint8_t, value=0>)]]
2022-01-25 21:30:38 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] Attribute report received: app_version=64, 65506=32, 65508=0
2022-01-25 21:30:38 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=25 command_id=Command.Report_Attributes>
2022-01-25 21:30:38 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=1, value=<TypeValue type=uint8_t, value=64>), Attribute(attrid=65506, value=<TypeValue type=uint8_t, value=32>), Attribute(attrid=65508, value=<TypeValue type=uint8_t, value=0>)]]
2022-01-25 21:30:38 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] Attribute report received: app_version=64, 65506=32, 65508=0
2022-01-25 21:30:38 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=25 command_id=Command.Report_Attributes>
2022-01-25 21:30:38 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=1, value=<TypeValue type=uint8_t, value=64>), Attribute(attrid=65506, value=<TypeValue type=uint8_t, value=32>), Attribute(attrid=65508, value=<TypeValue type=uint8_t, value=0>)]]
2022-01-25 21:30:38 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] Attribute report received: app_version=64, 65506=32, 65508=0
2022-01-25 21:30:39 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=26 command_id=Command.Report_Attributes>
2022-01-25 21:30:39 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=65503, value=<TypeValue type=CharacterString, value=z*�)i{*�)i+y�)i�y�)i)i���)i݂)iz�)i"
�)i�!�)i�!�)ih*�)i>)]]
2022-01-25 21:30:39 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] Attribute report received: 65503=z*�)i{*�)i+y�)i�y�)i)i���)i݂)iz�)i"
�)i�!�)i�!�)ih*�)i
2022-01-25 21:30:39 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=26 command_id=Command.Report_Attributes>
2022-01-25 21:30:39 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=65503, value=<TypeValue type=CharacterString, value=z*�)i{*�)i+y�)i�y�)i)i���)i݂)iz�)i"
�)i�!�)i�!�)ih*�)i>)]]
2022-01-25 21:30:39 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] Attribute report received: 65503=z*�)i{*�)i+y�)i�y�)i)i���)i݂)iz�)i"
�)i�!�)i�!�)ih*�)i
2022-01-25 21:30:39 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=26 command_id=Command.Report_Attributes>
2022-01-25 21:30:39 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=65503, value=<TypeValue type=CharacterString, value=z*�)i{*�)i+y�)i�y�)i)i���)i݂)iz�)i"
�)i�!�)i�!�)ih*�)i>)]]
2022-01-25 21:30:39 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] Attribute report received: 65503=z*�)i{*�)i+y�)i�y�)i)i���)i݂)iz�)i"
�)i�!�)i�!�)ih*�)i
2022-01-25 21:30:39 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=26 command_id=Command.Report_Attributes>
2022-01-25 21:30:39 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=65503, value=<TypeValue type=CharacterString, value=z*�)i{*�)i+y�)i�y�)i)i���)i݂)iz�)i"
�)i�!�)i�!�)ih*�)i>)]]
2022-01-25 21:30:39 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] Attribute report received: 65503=z*�)i{*�)i+y�)i�y�)i)i���)i݂)iz�)i"
�)i�!�)i�!�)ih*�)i
2022-01-25 21:30:39 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=26 command_id=Command.Report_Attributes>
2022-01-25 21:30:39 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=65503, value=<TypeValue type=CharacterString, value=z*�)i{*�)i+y�)i�y�)i)i���)i݂)iz�)i"
�)i�!�)i�!�)ih*�)i>)]]
2022-01-25 21:30:39 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0000] Attribute report received: 65503=z*�)i{*�)i+y�)i�y�)i)i���)i݂)iz�)i"
�)i�!�)i�!�)ih*�)i
2022-01-25 21:31:23 DEBUG (MainThread) [zigpy.zcl] [0x80c1:2:0x0006] Sending Tuya Cluster Command... Cluster Command is 1, Arguments are ()
2022-01-25 21:31:23 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] tuya_mcu_command: cluster_data=TuyaClusterData(endpoint_id=2, cluster_attr='on_off', attr_value=1)
2022-01-25 21:31:23 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] get_dp_mapping --> found DP: 7
2022-01-25 21:31:23 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] from_cluster_data: 7, DPToAttributeMapping(ep_attribute='on_off', attribute_name='on_off', dp_type=<TuyaDPType.BOOL: 1>, converter=None, dp_converter=None, endpoint_id=2)
2022-01-25 21:31:23 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] ztype: Bool.true
2022-01-25 21:31:23 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] from_value: [1, 1]
2022-01-25 21:31:23 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] raw: b'\x01'
2022-01-25 21:31:23 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] tuya_command: TuyaCommand(status=0, tsn=11, dp=7, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>))
2022-01-25 21:31:23 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x80C1:2:0x0006]: executed 'on' command with args: '()' kwargs: '{}' result: Status.SUCCESS
2022-01-25 21:31:23 DEBUG (MainThread) [homeassistant.components.zha.entity] light.bathroom_dimmer_level_on_off_2: turned on: {'on_off': <Status.SUCCESS: 0>}
2022-01-25 21:31:25 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=12 command_id=Command.Default_Response>
2022-01-25 21:31:28 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0x22A8](TS0041): Attempting to checkin with device - missed checkins: 1
2022-01-25 21:31:32 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0006] Sending Tuya Cluster Command... Cluster Command is 1, Arguments are ()
2022-01-25 21:31:32 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] tuya_mcu_command: cluster_data=TuyaClusterData(endpoint_id=1, cluster_attr='on_off', attr_value=1)
2022-01-25 21:31:32 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] get_dp_mapping --> found DP: 1
2022-01-25 21:31:32 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] from_cluster_data: 1, DPToAttributeMapping(ep_attribute='on_off', attribute_name='on_off', dp_type=<TuyaDPType.BOOL: 1>, converter=None, dp_converter=None, endpoint_id=None)
2022-01-25 21:31:32 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] ztype: Bool.true
2022-01-25 21:31:32 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] from_value: [1, 1]
2022-01-25 21:31:32 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] raw: b'\x01'
2022-01-25 21:31:32 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] tuya_command: TuyaCommand(status=0, tsn=16, dp=1, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>))
2022-01-25 21:31:32 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x80C1:1:0x0006]: executed 'on' command with args: '()' kwargs: '{}' result: Status.SUCCESS
2022-01-25 21:31:32 DEBUG (MainThread) [homeassistant.components.zha.entity] light.bathroom_dimmer_level_on_off: turned on: {'on_off': <Status.SUCCESS: 0>}
2022-01-25 21:31:33 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=17 command_id=Command.Default_Response>
2022-01-25 21:31:34 DEBUG (MainThread) [zigpy.zcl] [0x8df7: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=83 command_id=Command.Report_Attributes>
2022-01-25 21:31:34 DEBUG (MainThread) [zigpy.zcl] [0x8df7:1:0x0006] ZCL request 0x000a: [[Attribute(attrid=0, value=<TypeValue type=Bool, value=Bool.true>)]]
2022-01-25 21:31:34 DEBUG (MainThread) [zigpy.zcl] [0x8df7:1:0x0006] Attribute report received: on_off=1
2022-01-25 21:31:35 DEBUG (MainThread) [zigpy.zcl] [0x80c1:2:0x0006] Sending Tuya Cluster Command... Cluster Command is 1, Arguments are ()
2022-01-25 21:31:35 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] tuya_mcu_command: cluster_data=TuyaClusterData(endpoint_id=2, cluster_attr='on_off', attr_value=1)
2022-01-25 21:31:35 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] get_dp_mapping --> found DP: 7
2022-01-25 21:31:35 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] from_cluster_data: 7, DPToAttributeMapping(ep_attribute='on_off', attribute_name='on_off', dp_type=<TuyaDPType.BOOL: 1>, converter=None, dp_converter=None, endpoint_id=2)
2022-01-25 21:31:35 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] ztype: Bool.true
2022-01-25 21:31:35 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] from_value: [1, 1]
2022-01-25 21:31:35 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] raw: b'\x01'
2022-01-25 21:31:35 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] tuya_command: TuyaCommand(status=0, tsn=20, dp=7, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>))
2022-01-25 21:31:35 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x80C1:2:0x0006]: executed 'on' command with args: '()' kwargs: '{}' result: Status.SUCCESS
2022-01-25 21:31:35 DEBUG (MainThread) [homeassistant.components.zha.entity] light.bathroom_dimmer_level_on_off_2: turned on: {'on_off': <Status.SUCCESS: 0>}
2022-01-25 21:31:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:2:0x0006] Sending Tuya Cluster Command... Cluster Command is 0, Arguments are ()
2022-01-25 21:31:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] tuya_mcu_command: cluster_data=TuyaClusterData(endpoint_id=2, cluster_attr='on_off', attr_value=0)
2022-01-25 21:31:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] get_dp_mapping --> found DP: 7
2022-01-25 21:31:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] from_cluster_data: 7, DPToAttributeMapping(ep_attribute='on_off', attribute_name='on_off', dp_type=<TuyaDPType.BOOL: 1>, converter=None, dp_converter=None, endpoint_id=2)
2022-01-25 21:31:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] ztype: Bool.false
2022-01-25 21:31:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] from_value: [1, 0]
2022-01-25 21:31:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] raw: b'\x00'
2022-01-25 21:31:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] tuya_command: TuyaCommand(status=0, tsn=23, dp=7, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>))
2022-01-25 21:31:36 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x80C1:2:0x0006]: executed 'off' command with args: '()' kwargs: '{}' result: Status.SUCCESS
2022-01-25 21:31:36 DEBUG (MainThread) [homeassistant.components.zha.entity] light.bathroom_dimmer_level_on_off_2: turned off: Status.SUCCESS
2022-01-25 21:31:37 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=21 command_id=Command.Default_Response>
2022-01-25 21:31:37 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=24 command_id=Command.Default_Response>
2022-01-25 21:31:42 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=27 command_id=1>
2022-01-25 21:31:42 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=183, dp=7, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>))]
2022-01-25 21:31:43 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=27 command_id=1>
2022-01-25 21:31:43 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=27 command_id=1>
2022-01-25 21:31:43 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=27 command_id=1>
2022-01-25 21:31:43 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=27 command_id=1>
2022-01-25 21:31:43 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=27 command_id=1>
2022-01-25 21:31:44 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=27 command_id=1>
2022-01-25 21:31:44 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=27 command_id=1>
2022-01-25 21:31:44 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=27 command_id=1>
javicalle commented 2 years ago

Another late test. Try it when you can, but I won't review the results until tomorrow.

Change the TuyaSingleSwitchDimmerGP (/custom_zha_quirks/ts0601_dimmer.py file) class to this one:

class TuyaSingleSwitchDimmerGP(TuyaDimmerSwitch):
    """Tuya touch switch 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_ip2akl4w",
        # "model": "TS0601",
        # "class": "zigpy.device.Device"

        MODELS_INFO: [
            ("_TZE200_3p5ydos3", "TS0601"),
            ("_TZE200_ip2akl4w", "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,
                    LevelControl.cluster_id,
                    TuyaManufacturerClusterOnOff,
                    TuyaOnOff,
                    TuyaManufacturerLevelControl,
                    TuyaLevelControl,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
            242: {
                PROFILE_ID: 41440,
                DEVICE_TYPE: 97,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
            },
        },
    }

Delete cache, restart HA and check with the 1gang dimmer device (the 0xf51b one).

Regards.

Daandeve commented 2 years ago

Hi, just tested it but it does not accept commands

[0xF51B:1:0x0008]: async_initialize: all attempts have failed: [DeliveryError('[0xf51b:1:0x0008]: Message send failure'), DeliveryError('[0xf51b:1:0x0008]: Message send failure'), TimeoutError(), TimeoutError()]
[0xF51B:1:0x0006]: async_initialize: all attempts have failed: [DeliveryError('[0xf51b:1:0x0006]: Message send failure'), DeliveryError('[0xf51b:1:0x0006]: Message send failure'), TimeoutError(), TimeoutError()]
Daandeve commented 2 years ago

Could it be a problem that these devices were never registered to the tuya cloud?

javicalle commented 2 years ago

Could it be a problem that these devices were never registered to the tuya cloud?

I don't think so. I have 2 Moes switch that never has been conected to Tuya Cloud or gateway.

Maybe I have found something...

I'm not sure how is your environment right now, but I'm going to ask you to restore the quirk file version. That is:

Delete cache, restart HA, test, logs...

Daandeve commented 2 years ago

Could it be a problem that these devices were never registered to the tuya cloud?

I don't think so. I have 2 Moes switch that never has been conected to Tuya Cloud or gateway.

Maybe I have found something...

I'm not sure how is your environment right now, but I'm going to ask you to restore the quirk file version. That is:

            # cmd_payload.tsn = self.endpoint.device.application.get_sequence()
            cmd_payload.tsn = 0

Delete cache, restart HA, test, logs...

Hmm okay, did everything but it acts the same and the logs seem the same.

2 Gang

2022-01-26 19:43:33 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0x0006] Sending Tuya Cluster Command... Cluster Command is 1, Arguments are ()
2022-01-26 19:43:33 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] tuya_mcu_command: cluster_data=TuyaClusterData(endpoint_id=1, cluster_attr='on_off', attr_value=1)
2022-01-26 19:43:33 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] get_dp_mapping --> found DP: 1
2022-01-26 19:43:33 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] from_cluster_data: 1, DPToAttributeMapping(ep_attribute='on_off', attribute_name='on_off', dp_type=<TuyaDPType.BOOL: 1>, converter=None, dp_converter=None, endpoint_id=None)
2022-01-26 19:43:33 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] ztype: Bool.true
2022-01-26 19:43:33 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] from_value: [1, 1]
2022-01-26 19:43:33 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] raw: b'\x01'
2022-01-26 19:43:33 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] tuya_command: TuyaCommand(status=0, tsn=0, dp=1, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>))
2022-01-26 19:43:33 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x80C1:1:0x0006]: executed 'on' command with args: '()' kwargs: '{}' result: Status.SUCCESS
2022-01-26 19:43:33 DEBUG (MainThread) [homeassistant.components.zha.entity] light.bathroom_dimmer_level_on_off: turned on: {'on_off': <Status.SUCCESS: 0>}
2022-01-26 19:43:35 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=9 command_id=Command.Default_Response>
2022-01-26 19:43:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:2:0x0006] Sending Tuya Cluster Command... Cluster Command is 1, Arguments are ()
2022-01-26 19:43:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] tuya_mcu_command: cluster_data=TuyaClusterData(endpoint_id=2, cluster_attr='on_off', attr_value=1)
2022-01-26 19:43:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] get_dp_mapping --> found DP: 7
2022-01-26 19:43:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] from_cluster_data: 7, DPToAttributeMapping(ep_attribute='on_off', attribute_name='on_off', dp_type=<TuyaDPType.BOOL: 1>, converter=None, dp_converter=None, endpoint_id=2)
2022-01-26 19:43:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] ztype: Bool.true
2022-01-26 19:43:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] from_value: [1, 1]
2022-01-26 19:43:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] raw: b'\x01'
2022-01-26 19:43:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] tuya_command: TuyaCommand(status=0, tsn=0, dp=7, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>))
2022-01-26 19:43:36 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x80C1:2:0x0006]: executed 'on' command with args: '()' kwargs: '{}' result: Status.SUCCESS
2022-01-26 19:43:36 DEBUG (MainThread) [homeassistant.components.zha.entity] light.bathroom_dimmer_level_on_off_2: turned on: {'on_off': <Status.SUCCESS: 0>}
2022-01-26 19:43:37 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0x0000](EZSP): Attempting to checkin with device - missed checkins: 1
2022-01-26 19:43:37 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0x0000](EZSP): does not have a mandatory basic cluster
2022-01-26 19:43:38 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=11 command_id=Command.Default_Response>
2022-01-26 19:43:42 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=34 command_id=1>
2022-01-26 19:43:42 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=229, dp=7, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>))]
2022-01-26 19:43:42 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=34 command_id=1>
2022-01-26 19:43:43 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=34 command_id=1>
2022-01-26 19:43:44 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=34 command_id=1>
2022-01-26 19:43:44 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=35 command_id=1>
2022-01-26 19:43:44 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=230, dp=1, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>))]
2022-01-26 19:43:44 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=35 command_id=1>
2022-01-26 19:43:44 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=35 command_id=1>
2022-01-26 19:43:44 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=35 command_id=1>
2022-01-26 19:43:45 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=35 command_id=1>
2022-01-26 19:43:45 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=35 command_id=1>
2022-01-26 19:43:46 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=36 command_id=1>
2022-01-26 19:43:46 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=231, dp=1, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>))]
2022-01-26 19:43:46 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=36 command_id=1>
2022-01-26 19:43:46 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=36 command_id=1>
2022-01-26 19:43:47 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=36 command_id=1>
2022-01-26 19:43:47 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=36 command_id=1>
2022-01-26 19:43:47 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=36 command_id=1>
2022-01-26 19:43:47 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=36 command_id=1>
2022-01-26 19:43:47 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=36 command_id=1>
2022-01-26 19:43:48 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=36 command_id=1>
2022-01-26 19:43:48 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=37 command_id=1>
2022-01-26 19:43:48 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=232, dp=7, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>))]
2022-01-26 19:43:48 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=37 command_id=1>
2022-01-26 19:43:48 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=37 command_id=1>
2022-01-26 19:43:48 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=37 command_id=1>
2022-01-26 19:43:48 DEBUG (MainThread) [zigpy.zcl] [0x80c1: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=37 command_id=1>

1 Gang

2022-01-26 19:44:04 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=179 command_id=Command.Report_Attributes>
2022-01-26 19:44:04 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=1, value=<TypeValue type=uint8_t, value=64>), Attribute(attrid=65506, value=<TypeValue type=uint8_t, value=32>), Attribute(attrid=65508, value=<TypeValue type=uint8_t, value=0>)]]
2022-01-26 19:44:04 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] Attribute report received: app_version=64, 65506=32, 65508=0
2022-01-26 19:44:04 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=179 command_id=Command.Report_Attributes>
2022-01-26 19:44:04 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=1, value=<TypeValue type=uint8_t, value=64>), Attribute(attrid=65506, value=<TypeValue type=uint8_t, value=32>), Attribute(attrid=65508, value=<TypeValue type=uint8_t, value=0>)]]
2022-01-26 19:44:04 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] Attribute report received: app_version=64, 65506=32, 65508=0
2022-01-26 19:44:04 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=179 command_id=Command.Report_Attributes>
2022-01-26 19:44:04 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=1, value=<TypeValue type=uint8_t, value=64>), Attribute(attrid=65506, value=<TypeValue type=uint8_t, value=32>), Attribute(attrid=65508, value=<TypeValue type=uint8_t, value=0>)]]
2022-01-26 19:44:04 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] Attribute report received: app_version=64, 65506=32, 65508=0
2022-01-26 19:44:04 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=179 command_id=Command.Report_Attributes>
2022-01-26 19:44:04 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=1, value=<TypeValue type=uint8_t, value=64>), Attribute(attrid=65506, value=<TypeValue type=uint8_t, value=32>), Attribute(attrid=65508, value=<TypeValue type=uint8_t, value=0>)]]
2022-01-26 19:44:04 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] Attribute report received: app_version=64, 65506=32, 65508=0
2022-01-26 19:44:05 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=180 command_id=Command.Report_Attributes>
2022-01-26 19:44:05 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=65503, value=<TypeValue type=CharacterString, value=�N�)i>)]]
2022-01-26 19:44:05 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] Attribute report received: 65503=�N�)i
2022-01-26 19:44:05 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=180 command_id=Command.Report_Attributes>
2022-01-26 19:44:05 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=65503, value=<TypeValue type=CharacterString, value=�N�)i>)]]
2022-01-26 19:44:05 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] Attribute report received: 65503=�N�)i
2022-01-26 19:44:05 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=180 command_id=Command.Report_Attributes>
2022-01-26 19:44:05 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=65503, value=<TypeValue type=CharacterString, value=�N�)i>)]]
2022-01-26 19:44:05 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] Attribute report received: 65503=�N�)i
2022-01-26 19:44:05 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=180 command_id=Command.Report_Attributes>
2022-01-26 19:44:05 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=65503, value=<TypeValue type=CharacterString, value=�N�)i>)]]
2022-01-26 19:44:05 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] Attribute report received: 65503=�N�)i
2022-01-26 19:44:06 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=180 command_id=Command.Report_Attributes>
2022-01-26 19:44:06 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] ZCL request 0x000a: [[Attribute(attrid=65503, value=<TypeValue type=CharacterString, value=�N�)i>)]]
2022-01-26 19:44:06 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0000] Attribute report received: 65503=�N�)i
2022-01-26 19:44:23 DEBUG (MainThread) [zigpy.zcl] [0xc1c3:1:0x0400] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=223 command_id=Command.Report_Attributes>
2022-01-26 19:44:23 DEBUG (MainThread) [zigpy.zcl] [0xc1c3:1:0x0400] ZCL request 0x000a: [[Attribute(attrid=0, value=<TypeValue type=uint16_t, value=4772>)]]
2022-01-26 19:44:23 DEBUG (MainThread) [zigpy.zcl] [0xc1c3:1:0x0400] Attribute report received: measured_value=4772
2022-01-26 19:44:41 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0x0000](EZSP): Attempting to checkin with device - missed checkins: 2
2022-01-26 19:44:41 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0x0000](EZSP): does not have a mandatory basic cluster
2022-01-26 19:45:01 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0x0006] Sending Tuya Cluster Command... Cluster Command is 0, Arguments are ()
2022-01-26 19:45:01 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] tuya_mcu_command: cluster_data=TuyaClusterData(endpoint_id=1, cluster_attr='on_off', attr_value=0)
2022-01-26 19:45:01 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] get_dp_mapping --> found DP: 1
2022-01-26 19:45:01 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] from_cluster_data: 1, DPToAttributeMapping(ep_attribute='on_off', attribute_name='on_off', dp_type=<TuyaDPType.BOOL: 1>, converter=None, dp_converter=None, endpoint_id=None)
2022-01-26 19:45:01 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] ztype: Bool.false
2022-01-26 19:45:01 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] from_value: [1, 0]
2022-01-26 19:45:01 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] raw: b'\x00'
2022-01-26 19:45:01 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] tuya_command: TuyaCommand(status=0, tsn=0, dp=1, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>))
2022-01-26 19:45:01 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xF51B:1:0x0006]: executed 'off' command with args: '()' kwargs: '{}' result: Status.SUCCESS
2022-01-26 19:45:01 DEBUG (MainThread) [homeassistant.components.zha.entity] light.bas_dimmer_level_on_off: turned off: Status.SUCCESS
2022-01-26 19:45:03 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=22 command_id=Command.Default_Response>
2022-01-26 19:45:10 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=181 command_id=1>
2022-01-26 19:45:10 DEBUG (MainThread) [zigpy.zcl] [0xf51b:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=68, dp=1, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>))]
2022-01-26 19:45:10 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=181 command_id=1>
2022-01-26 19:45:10 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=181 command_id=1>
2022-01-26 19:45:11 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=181 command_id=1>
2022-01-26 19:45:11 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=181 command_id=1>
2022-01-26 19:45:11 DEBUG (MainThread) [zigpy.zcl] [0xf51b: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=181 command_id=1>
Daandeve commented 2 years ago

I changed some code in the init.py for additional logging. When I try to turn the switch off via home assistant

2022-01-26 20:15:45 DEBUG (MainThread) [custom_tuya_quirk] Sending Tuya Cluster Command... Cluster Command is 0, Arguments are ()
2022-01-26 20:15:45 DEBUG (MainThread) [custom_tuya_quirk] tuya_mcu_command: cluster_data=TuyaClusterData(endpoint_id=1, cluster_attr='on_off', attr_value=0)
2022-01-26 20:15:45 DEBUG (MainThread) [custom_tuya_quirk] get_dp_mapping --> found DP: 1
2022-01-26 20:15:45 DEBUG (MainThread) [custom_tuya_quirk] from_cluster_data: 1, DPToAttributeMapping(ep_attribute='on_off', attribute_name='on_off', dp_type=<TuyaDPType.BOOL: 1>, converter=None, dp_converter=None, endpoint_id=None)
2022-01-26 20:15:45 DEBUG (MainThread) [custom_tuya_quirk] ztype: Bool.false
2022-01-26 20:15:45 DEBUG (MainThread) [custom_tuya_quirk] from_value: [1, 0]
2022-01-26 20:15:45 DEBUG (MainThread) [custom_tuya_quirk] raw: b'\x00'
2022-01-26 20:15:45 DEBUG (MainThread) [custom_tuya_quirk] tuya_command: TuyaCommand(status=0, tsn=0, dp=1, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>))
javicalle commented 2 years ago

I have no idea what could be going on here.

I can see that the changes I request are applied and that the code is being executed as expected 👍🏻, but I don't understand why the device is behaving 👎🏻.

It seems that the reception in the HA part works, but I don't understand some of the traces (why do you receive repetitions?)

Sending from HA looks the same as the commands you receive from the physical device, so it should work... but no

Can you check if you have a mcu_version for the TuyaLevelControlManufCluster?: image

Daandeve commented 2 years ago

Yes it is very weird, the mcu version shows None. Screenshot_20220126-203203.jpg

javicalle commented 2 years ago

Yes it is very weird, the mcu version shows None.

Don't worry, this value only is informed if device broadcast the value. It was just to check.

javicalle commented 2 years ago

I @nworbneb, sorry to bother you, but we're trying to test a device similar to #1033 and we're having trouble. The device we are trying to quirk has the same signature as yours, but with the green power endpoint.

If possible, would you be so kind as to replicate the quirk according to comment and validate that your device works? I am interested in the device management part from HA. And also the traces in HA when you trigger the physical device.

Thanks in advanced.

Daandeve commented 2 years ago

Yes it is very weird, the mcu version shows None.

Don't worry, this value only is informed if device broadcast the value. It was just to check.

Hmm okay, I do see that when I reconfigure the device the TuyaLevelControlManufCluster does not get used. Does your device do this as well? image

javicalle commented 2 years ago

Yes, more o less the same (mine has no level control, no greenPower, and some local modifications): image

javicalle commented 2 years ago

I have replicated the exact same code in my environment (in my case I have 2 Moes switches, not dimmers) and everything works fine. Unless someone can provide a clue or another point of view, I can't go any further in identifying the problem.

With the same behavior in 2 devices, I think it's not a hardware defect but rather a change in functionality maybe due to manufacturer implementation or software evolution.

I have searched for information about it and I have found this issue in Herdsman-converters:

I have not been able to see if it is related, and a similar implementation has been tried without success.

nworbneb commented 2 years ago

I @nworbneb, sorry to bother you, but we're trying to test a device similar to #1033 and we're having trouble. The device we are trying to quirk has the same signature as yours, but with the green power endpoint.

If possible, would you be so kind as to replicate the quirk according to comment and validate that your device works? I am interested in the device management part from HA. And also the traces in HA when you trigger the physical device.

Thanks in advanced.

Hi @javicalle,

No bother to try and help. I updated ts0601_dimmer.py with your latest code (although obviously won't really do anything for me).

This log: https://pastebin.com/mEbnqN45

All working great for me

Daandeve commented 2 years ago

I @nworbneb, sorry to bother you, but we're trying to test a device similar to #1033 and we're having trouble. The device we are trying to quirk has the same signature as yours, but with the green power endpoint. If possible, would you be so kind as to replicate the quirk according to comment and validate that your device works? I am interested in the device management part from HA. And also the traces in HA when you trigger the physical device. Thanks in advanced.

Hi @javicalle,

No bother to try and help. I updated ts0601_dimmer.py with your latest code (although obviously won't really do anything for me).

This log: https://pastebin.com/mEbnqN45

  • Power cycled to device
  • Turned on dimmer 1 with switch, switch held to cycle brightness, turned off with switch
  • Turned on dimmer 2 with switch, switch held to cycle brightness, turned off with switch
  • Turned on dimmer 1 with HA, brightness increased, turned off with HA
  • Turned on dimmer 2 with HA, brightness increased, turned off with HA

All working great for me

That's even more weird... I have basically the same dimmer (But with manual control) and the dimmer does not accept the commands

Tropaion commented 2 years ago

Mine doesn't accept the commands either, but I can read the status.

And I also get this error:

Logger: homeassistant.components.zha.core.channels.base
Source: components/zha/core/channels/base.py:428
Integration: Zigbee Home Automation (documentation, issues)
First occurred: 23:46:43 (3 occurrences)
Last logged: 23:46:45

[0x1F9D:1:0x0006]: async_initialize: all attempts have failed: [DeliveryError('Request failed after 5 attempts: <Status.NWK_NO_ROUTE: 205>'), DeliveryError('Request failed after 5 attempts: <Status.NWK_NO_ROUTE: 205>'), DeliveryError('Request failed after 5 attempts: <Status.NWK_NO_ROUTE: 205>'), DeliveryError('Request failed after 5 attempts: <Status.NWK_NO_ROUTE: 205>')]
[0x1F9D:1:0x0702]: async_initialize: all attempts have failed: [DeliveryError('Request failed after 5 attempts: <Status.NWK_NO_ROUTE: 205>'), DeliveryError('Request failed after 5 attempts: <Status.NWK_NO_ROUTE: 205>'), DeliveryError('Request failed after 5 attempts: <Status.NWK_NO_ROUTE: 205>'), DeliveryError('Request failed after 5 attempts: <Status.NWK_NO_ROUTE: 205>')]
[0x1F9D:1:0x0b04]: async_initialize: all attempts have failed: [DeliveryError('Request failed after 5 attempts: <Status.NWK_NO_ROUTE: 205>'), DeliveryError('Request failed after 5 attempts: <Status.NWK_NO_ROUTE: 205>'), DeliveryError('Request failed after 5 attempts: <Status.NWK_NO_ROUTE: 205>'), DeliveryError('Request failed after 5 attempts: <Status.NWK_NO_ROUTE: 205>')]
javicalle commented 2 years ago

All working great for me

Thank you for taking the trouble and for such detailed testing. I really thank you very much.

The test seems to confirm the suspicion that the sending the messages to the MCU part works, but there is something in these devices that makes it not process it. 😫 😤

Daandeve commented 2 years ago

All working great for me

Thank you for taking the trouble and for such detailed testing. I really thank you very much.

The test seems to confirm the suspicion that the sending the messages to the MCU part works, but there is something in these devices that makes it not process it. 😫 😤

Is there a way that you know of logging the device's raw commands when the switch is manually switched?

javicalle commented 2 years ago

I think that this is not possible.

When using the physical device, the commands pass to the MCU directly. Once the command is 'executed' the MCU broadcast the changes for the gateway to update the status. That message is the one we can read, but it is not different from the message that is sent from HA.

MCU status message:

2022-01-26 19:43:46 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=231, dp=1, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>))]

HA sending message:

2022-01-26 19:43:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] tuya_command: TuyaCommand(status=0, tsn=0, dp=7, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>))

I don't know if is possible to get the raw message like this:

[0xb3be:1:0xef00] ZCL request 0x0011: b'\x00\xba\x82'

Tropaion commented 2 years ago

I don't know if it helps, but I made a new empty zigbee network and got these errors: The first error is gone after I added the double channel dimmer class, which I didn't before. I don't know why this is recognized as a double channel dimmer, since it is only for one lamp.

Logger: zigpy.zcl
Source: /usr/local/lib/python3.9/site-packages/zhaquirks/tuya/__init__.py:1293
First occurred: 14:15:35 (1 occurrences)
Last logged: 14:15:35

[0x2dcb:1:0xef00] No 'handle_set_data_response' tuya handler found for [TuyaCommand(status=0, tsn=14, dp=5, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'\xe8\x03\x00\x00', *payload=1000))]
Logger: zigpy.zcl
Source: /usr/local/lib/python3.9/site-packages/zigpy/zcl/__init__.py:95
First occurred: 14:15:33 (1 occurrences)
Last logged: 14:15:33

Unknown cluster 61184

This is 0xEF00 which is normally the TuyaManufCluster.cluster_id but I think it is replaced by your new MCU with the class TuyaLevelControlManufCluster. My guess is that there is a problem with this class. I tried replacing it with the implemented TuyaManufCluster but then I got this error:

Logger: zigpy.util
Source: /usr/local/lib/python3.9/site-packages/zigpy/util.py:49
First occurred: 15:01:30 (2 occurrences)
Last logged: 15:01:33

Error calling listener.tuya_mcu_command: Failed to convert status=TuyaClusterData(endpoint_id=1, cluster_attr='on_off', attr_value=1) from type <class 'custom_zha_quirks.tuya.mcu.TuyaClusterData'> to <class 'zigpy.types.basic.uint8_t'>
Error calling listener.tuya_mcu_command: Failed to convert status=TuyaClusterData(endpoint_id=2, cluster_attr='on_off', attr_value=1) from type <class 'custom_zha_quirks.tuya.mcu.TuyaClusterData'> to <class 'zigpy.types.basic.uint8_t'>
javicalle commented 2 years ago

The TuyaManufCluster (and subclases) handles the MCU comunication. New 'tuya clusters' must be added to quirk the device to apparent be a normal Zigbee device.

The TuyaLevelControlManufCluster is a especific TuyaManufCluster subclass that know how to talk to (and listen) the fake TuyaLevelControl cluster.

Tropaion commented 2 years ago

@javicalle I thought so, but it still says in the error that the cluster is unkown, so shouldn't there probably be a problem with TuyaLevelControlManufCluster?

And why is it recognized as a double channel dimmer even though it is a single lamp dimmer?

javicalle commented 2 years ago

I am aware of it, but (in my environment) only happens during the restart. I believe that is an message received before quirk load or maybe when restoring device from registry.

Anyway, I have this error too and device is functional 🤔

Daandeve commented 2 years ago

I think that this is not possible.

When using the physical device, the commands pass to the MCU directly. Once the command is 'executed' the MCU broadcast the changes for the gateway to update the status. That message is the one we can read, but it is not different from the message that is sent from HA.

MCU status message:

2022-01-26 19:43:46 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] ZCL request 0x0001: [TuyaCommand(status=0, tsn=231, dp=1, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>))]

HA sending message:

2022-01-26 19:43:36 DEBUG (MainThread) [zigpy.zcl] [0x80c1:1:0xef00] tuya_command: TuyaCommand(status=0, tsn=0, dp=7, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>))

I don't know if is possible to get the raw message like this:

[0xb3be:1:0xef00] ZCL request 0x0011: b'\x00\xba\x82'

Could it be something encoding/decoding related? Maybe the firmware on my dimmer is newer/older than your switch?

Tropaion commented 2 years ago

@javicalle I don't know if it helps....but I activating ZHA debugging and logged everything that happens when I try to turn on the dimmer:

2022-01-28 15:30:55 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_data=entity_id=light.esszimmer_deckenlicht_level_on_off>
2022-01-28 15:30:55 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0x0006] Sending Tuya Cluster Command... Cluster Command is 1, Arguments are ()
2022-01-28 15:30:55 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0xef00] tuya_mcu_command: cluster_data=TuyaClusterData(endpoint_id=1, cluster_attr='on_off', attr_value=1)
2022-01-28 15:30:55 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0xef00] get_dp_mapping --> found DP: 1
2022-01-28 15:30:55 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0xef00] from_cluster_data: 1, DPToAttributeMapping(ep_attribute='on_off', attribute_name='on_off', dp_type=<TuyaDPType.BOOL: 1>, converter=None, dp_converter=None, endpoint_id=None)
2022-01-28 15:30:55 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0xef00] ztype: Bool.true
2022-01-28 15:30:55 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0xef00] from_value: [1, 1]
2022-01-28 15:30:55 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0xef00] raw: b'\x01'
2022-01-28 15:30:55 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0xef00] tuya_command: TuyaCommand(status=0, tsn=10, dp=1, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>))
2022-01-28 15:30:55 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x2DCB:1:0x0006]: executed 'on' command with args: '()' kwargs: '{}' result: Status.SUCCESS
2022-01-28 15:30:55 DEBUG (MainThread) [homeassistant.components.zha.entity] light.esszimmer_deckenlicht_level_on_off: turned on: {'on_off': <Status.SUCCESS: 0>}
2022-01-28 15:30:55 DEBUG (MainThread) [zigpy_znp.api] Sending request: AF.DataRequestExt.Req(DstAddrModeAddress=AddrModeAddress(mode=<AddrMode.NWK: 2>, address=0x2DCB), DstEndpoint=1, DstPanId=0x0000, SrcEndpoint=1, ClusterId=61184, TSN=11, Options=<TransmitOptions.SUPPRESS_ROUTE_DISC_NETWORK|ACK_REQUEST: 48>, Radius=30, Data=b'\x05\x41\x11\x0B\x00\x00\x0A\x01\x01\x00\x01\x01')
2022-01-28 15:30:55 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.DataRequestExt.Rsp(Status=<Status.SUCCESS: 0>)
2022-01-28 15:30:55 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.DataConfirm.Callback(Status=<Status.SUCCESS: 0>, Endpoint=1, TSN=11)
2022-01-28 15:30:55 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=61184, SrcAddr=0x2DCB, SrcEndpoint=1, DstEndpoint=1, WasBroadcast=<Bool.false: 0>, LQI=36, SecurityUse=<Bool.false: 0>, TimeStamp=10638763, TSN=0, Data=b'\x18\x0B\x0B\x00\x83', MacSrcAddr=0x2DCB, MsgResultRadius=29)
2022-01-28 15:30:55 DEBUG (MainThread) [zigpy.zcl] [0x2dcb: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=11 command_id=Command.Default_Response>
2022-01-28 15:30:59 DEBUG (MainThread) [zigpy_znp.api] Sending request: SYS.Ping.Req()
2022-01-28 15:30:59 DEBUG (MainThread) [zigpy_znp.api] Received command: SYS.Ping.Rsp(Capabilities=<MTCapabilities.APP_CNF|GP|UTIL|ZDO|AF|SYS: 1625>)

And when I try to change brightness:

2022-01-28 15:37:07 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=device_tracker.desktop_2fm0mvn, old_state=<state device_tracker.desktop_2fm0mvn=home; source_type=router, ip=192.168.44.8, mac=8C:C6:81:FD:B4:C5, host_name=DESKTOP-2FM0MVN, friendly_name=DESKTOP-2FM0MVN @ 2022-01-28T15:23:51.834105+01:00>, new_state=<state device_tracker.desktop_2fm0mvn=not_home; source_type=router, ip=192.168.44.8, mac=8C:C6:81:FD:B4:C5, host_name=DESKTOP-2FM0MVN, friendly_name=DESKTOP-2FM0MVN @ 2022-01-28T15:37:07.037944+01:00>>
2022-01-28 15:37:14 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_data=entity_id=light.esszimmer_deckenlicht_level_on_off, brightness_pct=24>
2022-01-28 15:37:14 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0x0008] Sending Tuya Cluster Command. Cluster Command is 4, Arguments are (61, 1)
2022-01-28 15:37:14 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0xef00] tuya_mcu_command: cluster_data=TuyaClusterData(endpoint_id=1, cluster_attr='current_level', attr_value=61)
2022-01-28 15:37:14 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0xef00] get_dp_mapping --> found DP: 2
2022-01-28 15:37:14 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0xef00] from_cluster_data: 2, DPToAttributeMapping(ep_attribute='level', attribute_name='current_level', dp_type=<TuyaDPType.VALUE: 2>, converter=<function TuyaLevelControlManufCluster.<lambda> at 0x7f031c0af280>, dp_converter=<function TuyaLevelControlManufCluster.<lambda> at 0x7f031c0af310>, endpoint_id=None)
2022-01-28 15:37:14 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0xef00] converted: 239
2022-01-28 15:37:14 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0xef00] ztype: 239
2022-01-28 15:37:14 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0xef00] from_value: [4, 0, 0, 0, 239]
2022-01-28 15:37:14 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0xef00] raw: b'\x00\x00\x00\xef'
2022-01-28 15:37:14 DEBUG (MainThread) [zigpy.zcl] [0x2dcb:1:0xef00] tuya_command: TuyaCommand(status=0, tsn=16, dp=2, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'\x00\x00\x00\xef', *payload=4009754624))
2022-01-28 15:37:14 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x2DCB:1:0x0008]: executed 'move_to_level_with_on_off' command with args: '(61, 1)' kwargs: '{}' result: Status.SUCCESS
2022-01-28 15:37:14 DEBUG (MainThread) [homeassistant.components.zha.entity] light.esszimmer_deckenlicht_level_on_off: turned on: {'move_to_level_with_on_off': <Status.SUCCESS: 0>}
2022-01-28 15:37:14 DEBUG (MainThread) [zigpy_znp.api] Sending request: AF.DataRequestExt.Req(DstAddrModeAddress=AddrModeAddress(mode=<AddrMode.NWK: 2>, address=0x2DCB), DstEndpoint=1, DstPanId=0x0000, SrcEndpoint=1, ClusterId=61184, TSN=17, Options=<TransmitOptions.SUPPRESS_ROUTE_DISC_NETWORK|ACK_REQUEST: 48>, Radius=30, Data=b'\x05\x41\x11\x11\x00\x00\x10\x02\x02\x00\x04\x00\x00\x00\xEF')
2022-01-28 15:37:14 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.DataRequestExt.Rsp(Status=<Status.SUCCESS: 0>)
2022-01-28 15:37:15 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.DataConfirm.Callback(Status=<Status.SUCCESS: 0>, Endpoint=1, TSN=17)
2022-01-28 15:37:15 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=61184, SrcAddr=0x2DCB, SrcEndpoint=1, DstEndpoint=1, WasBroadcast=<Bool.false: 0>, LQI=14, SecurityUse=<Bool.false: 0>, TimeStamp=2907786, TSN=0, Data=b'\x18\x11\x0B\x00\x83', MacSrcAddr=0x2DCB, MsgResultRadius=29)
2022-01-28 15:37:15 DEBUG (MainThread) [zigpy.zcl] [0x2dcb: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=17 command_id=Command.Default_Response>

Whats sure is that there is problem with setting a DP value. I tried reading all different DP values, also from the tuya cluster and reading works without probem, only setting them doesn't work.

Would it help if I try sniffing the zigbee trafic of this device with a tuya gateway or can I do something else?

javicalle commented 2 years ago

Could you attach the traces when doing the same from HA?