zha-device-handlers icon indicating copy to clipboard operation
zha-device-handlers copied to clipboard

[Device Support Request] tuya DINRail Power meter TS0601_TZE200_lsanae15

Open TommisGR opened this issue 2 years ago • 56 comments

Is your feature request related to a problem? Please describe. tuya Din Rail Power Meter recognized as TS0601 by _TZE200_lsanae15 Only entities created are LQI and RSSI

Describe the solution you'd like To be able to report Power usage

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


</details>

<details>
<!-- Diagnostic information can be acquired by clicking on the "Download Diagnostics" button in the device settings view -->
<summary>Diagnostic information</summary>

```yaml
{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.8.7",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.5",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/Athens",
    "os_name": "Linux",
    "os_version": "5.15.32-v8",
    "supervisor": "2022.08.6",
    "host_os": "Home Assistant OS 8.5",
    "docker_version": "20.10.14",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "hacs": {
      "version": "1.27.2",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    },
    "watchman": {
      "version": "0.5.1",
      "requirements": [
        "prettytable==3.0.0"
      ]
    },
    "ble_monitor": {
      "version": "10.0.0",
      "requirements": [
        "pycryptodomex>=3.14.1",
        "janus>=1.0.0",
        "aioblescan>=0.2.13",
        "btsocket>=0.2.0",
        "pyric>=0.1.6.3"
      ]
    },
    "mopidy": {
      "version": "1.4.6",
      "requirements": [
        "mopidyapi==1.0.0"
      ]
    },
    "androidtv_custom": {
      "version": "0.1.0",
      "requirements": [
        "adb-shell[async]==0.4.2",
        "androidtv[async]==0.0.67",
        "pure-python-adb[async]==0.3.0.dev0"
      ]
    },
    "tapo": {
      "version": "1.2.15",
      "requirements": [
        "plugp100==2.1.18"
      ]
    },
    "sonoff": {
      "version": "3.2.0",
      "requirements": [
        "pycryptodome>=3.6.6"
      ]
    }
  },
  "integration_manifest": {
    "domain": "zha",
    "name": "Zigbee Home Automation",
    "config_flow": true,
    "documentation": "https://www.home-assistant.io/integrations/zha",
    "requirements": [
      "bellows==0.33.1",
      "pyserial==3.5",
      "pyserial-asyncio==0.6",
      "zha-quirks==0.0.78",
      "zigpy-deconz==0.18.0",
      "zigpy==0.50.2",
      "zigpy-xbee==0.15.0",
      "zigpy-zigate==0.9.2",
      "zigpy-znp==0.8.2"
    ],
    "usb": [
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*2652*",
        "known_devices": [
          "slae.sh cc2652rb stick"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*sonoff*plus*",
        "known_devices": [
          "sonoff zigbee dongle plus"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*tubeszb*",
        "known_devices": [
          "TubesZB Coordinator"
        ]
      },
      {
        "vid": "1A86",
        "pid": "7523",
        "description": "*tubeszb*",
        "known_devices": [
          "TubesZB Coordinator"
        ]
      },
      {
        "vid": "1A86",
        "pid": "7523",
        "description": "*zigstar*",
        "known_devices": [
          "ZigStar Coordinators"
        ]
      },
      {
        "vid": "1CF1",
        "pid": "0030",
        "description": "*conbee*",
        "known_devices": [
          "Conbee II"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8A2A",
        "description": "*zigbee*",
        "known_devices": [
          "Nortek HUSBZB-1"
        ]
      },
      {
        "vid": "0403",
        "pid": "6015",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate+"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8B34",
        "description": "*bv 2010/10*",
        "known_devices": [
          "Bitron Video AV2010/10"
        ]
      }
    ],
    "codeowners": [
      "@dmulcahey",
      "@adminiuga",
      "@puddly"
    ],
    "zeroconf": [
      {
        "type": "_esphomelib._tcp.local.",
        "name": "tube*"
      },
      {
        "type": "_zigate-zigbee-gateway._tcp.local.",
        "name": "*zigate*"
      }
    ],
    "after_dependencies": [
      "onboarding",
      "usb",
      "zeroconf"
    ],
    "iot_class": "local_polling",
    "loggers": [
      "aiosqlite",
      "bellows",
      "crccheck",
      "pure_pcapy3",
      "zhaquirks",
      "zigpy",
      "zigpy_deconz",
      "zigpy_xbee",
      "zigpy_zigate",
      "zigpy_znp"
    ],
    "is_built_in": true
  },
  "data": {
    "ieee": "**REDACTED**",
    "nwk": 56904,
    "manufacturer": "_TZE200_lsanae15",
    "model": "TS0601",
    "name": "_TZE200_lsanae15 TS0601",
    "quirk_applied": false,
    "quirk_class": "zigpy.device.Device",
    "manufacturer_code": 4417,
    "power_source": "Mains",
    "lqi": 100,
    "rssi": -75,
    "last_seen": "2022-09-18T15:51:59",
    "available": true,
    "device_type": "Router",
    "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"
          ]
        }
      }
    },
    "active_coordinator": false,
    "entities": [],
    "neighbors": [],
    "endpoint_names": [
      {
        "name": "SMART_PLUG"
      },
      {
        "name": "unknown 97 device_type of 0xa1e0 profile id"
      }
    ],
    "user_given_name": "DIN Rail Power",
    "device_reg_id": "62511e954010a08bd9424e57016c480f",
    "area_id": null,
    "cluster_details": {
      "1": {
        "device_type": {
          "name": "SMART_PLUG",
          "id": 81
        },
        "profile_id": 260,
        "in_clusters": {
          "0x0004": {
            "endpoint_attribute": "groups",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0005": {
            "endpoint_attribute": "scenes",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0xef00": {
            "endpoint_attribute": null,
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0000": {
            "endpoint_attribute": "basic",
            "attributes": {
              "0x0001": {
                "attribute_name": "app_version",
                "value": 70
              },
              "0x0004": {
                "attribute_name": "manufacturer",
                "value": "_TZE200_lsanae15"
              },
              "0x0005": {
                "attribute_name": "model",
                "value": "TS0601"
              }
            },
            "unsupported_attributes": {}
          }
        },
        "out_clusters": {
          "0x0019": {
            "endpoint_attribute": "ota",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x000a": {
            "endpoint_attribute": "time",
            "attributes": {},
            "unsupported_attributes": {}
          }
        }
      },
      "242": {
        "device_type": {
          "name": "unknown",
          "id": 97
        },
        "profile_id": 41440,
        "in_clusters": {},
        "out_clusters": {
          "0x0021": {
            "endpoint_attribute": "green_power",
            "attributes": {},
            "unsupported_attributes": {}
          }
        }
      }
    }
  }
}
Additional logs
Paste any additional debug logs here.
Don't remove the extra line breaks outside the ``` marks.

Additional context Add any other context or screenshots about the feature request here. image https://www.aliexpress.com/item/1005004399475951.html

TommisGR avatar Sep 18 '22 12:09 TommisGR

Tryied adding custom quirk 'ts0601_din_power.py' with the below change:

MODELS_INFO: [
            ("_TZE200_lsanae15", "TS0601"),
        ],

but it doesnt get recognized am I doing something wrong quirk folder works the'pycache' is created after I delete it and restart HA

TommisGR avatar Sep 20 '22 14:09 TommisGR

can someone please guide me with adding a custom quirk.

TommisGR avatar Sep 21 '22 18:09 TommisGR

It seems to be the TuyaPowerMeter with the GPP cluster.

Can you try with that quirk?:

TuyaPowerMeter_GPP
class TuyaPowerMeter_GPP(TuyaSwitch):
    """Tuya power meter device."""

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

    signature = {
        # "node_descriptor": "<NodeDescriptor byte1=1 byte2=64 mac_capability_flags=142 manufacturer_code=4098
        #                       maximum_buffer_size=82 maximum_incoming_transfer_size=82 server_mask=11264
        #                       maximum_outgoing_transfer_size=82 descriptor_capability_field=0>",
        # device_version=1
        # input_clusters=[0x0000, 0x0004, 0x0005, 0xef00]
        # output_clusters=[0x000a, 0x0019]
        MODELS_INFO: [
            ("_TZE200_lsanae15", "TS0601"),
        ],
        ENDPOINTS: {
            # <SimpleDescriptor endpoint=1 profile=260 device_type=51
            # device_version=1
            # input_clusters=[0, 4, 5, 61184]
            # output_clusters=[10, 25]>
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaManufClusterAttributes.cluster_id,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
            242: {
                # <SimpleDescriptor endpoint=242 profile=41440 device_type=97
                # input_clusters=[]
                # output_clusters=[33]
                PROFILE_ID: 41440,
                DEVICE_TYPE: 97,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
            },
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaManufClusterDinPower,
                    TuyaPowerMeasurement,
                    TuyaElectricalMeasurement,
                    TuyaOnOff,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
            242: {
                # <SimpleDescriptor endpoint=242 profile=41440 device_type=97
                # input_clusters=[]
                # output_clusters=[33]
                PROFILE_ID: 41440,
                DEVICE_TYPE: 97,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
            },
        }
    }

You will need to import the GreenPowerProxy:

from zigpy.zcl.clusters.general import GreenPowerProxy

javicalle avatar Sep 21 '22 19:09 javicalle

used the "ts0601_din_power.py" from the 0.0.79 and replaced from the class TuyaPowerMeter(TuyaSwitch): and to the bottom with the class TuyaPowerMeter_GPP(TuyaSwitch): (all the page) additionaly added on top from zigpy.zcl.clusters.general import Basic, Groups, Ota, Scenes, Time , GreenPowerProxy

image some improvement but still cant view current consumsion

TommisGR avatar Sep 22 '22 05:09 TommisGR

I think you need to remove the device from HA and re-pair again.

If there are no improvements, the debug logs would be necessary to know what could be happening:

  • https://www.home-assistant.io/integrations/zha/#debug-logging

PS: No need to remove the TuyaPowerMeter class, you can keep both classes in the file. 😉

javicalle avatar Sep 22 '22 06:09 javicalle

NO improvements and log files sims long what part should I grep for? running grep "TZE200" home-assistant.log with

logger:
  default: info
  logs:
    homeassistant.core: debug
    homeassistant.components.zha: debug
    bellows.zigbee.application: debug
    bellows.ezsp: debug
    zigpy: debug
#    zigpy_deconz.zigbee.application: debug
#    zigpy_deconz.api: debug
#    zigpy_xbee.zigbee.application: debug
#    zigpy_xbee.api: debug
#    zigpy_zigate: debug
#    zigpy_znp: debug
    zhaquirks: debug

configuration.yaml

grep output

2022-09-22 09:33:04.644 DEBUG (MainThread) [zigpy.appdb] [0x73d2:1:0x0000] Attribute id: 4 value: _TZE200_lsanae15
2022-09-22 09:33:04.897 DEBUG (MainThread) [zigpy.quirks.registry] Checking quirks for _TZE200_lsanae15 TS0601 (a4:c1:38:cb:35:b5:0e:3b)
2022-09-22 09:33:05.728 DEBUG (MainThread) [zigpy.appdb] [0x73d2:1:0x0000] Attribute id: 4 value: _TZE200_lsanae15
2022-09-22 09:33:18.472 DEBUG (MainThread) [homeassistant.components.zha.core.gateway] [0x73D2](_TZE200_lsanae15 TS0601) restored as 'available', last seen: 0:02:45 ago, consider_unavailable_time: 7200 seconds
2022-09-22 09:33:21.100 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.tze200_lsanae15_ts0601_electricalmeasurementpowerfactor, old_state=None, new_state=<state sensor.tze200_lsanae15_ts0601_electricalmeasurementpowerfactor=unknown; state_class=measurement, unit_of_measurement=%, device_class=power_factor, friendly_name=_TZE200_lsanae15 TS0601 Electricalmeasurementpowerfactor @ 2022-09-22T09:33:21.100618+03:00>>
2022-09-22 09:33:21.141 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=switch.tze200_lsanae15_ts0601_switch, old_state=None, new_state=<state switch.tze200_lsanae15_ts0601_switch=off; friendly_name=_TZE200_lsanae15 TS0601 Switch @ 2022-09-22T09:33:21.140894+03:00>>

TommisGR avatar Sep 22 '22 06:09 TommisGR

You can try to grep the device UID 0x73d2. Any warning of "no handler for..." o similar will be usefull.

javicalle avatar Sep 22 '22 08:09 javicalle

the grep "0x73d2" home-assistant.log returns lots of the below nothing about "no handler" anything else I could try?

2022-09-22 13:36:02.775 DEBUG (MainThread) [zigpy.topology] Scanning neighbors of a4:c1:38:cb:35:b5:0e:3b/0x73d2 device
2022-09-22 13:36:03.093 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=0, clusterId=32817, sourceEndpoint=0, destinationEndpoint=0, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY|APS_OPTION_RETRY: 320>, groupId=0, sequence=13), 148, -63, 0x73d2, 255, 255, b'f\x00\x04\x00\x02\x98\xf4\xab\xe3\xcc\xcc\xcc\xccQ\xf6\x08\xfe\xff#\xa4`\x00\x00\x04\x02\x00d\x98\xf4\xab\xe3\xcc\xcc\xcc\xcc\xdf\xc9\xca$\x00K\x12\x00wL%\x02\x01*']
2022-09-22 13:36:03.102 DEBUG (MainThread) [zigpy.neighbor] [0x73d2] request status: Status.SUCCESS. response: Neighbors(entries=4, start_index=0, neighbor_table_list=[Neighbor(extended_pan_id=cc:cc:cc:cc:e3:ab:f4:98, ieee=60:a4:23:ff:fe:08:f6:51, nwk=0x0000, device_type=<DeviceType.Coordinator: 0>, rx_on_when_idle=<RxOnWhenIdle.On: 1>, relationship=<RelationShip.Parent: 0>, reserved1=0, permit_joining=<PermitJoins.Unknown: 2>, reserved2=0, depth=0, lqi=100), Neighbor(extended_pan_id=cc:cc:cc:cc:e3:ab:f4:98, ieee=00:12:4b:00:24:ca:c9:df, nwk=0x4C77, device_type=<DeviceType.Router: 1>, rx_on_when_idle=<RxOnWhenIdle.On: 1>, relationship=<RelationShip.Sibling: 2>, reserved1=0, permit_joining=<PermitJoins.Unknown: 2>, reserved2=0, depth=1, lqi=42)])
2022-09-22 13:36:04.372 DEBUG (MainThread) [zigpy.neighbor] [0x73d2] Querying next starting at 2
2022-09-22 13:36:04.732 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=0, clusterId=32817, sourceEndpoint=0, destinationEndpoint=0, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY|APS_OPTION_RETRY: 320>, groupId=0, sequence=14), 148, -63, 0x73d2, 255, 255, b'h\x00\x04\x02\x02\x98\xf4\xab\xe3\xcc\xcc\xcc\xcc\xd7\x18\xc2$\x00K\x12\x00\x1e\xd6%\x02\x01!\x98\xf4\xab\xe3\xcc\xcc\xcc\xccw\x90\xc5$\x00K\x12\x00\xad\xaf%\x02\x01\x12']
2022-09-22 13:36:04.740 DEBUG (MainThread) [zigpy.neighbor] [0x73d2] request status: Status.SUCCESS. response: Neighbors(entries=4, start_index=2, neighbor_table_list=[Neighbor(extended_pan_id=cc:cc:cc:cc:e3:ab:f4:98, ieee=00:12:4b:00:24:c2:18:d7, nwk=0xD61E, device_type=<DeviceType.Router: 1>, rx_on_when_idle=<RxOnWhenIdle.On: 1>, relationship=<RelationShip.Sibling: 2>, reserved1=0, permit_joining=<PermitJoins.Unknown: 2>, reserved2=0, depth=1, lqi=33), Neighbor(extended_pan_id=cc:cc:cc:cc:e3:ab:f4:98, ieee=00:12:4b:00:24:c5:90:77, nwk=0xAFAD, device_type=<DeviceType.Router: 1>, rx_on_when_idle=<RxOnWhenIdle.On: 1>, relationship=<RelationShip.Sibling: 2>, reserved1=0, permit_joining=<PermitJoins.Unknown: 2>, reserved2=0, depth=1, lqi=18)])
2022-09-22 13:36:04.742 DEBUG (MainThread) [zigpy.neighbor] [0x73d2] Done scanning. Total 4 neighbours
2022-09-22 13:36:53.433 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=15), 132, -67, 0x73d2, 255, 255, b'\t\xef\x02\x01\x02\x06\x00\x00\x08\x08\xe4\x00\x04j\x00\x00\xb1']
2022-09-22 13:36:53.452 DEBUG (MainThread) [zhaquirks.tuya] [0x73d2:1:0xef00] Received value [8, 228, 0, 4, 106, 0, 0, 177] for attribute 0x0006 (command 0x0002)
2022-09-22 13:36:53.636 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=16), 148, -63, 0x73d2, 255, 255, b'\t\xf0\x02\x01\x03\x01\x02\x00\x04\x00\x00\x0c\x0f']
2022-09-22 13:36:53.657 DEBUG (MainThread) [zhaquirks.tuya] [0x73d2:1:0xef00] Received value [0, 0, 12, 15] for attribute 0x0201 (command 0x0002)
2022-09-22 13:38:05.125 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=0, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=17), 136, -66, 0x73d2, 255, 255, b'\x08\xf1\n\x01\x00 F\xe2\xff 6\xe4\xff \x00']
2022-09-22 13:38:53.440 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=18), 144, -64, 0x73d2, 255, 255, b'\t\xf2\x02\x01\x04\x06\x00\x00\x08\x08\xeb\x00\x04\xe7\x00\x00\xc1']
2022-09-22 13:38:53.465 DEBUG (MainThread) [zhaquirks.tuya] [0x73d2:1:0xef00] Received value [8, 235, 0, 4, 231, 0, 0, 193] for attribute 0x0006 (command 0x0002)
2022-09-22 13:38:53.644 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=19), 148, -63, 0x73d2, 255, 255, b'\t\xf3\x02\x01\x05\x01\x02\x00\x04\x00\x00\x0c\x0f']
2022-09-22 13:38:53.666 DEBUG (MainThread) [zhaquirks.tuya] [0x73d2:1:0xef00] Received value [0, 0, 12, 15] for attribute 0x0201 (command 0x0002)
2022-09-22 13:40:53.415 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=20), 148, -63, 0x73d2, 255, 255, b'\t\xf4\x02\x01\x06\x06\x00\x00\x08\x08\xec\x00\x05\x11\x00\x00\xd7']
2022-09-22 13:40:53.448 DEBUG (MainThread) [zhaquirks.tuya] [0x73d2:1:0xef00] Received value [8, 236, 0, 5, 17, 0, 0, 215] for attribute 0x0006 (command 0x0002)
2022-09-22 13:40:53.608 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=21), 148, -63, 0x73d2, 255, 255, b'\t\xf5\x02\x01\x07\x01\x02\x00\x04\x00\x00\x0c\x10']
2022-09-22 13:40:53.626 DEBUG (MainThread) [zhaquirks.tuya] [0x73d2:1:0xef00] Received value [0, 0, 12, 16] for attribute 0x0201 (command 0x0002)

TommisGR avatar Sep 22 '22 12:09 TommisGR

I was expecting some of this:

2022-06-25 15:19:25 DEBUG (MainThread) [zigpy.zcl] [0xC958:1:0xef00] Received ZCL frame: b'\t\x97\x02\x00\xdf\x06\x01\x00\x01\x00'
2022-06-25 15:19:25 DEBUG (MainThread) [zigpy.zcl] [0xC958:1:0xef00] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=0, is_reply=1, disable_default_response=0, reserved=0, *is_cluster=True, *is_general=False), tsn=151, command_id=2, *is_reply=True)
2022-06-25 15:19:25 DEBUG (MainThread) [zigpy.zcl] [0xC958:1:0xef00] Decoded ZCL frame: TuyaWindowCoverManufCluster:set_data_response(data=TuyaCommand(status=0, tsn=223, dp=6, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>)))
2022-06-25 15:19:25 DEBUG (MainThread) [zigpy.zcl] [0xC958:1:0xef00] Received command 0x02 (TSN 151): set_data_response(data=TuyaCommand(status=0, tsn=223, dp=6, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>)))
2022-06-25 15:19:25 DEBUG (MainThread) [zigpy.zcl] [0xC958:1:0xef00] No datapoint handler for TuyaCommand(status=0, tsn=223, dp=6, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>))
2022-06-25 15:19:25 WARNING (MainThread) [zigpy.zcl] [0xC958:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=223, dp=6, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>)))
2022-06-25 15:19:25 DEBUG (MainThread) [zigpy.zcl] [0xC958:1:0xef00] Sending reply header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=False, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=151, command_id=<GeneralCommand.Default_Response: 11>, *is_reply=True)
2022-06-25 15:19:25 DEBUG (MainThread) [zigpy.zcl] [0xC958:1:0xef00] Sending reply: Default_Response(command_id=2, status=<Status.UNSUP_CLUSTER_COMMAND: 129>)

Any warning that could be relevant to us?

javicalle avatar Sep 22 '22 14:09 javicalle

grep "0x73d2" home-assistant.log | grep "zigpy"

2022-09-22 09:33:04.644 DEBUG (MainThread) [zigpy.appdb] [0x73d2:1:0x0000] Attribute id: 4 value: _TZE200_lsanae15
2022-09-22 09:33:04.645 DEBUG (MainThread) [zigpy.appdb] [0x73d2:1:0x0000] Attribute id: 5 value: TS0601
2022-09-22 09:33:05.728 DEBUG (MainThread) [zigpy.appdb] [0x73d2:1:0x0000] Attribute id: 4 value: _TZE200_lsanae15
2022-09-22 09:33:05.729 DEBUG (MainThread) [zigpy.appdb] [0x73d2:1:0x0000] Attribute id: 5 value: TS0601
2022-09-22 09:33:05.729 DEBUG (MainThread) [zigpy.appdb] [0x73d2:1:0x0b04] Attribute id: 1539 value: 1000
2022-09-22 09:33:05.729 DEBUG (MainThread) [zigpy.appdb] [0x73d2:1:0x0b04] Attribute id: 1538 value: 1
2022-09-22 09:33:05.730 DEBUG (MainThread) [zigpy.appdb] [0x73d2:1:0x0702] Attribute id: 768 value: 0
2022-09-22 09:33:05.730 DEBUG (MainThread) [zigpy.appdb] [0x73d2:1:0x0000] Attribute id: 1 value: 70
2022-09-22 09:33:05.730 DEBUG (MainThread) [zigpy.appdb] [0x73d2:1:0x0000] Attribute id: 65506 value: 54
2022-09-22 09:33:05.730 DEBUG (MainThread) [zigpy.appdb] [0x73d2:1:0x0000] Attribute id: 65508 value: 0
2022-09-22 09:33:05.730 DEBUG (MainThread) [zigpy.appdb] [0x73d2:1:0x0000] Attribute id: 65503 value: S�*��*e��*
2022-09-22 13:36:02.775 DEBUG (MainThread) [zigpy.topology] Scanning neighbors of a4:c1:38:cb:35:b5:0e:3b/0x73d2 device
2022-09-22 13:36:03.102 DEBUG (MainThread) [zigpy.neighbor] [0x73d2] request status: Status.SUCCESS. response: Neighbors(entries=4, start_index=0, neighbor_table_list=[Neighbor(extended_pan_id=cc:cc:cc:cc:e3:ab:f4:98, ieee=60:a4:23:ff:fe:08:f6:51, nwk=0x0000, device_type=<DeviceType.Coordinator: 0>, rx_on_when_idle=<RxOnWhenIdle.On: 1>, relationship=<RelationShip.Parent: 0>, reserved1=0, permit_joining=<PermitJoins.Unknown: 2>, reserved2=0, depth=0, lqi=100), Neighbor(extended_pan_id=cc:cc:cc:cc:e3:ab:f4:98, ieee=00:12:4b:00:24:ca:c9:df, nwk=0x4C77, device_type=<DeviceType.Router: 1>, rx_on_when_idle=<RxOnWhenIdle.On: 1>, relationship=<RelationShip.Sibling: 2>, reserved1=0, permit_joining=<PermitJoins.Unknown: 2>, reserved2=0, depth=1, lqi=42)])
2022-09-22 13:36:04.372 DEBUG (MainThread) [zigpy.neighbor] [0x73d2] Querying next starting at 2
2022-09-22 13:36:04.740 DEBUG (MainThread) [zigpy.neighbor] [0x73d2] request status: Status.SUCCESS. response: Neighbors(entries=4, start_index=2, neighbor_table_list=[Neighbor(extended_pan_id=cc:cc:cc:cc:e3:ab:f4:98, ieee=00:12:4b:00:24:c2:18:d7, nwk=0xD61E, device_type=<DeviceType.Router: 1>, rx_on_when_idle=<RxOnWhenIdle.On: 1>, relationship=<RelationShip.Sibling: 2>, reserved1=0, permit_joining=<PermitJoins.Unknown: 2>, reserved2=0, depth=1, lqi=33), Neighbor(extended_pan_id=cc:cc:cc:cc:e3:ab:f4:98, ieee=00:12:4b:00:24:c5:90:77, nwk=0xAFAD, device_type=<DeviceType.Router: 1>, rx_on_when_idle=<RxOnWhenIdle.On: 1>, relationship=<RelationShip.Sibling: 2>, reserved1=0, permit_joining=<PermitJoins.Unknown: 2>, reserved2=0, depth=1, lqi=18)])
2022-09-22 13:36:04.742 DEBUG (MainThread) [zigpy.neighbor] [0x73d2] Done scanning. Total 4 neighbours
2022-09-22 14:28:54.085 DEBUG (MainThread) [zigpy.device] [0x73d2] Invalid state on future for 0x37 seq -- probably duplicate response

TommisGR avatar Sep 22 '22 14:09 TommisGR

Can you pair the device again and attach the logs from the pairing process?

javicalle avatar Sep 22 '22 14:09 javicalle

Will do but probably tomorow not at home atm What will I be looking for? (grep example)

TommisGR avatar Sep 22 '22 15:09 TommisGR

I tried the quirk but I got an error:

 File "/config/custom_zha_quirks/ts0601_din_power.py", line 3, in <module>
    class TuyaPowerMeter_GPP(TuyaSwitch):
NameError: name 'TuyaSwitch' is not defined

RealKanashii avatar Sep 22 '22 19:09 RealKanashii

deleted device and cache restarted then added device again new UID grep "0xb6e9" home-assistant.log

2022-09-22 22:59:02.463 DEBUG (MainThread) [bellows.zigbee.application] Received trustCenterJoinHandler frame with [0xb6e9, a4:c1:38:cb:35:b5:0e:3b, <EmberDeviceUpdate.STANDARD_SECURITY_UNSECURED_JOIN: 1>, <EmberJoinDecision.USE_PRECONFIGURED_KEY: 0>, 0x0000]
2022-09-22 22:59:02.465 INFO (MainThread) [zigpy.application] New device 0xb6e9 (a4:c1:38:cb:35:b5:0e:3b) joined the network
2022-09-22 22:59:02.468 DEBUG (MainThread) [zigpy.device] [0xb6e9] Scheduling initialization
2022-09-22 22:59:02.479 INFO (MainThread) [zigpy.device] [0xb6e9] Requesting 'Node Descriptor'
2022-09-22 22:59:02.481 DEBUG (MainThread) [zigpy.device] [0xb6e9] Extending timeout for 0x29 request
2022-09-22 22:59:02.484 DEBUG (MainThread) [bellows.zigbee.application] Extending timeout for a4:c1:38:cb:35:b5:0e:3b/0xb6e9
2022-09-22 22:59:02.497 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_BROADCAST: 4>, EmberApsFrame(profileId=0, clusterId=19, sourceEndpoint=0, destinationEndpoint=0, options=<EmberApsOption.APS_OPTION_NONE: 0>, groupId=0, sequence=32), 180, -55, 0xb6e9, 255, 255, b'\x04\xe9\xb6;\x0e\xb55\xcb8\xc1\xa4\x8e']
2022-09-22 22:59:02.500 INFO (MainThread) [bellows.zigbee.application] ZDO Device announce: 0xb6e9, a4:c1:38:cb:35:b5:0e:3b
2022-09-22 22:59:02.501 INFO (MainThread) [zigpy.application] Device 0xb6e9 (a4:c1:38:cb:35:b5:0e:3b) joined the network
2022-09-22 22:59:02.502 DEBUG (MainThread) [zigpy.device] [0xb6e9] Scheduling initialization
2022-09-22 22:59:02.503 DEBUG (MainThread) [zigpy.device] [0xb6e9] Canceling old initialize call
2022-09-22 22:59:02.505 DEBUG (MainThread) [zigpy.zdo] [0xb6e9:zdo] ZDO request ZDOCmd.Device_annce: [0xB6E9, a4:c1:38:cb:35:b5:0e:3b, 142]
2022-09-22 22:59:02.524 INFO (MainThread) [zigpy.device] [0xb6e9] Requesting 'Node Descriptor'
2022-09-22 22:59:02.526 DEBUG (MainThread) [zigpy.device] [0xb6e9] Extending timeout for 0x2b request
2022-09-22 22:59:02.557 DEBUG (MainThread) [bellows.zigbee.application] Extending timeout for a4:c1:38:cb:35:b5:0e:3b/0xb6e9
2022-09-22 22:59:02.748 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=0, clusterId=32770, sourceEndpoint=0, destinationEndpoint=0, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY|APS_OPTION_RETRY: 320>, groupId=0, sequence=33), 184, -54, 0xb6e9, 255, 255, b'+\x00\xe9\xb6\x01@\x8eA\x11BB\x00\x00*B\x00\x00']
2022-09-22 22:59:02.758 INFO (MainThread) [zigpy.device] [0xb6e9] Got Node Descriptor: NodeDescriptor(logical_type=<LogicalType.Router: 1>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress|RxOnWhenIdle|MainsPowered|FullFunctionDevice: 142>, manufacturer_code=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)
2022-09-22 22:59:02.761 INFO (MainThread) [zigpy.device] [0xb6e9] Discovering endpoints
2022-09-22 22:59:02.875 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=0, clusterId=32773, sourceEndpoint=0, destinationEndpoint=0, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY|APS_OPTION_RETRY: 320>, groupId=0, sequence=34), 184, -54, 0xb6e9, 255, 255, b'-\x00\xe9\xb6\x02\x01\xf2']
2022-09-22 22:59:02.884 INFO (MainThread) [zigpy.device] [0xb6e9] Discovered endpoints: [1, 242]
2022-09-22 22:59:02.885 INFO (MainThread) [zigpy.device] [0xb6e9] Initializing endpoints [<Endpoint id=1 in=[] out=[] status=<Status.NEW: 0>>, <Endpoint id=242 in=[] out=[] status=<Status.NEW: 0>>]
2022-09-22 22:59:02.886 INFO (MainThread) [zigpy.endpoint] [0xb6e9:1] Discovering endpoint information
2022-09-22 22:59:02.989 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=0, clusterId=32772, sourceEndpoint=0, destinationEndpoint=0, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY|APS_OPTION_RETRY: 320>, groupId=0, sequence=35), 180, -55, 0xb6e9, 255, 255, b'/\x00\xe9\xb6\x14\x01\x04\x01Q\x00\x01\x04\x04\x00\x05\x00\x00\xef\x00\x00\x02\x19\x00\n\x00']
2022-09-22 22:59:03.004 INFO (MainThread) [zigpy.endpoint] [0xb6e9:1] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=81, device_version=1, input_clusters=[4, 5, 61184, 0], output_clusters=[25, 10])
2022-09-22 22:59:03.012 INFO (MainThread) [zigpy.endpoint] [0xb6e9:242] Discovering endpoint information
2022-09-22 22:59:03.138 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=0, clusterId=32772, sourceEndpoint=0, destinationEndpoint=0, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY|APS_OPTION_RETRY: 320>, groupId=0, sequence=36), 176, -56, 0xb6e9, 255, 255, b'1\x00\xe9\xb6\n\xf2\xe0\xa1a\x00\x00\x00\x01!\x00']
2022-09-22 22:59:03.154 INFO (MainThread) [zigpy.endpoint] [0xb6e9:242] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=242, profile=41440, device_type=97, device_version=0, input_clusters=[], output_clusters=[33])
2022-09-22 22:59:03.246 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=0, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY|APS_OPTION_RETRY: 320>, groupId=0, sequence=37), 176, -56, 0xb6e9, 255, 255, b'\x183\x01\x04\x00\x00B\x10_TZE200_lsanae15\x05\x00\x00B\x06TS0601']
2022-09-22 22:59:03.269 INFO (MainThread) [zigpy.device] [0xb6e9] Read model 'TS0601' and manufacturer '_TZE200_lsanae15' from <Endpoint id=1 in=[groups:0x0004, scenes:0x0005, None:0xEF00, basic:0x0000] out=[ota:0x0019, time:0x000A] status=<Status.ZDO_INIT: 1>>
2022-09-22 22:59:03.271 INFO (MainThread) [zigpy.device] [0xb6e9] Discovered basic device information for <Device model='TS0601' manuf='_TZE200_lsanae15' nwk=0xB6E9 ieee=a4:c1:38:cb:35:b5:0e:3b is_initialized=True>
2022-09-22 22:59:03.492 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=0, clusterId=32801, sourceEndpoint=0, destinationEndpoint=0, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY|APS_OPTION_RETRY: 320>, groupId=0, sequence=38), 184, -54, 0xb6e9, 255, 255, b'5\x82']
2022-09-22 22:59:03.694 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=0, clusterId=2, sourceEndpoint=0, destinationEndpoint=0, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY|APS_OPTION_RETRY: 320>, groupId=0, sequence=39), 172, -57, 0xb6e9, 255, 255, b'\x05\x00\x00']
2022-09-22 22:59:03.698 DEBUG (MainThread) [zigpy.zdo] [0xb6e9:zdo] ZDO request ZDOCmd.Node_Desc_req: [0x0000]
2022-09-22 22:59:03.699 DEBUG (MainThread) [zigpy.zdo] [0xb6e9:zdo] No handler for ZDO request:ZDOCmd.Node_Desc_req([0x0000])
2022-09-22 22:59:03.811 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_BROADCAST: 4>, EmberApsFrame(profileId=0, clusterId=54, sourceEndpoint=0, destinationEndpoint=0, options=<EmberApsOption.APS_OPTION_NONE: 0>, groupId=0, sequence=42), 168, -58, 0xb6e9, 255, 255, b'\x06\xb4\x01']
2022-09-22 22:59:03.815 DEBUG (MainThread) [zigpy.zdo] [0xb6e9:zdo] ZDO request ZDOCmd.Mgmt_Permit_Joining_req: [180, <Bool.true: 1>]
2022-09-22 22:59:08.827 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=43), 184, -54, 0xb6e9, 255, 255, b'\t\xfd\x11\x05\xfa@']
2022-09-22 22:59:09.128 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=44), 180, -55, 0xb6e9, 255, 255, b'\t\xfd\x11\x05\xfa@']
2022-09-22 22:59:09.239 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=45), 172, -57, 0xb6e9, 255, 255, b'\t\xfd\x11\x05\xfa@']
2022-09-22 22:59:09.440 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=46), 180, -55, 0xb6e9, 255, 255, b'\t\xfd\x11\x05\xfa@']
2022-09-22 22:59:09.633 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=47), 168, -58, 0xb6e9, 255, 255, b'\t\xfd\x11\x05\xfa@']
2022-09-22 22:59:09.848 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=10, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=48), 172, -57, 0xb6e9, 255, 255, b'\x00\xfe\x00\x07\x00']
2022-09-22 22:59:13.450 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=49), 180, -55, 0xb6e9, 255, 255, b'\t\xff\x02\x00\x01\x06\x00\x00\x08\t,\x00\x07!\x00\x01P']
2022-09-22 22:59:13.471 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [9, 44, 0, 7, 33, 0, 1, 80] for attribute 0x0006 (command 0x0002)
2022-09-22 22:59:13.548 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=51), 180, -55, 0xb6e9, 255, 255, b'\t\xff\x02\x00\x01\x06\x00\x00\x08\t,\x00\x07!\x00\x01P']
2022-09-22 22:59:13.576 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=49), 180, -55, 0xb6e9, 255, 255, b'\t\xff\x02\x00\x01\x06\x00\x00\x08\t,\x00\x07!\x00\x01P']
2022-09-22 22:59:13.593 DEBUG (MainThread) [zigpy.device] [0xb6e9] Invalid state on future for 0xff seq -- probably duplicate response
2022-09-22 22:59:13.605 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=50), 180, -55, 0xb6e9, 255, 255, b'\t\xff\x02\x00\x01\x06\x00\x00\x08\t,\x00\x07!\x00\x01P']
2022-09-22 22:59:13.620 DEBUG (MainThread) [zigpy.device] [0xb6e9] Invalid state on future for 0xff seq -- probably duplicate response
2022-09-22 22:59:13.625 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=51), 180, -55, 0xb6e9, 255, 255, b'\t\xff\x02\x00\x01\x06\x00\x00\x08\t,\x00\x07!\x00\x01P']
2022-09-22 22:59:13.639 DEBUG (MainThread) [zigpy.device] [0xb6e9] Invalid state on future for 0xff seq -- probably duplicate response
2022-09-22 22:59:13.644 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=52), 180, -55, 0xb6e9, 255, 255, b'\t\xff\x02\x00\x01\x06\x00\x00\x08\t,\x00\x07!\x00\x01P']
2022-09-22 22:59:13.658 DEBUG (MainThread) [zigpy.device] [0xb6e9] Invalid state on future for 0xff seq -- probably duplicate response
2022-09-22 22:59:13.664 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=53), 180, -55, 0xb6e9, 255, 255, b'\t\xff\x02\x00\x01\x06\x00\x00\x08\t,\x00\x07!\x00\x01P']
2022-09-22 22:59:13.677 DEBUG (MainThread) [zigpy.device] [0xb6e9] Invalid state on future for 0xff seq -- probably duplicate response
2022-09-22 22:59:13.681 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=50), 180, -55, 0xb6e9, 255, 255, b'\t\xff\x02\x00\x01\x06\x00\x00\x08\t,\x00\x07!\x00\x01P']
2022-09-22 22:59:13.694 DEBUG (MainThread) [zigpy.device] [0xb6e9] Invalid state on future for 0xff seq -- probably duplicate response
2022-09-22 22:59:13.716 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=51), 180, -55, 0xb6e9, 255, 255, b'\t\xff\x02\x00\x01\x06\x00\x00\x08\t,\x00\x07!\x00\x01P']
2022-09-22 22:59:13.728 DEBUG (MainThread) [zigpy.device] [0xb6e9] Invalid state on future for 0xff seq -- probably duplicate response
2022-09-22 22:59:13.731 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=52), 180, -55, 0xb6e9, 255, 255, b'\t\xff\x02\x00\x01\x06\x00\x00\x08\t,\x00\x07!\x00\x01P']
2022-09-22 22:59:13.745 DEBUG (MainThread) [zigpy.device] [0xb6e9] Invalid state on future for 0xff seq -- probably duplicate response
2022-09-22 22:59:13.750 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=53), 180, -55, 0xb6e9, 255, 255, b'\t\xff\x02\x00\x01\x06\x00\x00\x08\t,\x00\x07!\x00\x01P']
2022-09-22 22:59:13.764 DEBUG (MainThread) [zigpy.device] [0xb6e9] Invalid state on future for 0xff seq -- probably duplicate response
2022-09-22 22:59:13.769 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=54), 180, -55, 0xb6e9, 255, 255, b'\t\xff\x02\x00\x01\x06\x00\x00\x08\t,\x00\x07!\x00\x01P']
2022-09-22 22:59:13.784 DEBUG (MainThread) [zigpy.device] [0xb6e9] Invalid state on future for 0xff seq -- probably duplicate response
2022-09-22 22:59:13.788 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=55), 180, -55, 0xb6e9, 255, 255, b'\t\xff\x02\x00\x01\x06\x00\x00\x08\t,\x00\x07!\x00\x01P']
2022-09-22 22:59:13.799 DEBUG (MainThread) [zigpy.device] [0xb6e9] Invalid state on future for 0xff seq -- probably duplicate response
2022-09-22 22:59:13.844 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=56), 176, -56, 0xb6e9, 255, 255, b'\t\x00\x02\x00\x02\x01\x02\x00\x04\x00\x00\rK']
2022-09-22 22:59:13.865 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [0, 0, 13, 75] for attribute 0x0201 (command 0x0002)
2022-09-22 22:59:14.039 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=57), 180, -55, 0xb6e9, 255, 255, b'\t\x00\x02\x00\x02\x01\x02\x00\x04\x00\x00\rK']
2022-09-22 22:59:14.143 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=58), 180, -55, 0xb6e9, 255, 255, b'\t\x01\x02\x00\x03\x03\x00\x00\x08\x16\t\x16\t\x00\x00\rK']
2022-09-22 22:59:14.164 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [22, 9, 22, 9, 0, 0, 13, 75] for attribute 0x0003 (command 0x0002)
2022-09-22 22:59:14.375 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=59), 180, -55, 0xb6e9, 255, 255, b'\t\x02\x02\x00\x04\x04\x00\x00\x08\t\x16\t\x16\x00\x00\x02\xc2']
2022-09-22 22:59:14.400 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [9, 22, 9, 22, 0, 0, 2, 194] for attribute 0x0004 (command 0x0002)
2022-09-22 22:59:14.536 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=60), 180, -55, 0xb6e9, 255, 255, b'\t\x03\x02\x00\x05\x0b\x00\x00\x02\x01\x00']
2022-09-22 22:59:14.557 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [1, 0] for attribute 0x000b (command 0x0002)
2022-09-22 22:59:14.741 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=61), 180, -55, 0xb6e9, 255, 255, b'\t\x04\x02\x00\x06\x11\x00\x00\x04\x01\x01\x00P']
2022-09-22 22:59:14.763 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [1, 1, 0, 80] for attribute 0x0011 (command 0x0002)
2022-09-22 22:59:14.894 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=0, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=62), 180, -55, 0xb6e9, 255, 255, b'\x08\x05\n\x01\x00 F\xe2\xff 6\xe4\xff \x00']
2022-09-22 22:59:15.076 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=61184, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=63), 180, -55, 0xb6e9, 255, 255, b'\t\x06\x02\x00\x07\x10\x01\x00\x01\x01\x12\x03\x00\x0822071024']
2022-09-22 22:59:15.098 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [1, 18, 3, 0, 8, 50, 50, 48, 55, 49, 48, 50, 52] for attribute 0x0110 (command 0x0002)
2022-09-22 22:59:15.265 DEBUG (MainThread) [bellows.zigbee.application] Received incomingMessageHandler frame with [<EmberIncomingMessageType.INCOMING_UNICAST: 0>, EmberApsFrame(profileId=260, clusterId=0, sourceEndpoint=1, destinationEndpoint=1, options=<EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY: 256>, groupId=0, sequence=64), 180, -55, 0xb6e9, 255, 255, b'\x08\x07\n\xdf\xffB\x0fS\xa4\xbf*\x132\xa5\xbf*e3\xa5\xbf*\x12']
2022-09-22 23:00:52.495 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [9, 38, 0, 6, 249, 0, 1, 71] for attribute 0x0006 (command 0x0002)
2022-09-22 23:00:52.721 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [0, 0, 13, 76] for attribute 0x0201 (command 0x0002)
2022-09-22 23:02:52.509 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [9, 32, 0, 6, 197, 0, 1, 60] for attribute 0x0006 (command 0x0002)
2022-09-22 23:02:52.675 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [0, 0, 13, 77] for attribute 0x0201 (command 0x0002)
2022-09-22 23:04:52.523 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [9, 33, 0, 6, 198, 0, 1, 61] for attribute 0x0006 (command 0x0002)
2022-09-22 23:04:52.665 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [0, 0, 13, 79] for attribute 0x0201 (command 0x0002)
2022-09-22 23:06:52.499 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [9, 41, 0, 6, 189, 0, 1, 60] for attribute 0x0006 (command 0x0002)
2022-09-22 23:06:52.685 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [0, 0, 13, 80] for attribute 0x0201 (command 0x0002)
2022-09-22 23:08:52.511 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [9, 37, 0, 6, 176, 0, 1, 55] for attribute 0x0006 (command 0x0002)
2022-09-22 23:08:52.648 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [0, 0, 13, 81] for attribute 0x0201 (command 0x0002)
2022-09-22 23:10:52.479 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [9, 45, 0, 6, 168, 0, 1, 54] for attribute 0x0006 (command 0x0002)
2022-09-22 23:10:52.619 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [0, 0, 13, 82] for attribute 0x0201 (command 0x0002)
2022-09-22 23:12:52.500 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [9, 36, 0, 6, 150, 0, 1, 49] for attribute 0x0006 (command 0x0002)
2022-09-22 23:12:52.688 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [0, 0, 13, 83] for attribute 0x0201 (command 0x0002)

TommisGR avatar Sep 22 '22 20:09 TommisGR

I tried the quirk but I got an error:

 File "/config/custom_zha_quirks/ts0601_din_power.py", line 3, in <module>
    class TuyaPowerMeter_GPP(TuyaSwitch):
NameError: name 'TuyaSwitch' is not defined

You need to add the proposed quirk at the bottom of the existing ts0601_din_power.py file:

  • https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts0601_din_power.py

javicalle avatar Sep 22 '22 20:09 javicalle

Thanks, same result that @TommisGR , switch appears, no power metrics.... unknow. Thanks for the effort. My logs:

2022-09-22 23:38:58.668 INFO (MainThread) [zigpy.application] New device 0x8ffa (a4:c1:38:f0:77:0f:4a:6d) joined the network
2022-09-22 23:38:58.669 DEBUG (MainThread) [zigpy.device] [0x8ffa] Scheduling initialization
2022-09-22 23:38:58.671 DEBUG (MainThread) [zigpy.zdo] [0x8ffa:zdo] ZDO request ZDOCmd.Device_annce: [0x8FFA, a4:c1:38:f0:77:0f:4a:6d, 142]
2022-09-22 23:38:58.673 INFO (MainThread) [zigpy.device] [0x8ffa] Requesting 'Node Descriptor'
2022-09-22 23:38:58.673 DEBUG (MainThread) [zigpy.device] [0x8ffa] Extending timeout for 0x42 request
2022-09-22 23:38:58.774 INFO (MainThread) [zigpy.device] [0x8ffa] Got Node Descriptor: NodeDescriptor(logical_type=<LogicalType.Router: 1>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress|RxOnWhenIdle|MainsPowered|FullFunctionDevice: 142>, manufacturer_code=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)
2022-09-22 23:38:58.775 INFO (MainThread) [zigpy.device] [0x8ffa] Discovering endpoints
2022-09-22 23:38:58.905 INFO (MainThread) [zigpy.device] [0x8ffa] Discovered endpoints: [1, 242]
2022-09-22 23:38:58.906 INFO (MainThread) [zigpy.device] [0x8ffa] Initializing endpoints [<Endpoint id=1 in=[] out=[] status=<Status.NEW: 0>>, <Endpoint id=242 in=[] out=[] status=<Status.NEW: 0>>]
2022-09-22 23:38:58.908 INFO (MainThread) [zigpy.endpoint] [0x8ffa:1] Discovering endpoint information
2022-09-22 23:38:59.012 INFO (MainThread) [zigpy.endpoint] [0x8ffa:1] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=81, device_version=1, input_clusters=[4, 5, 61184, 0], output_clusters=[25, 10])
2022-09-22 23:38:59.015 INFO (MainThread) [zigpy.endpoint] [0x8ffa:242] Discovering endpoint information
2022-09-22 23:38:59.129 INFO (MainThread) [zigpy.endpoint] [0x8ffa:242] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=242, profile=41440, device_type=97, device_version=0, input_clusters=[], output_clusters=[33])
2022-09-22 23:38:59.223 INFO (MainThread) [zigpy.device] [0x8ffa] Read model 'TS0601' and manufacturer '_TZE200_lsanae15' from <Endpoint id=1 in=[groups:0x0004, scenes:0x0005, None:0xEF00, basic:0x0000] out=[ota:0x0019, time:0x000A] status=<Status.ZDO_INIT: 1>>
2022-09-22 23:38:59.224 INFO (MainThread) [zigpy.device] [0x8ffa] Discovered basic device information for <Device model='TS0601' manuf='_TZE200_lsanae15' nwk=0x8FFA ieee=a4:c1:38:f0:77:0f:4a:6d is_initialized=True>
2022-09-22 23:39:09.053 DEBUG (MainThread) [zhaquirks.tuya] [0x8ffa:1:0xef00] Received value [8, 248, 0, 12, 139, 0, 2, 143] for attribute 0x0006 (command 0x0002)
2022-09-22 23:39:09.200 DEBUG (MainThread) [zhaquirks.tuya] [0x8ffa:1:0xef00] Received value [0, 0, 0, 170] for attribute 0x0201 (command 0x0002)
2022-09-22 23:39:09.369 DEBUG (MainThread) [zhaquirks.tuya] [0x8ffa:1:0xef00] Received value [22, 9, 22, 9, 0, 0, 0, 170] for attribute 0x0003 (command 0x0002)
2022-09-22 23:39:09.509 DEBUG (MainThread) [zhaquirks.tuya] [0x8ffa:1:0xef00] Received value [9, 23, 9, 23, 0, 0, 0, 170] for attribute 0x0004 (command 0x0002)
2022-09-22 23:39:09.646 DEBUG (MainThread) [zhaquirks.tuya] [0x8ffa:1:0xef00] Received value [1, 0] for attribute 0x000b (command 0x0002)
2022-09-22 23:39:09.798 DEBUG (MainThread) [zhaquirks.tuya] [0x8ffa:1:0xef00] Received value [1, 1, 0, 80] for attribute 0x0011 (command 0x0002)
2022-09-22 23:39:09.967 DEBUG (MainThread) [zhaquirks.tuya] [0x8ffa:1:0xef00] Received value [1, 18, 3, 0, 8, 50, 50, 48, 56, 49, 55, 53, 49] for attribute 0x0110 (command 0x0002)
2022-09-22 23:40:41.070 DEBUG (MainThread) [zhaquirks.tuya] [0x8ffa:1:0xef00] Received value [8, 248, 0, 12, 65, 0, 2, 129] for attribute 0x0006 (command 0x0002)
2022-09-22 23:40:41.212 DEBUG (MainThread) [zhaquirks.tuya] [0x8ffa:1:0xef00] Received value [0, 0, 0, 171] for attribute 0x0201 (command 0x0002)

RealKanashii avatar Sep 22 '22 21:09 RealKanashii

Tell me if you need more logs or test something.

RealKanashii avatar Sep 23 '22 17:09 RealKanashii

The TuyaPowerMeter_GPP quirk definitely doesn't work for your device.

The quirk handles DPs:

TUYA_TOTAL_ENERGY_ATTR = 0x0211
TUYA_CURRENT_ATTR = 0x0212
TUYA_POWER_ATTR = 0x0213
TUYA_VOLTAGE_ATTR = 0x0214
TUYA_DIN_SWITCH_ATTR = 0x0101

And your device seems to make use of DPs (the attribute IDs):

Received value [22, 9, 22, 9, 0, 0, 13, 75] for attribute 0x0003
Received value [9, 22, 9, 22, 0, 0, 2, 194] for attribute 0x0004
Received value [9, 44, 0, 7, 33, 0, 1, 80] for attribute 0x0006
Received value [1, 0] for attribute 0x000b
Received value [1, 1, 0, 80] for attribute 0x0011
Received value [1, 18, 3, 0, 8, 50, 50, 48, 55, 49, 48, 50, 52] for attribute 0x0110
Received value [0, 0, 13, 75] for attribute 0x0201

A new quirk is necessary to be able to make it work. It will be necessary to match the IDs (and data types) with the magnitudes.

javicalle avatar Sep 23 '22 18:09 javicalle

is there a guide or some sort info on how to go about it ourselfs? eg. what the number in the [] of reveived value coresponr to. do we need to change the atttr of the tuya from above to match the ones in the received value?

edit: I made following changing with no joy same as before but I am running blind here :)

TUYA_TOTAL_ENERGY_ATTR = 0x0201 #0x0211
TUYA_CURRENT_ATTR = 0x0003      #0x0212
TUYA_POWER_ATTR = 0x0004        #0x0213
TUYA_VOLTAGE_ATTR = 0x0011      #0x0214
TUYA_DIN_SWITCH_ATTR = 0x000b   #0x0101

TommisGR avatar Sep 23 '22 19:09 TommisGR

If you want to try there is my proposal:

ts0601_din_power_mcu.py
"""Tuya Din Power Meter."""
from typing import Dict

from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
import zigpy.types as t
from zigpy.zcl.clusters.general import Basic, GreenPowerProxy, Groups, Ota, Scenes, Time
from zigpy.zcl.clusters.homeautomation import ElectricalMeasurement
from zigpy.zcl.clusters.smartenergy import Metering

from zhaquirks import LocalDataCluster
from zhaquirks.const import (
    DEVICE_TYPE,
    ENDPOINTS,
    INPUT_CLUSTERS,
    MODELS_INFO,
    OUTPUT_CLUSTERS,
    PROFILE_ID,
)
from zhaquirks.tuya import TuyaManufClusterAttributes
from zhaquirks.tuya.mcu import (
    DPToAttributeMapping,
    TuyaDPType,
    TuyaMCUCluster,
    TuyaOnOff,
)

TUYA_TOTAL_ENERGY_ATTR = 0x0211
TUYA_CURRENT_ATTR = 0x0212
TUYA_POWER_ATTR = 0x0213
TUYA_VOLTAGE_ATTR = 0x0214
TUYA_DIN_SWITCH_ATTR = 0x0101

SWITCH_EVENT = "switch_event"


class TuyaManufClusterDinPower(TuyaManufClusterAttributes):
    """Manufacturer Specific Cluster of the Tuya Power Meter device."""

    attributes = {
        TUYA_TOTAL_ENERGY_ATTR: ("energy", t.uint16_t, True),
        TUYA_CURRENT_ATTR: ("current", t.int16s, True),
        TUYA_POWER_ATTR: ("power", t.uint16_t, True),
        TUYA_VOLTAGE_ATTR: ("voltage", t.uint16_t, True),
        TUYA_DIN_SWITCH_ATTR: ("switch", t.uint8_t, True),
    }

    # def _update_attribute(self, attrid, value):
    #     super()._update_attribute(attrid, value)
    #     if attrid == TUYA_TOTAL_ENERGY_ATTR:
    #         self.endpoint.smartenergy_metering.energy_reported(value / 100)
    #     elif attrid == TUYA_CURRENT_ATTR:
    #         self.endpoint.electrical_measurement.current_reported(value)
    #     elif attrid == TUYA_POWER_ATTR:
    #         self.endpoint.electrical_measurement.power_reported(value / 10)
    #     elif attrid == TUYA_VOLTAGE_ATTR:
    #         self.endpoint.electrical_measurement.voltage_reported(value / 10)
    #     elif attrid == TUYA_DIN_SWITCH_ATTR:
    #         self.endpoint.device.switch_bus.listener_event(
    #             SWITCH_EVENT, self.endpoint.endpoint_id, value
    #         )


class TuyaPowerMeasurement(LocalDataCluster, ElectricalMeasurement):
    """Custom class for power, voltage and current measurement."""

    POWER_ID = 0x050B
    VOLTAGE_ID = 0x0505
    CURRENT_ID = 0x0508

    AC_CURRENT_MULTIPLIER = 0x0602
    AC_CURRENT_DIVISOR = 0x0603

    _CONSTANT_ATTRIBUTES = {AC_CURRENT_MULTIPLIER: 1, AC_CURRENT_DIVISOR: 1000}

    # def voltage_reported(self, value):
    #     """Voltage reported."""
    #     self._update_attribute(self.VOLTAGE_ID, value)

    # def power_reported(self, value):
    #     """Power reported."""
    #     self._update_attribute(self.POWER_ID, value)

    # def current_reported(self, value):
    #     """Ampers reported."""
    #     self._update_attribute(self.CURRENT_ID, value)


class TuyaElectricalMeasurement(LocalDataCluster, Metering):
    """Custom class for total energy measurement."""

    cluster_id = Metering.cluster_id
    CURRENT_ID = 0x0000
    POWER_WATT = 0x0000

    """Setting unit of measurement."""
    _CONSTANT_ATTRIBUTES = {0x0300: POWER_WATT}

    # def energy_reported(self, value):
    #     """Summation Energy reported."""
    #     self._update_attribute(self.CURRENT_ID, value)


class DinPowerManufCluster(TuyaMCUCluster):
    """Tuya Manufacturer Cluster with ContactSwitch Sensor data points."""

    dp_to_attribute: Dict[int, DPToAttributeMapping] = {
        # 1: DPToAttributeMapping(
        #     ContactSwitchCluster.ep_attribute,
        #     "zone_status",
        #     dp_type=TuyaDPType.BOOL,
        #     converter=lambda x: IasZone.ZoneStatus.Alarm_1 if x else 0,
        # ),
        # 2: DPToAttributeMapping(
        #     TuyaPowerConfigurationCluster.ep_attribute,
        #     "battery_percentage_remaining",  # 0x0021
        #     dp_type=TuyaDPType.VALUE,
        # ),
        16: DPToAttributeMapping(
            TuyaOnOff.ep_attribute,
            "on_off",
            dp_type=TuyaDPType.BOOL,
        ),
    }

    data_point_handlers = {
        # 1: "_dp_2_attr_update",
        # 2: "_dp_2_attr_update",
        16: "_dp_2_attr_update",
    }


class TuyaPowerMeter_GPP(CustomDevice):
    """Tuya power meter with GPP device."""

    signature = {
        # "node_descriptor": "<NodeDescriptor byte1=1 byte2=64 mac_capability_flags=142 manufacturer_code=4098
        #                       maximum_buffer_size=82 maximum_incoming_transfer_size=82 server_mask=11264
        #                       maximum_outgoing_transfer_size=82 descriptor_capability_field=0>",
        # device_version=1
        # input_clusters=[0x0000, 0x0004, 0x0005, 0xef00]
        # output_clusters=[0x000a, 0x0019]
        MODELS_INFO: [
            ("_TZE200_lsanae15", "TS0601"),
        ],
        ENDPOINTS: {
            # <SimpleDescriptor endpoint=1 profile=260 device_type=51
            # device_version=1
            # input_clusters=[0, 4, 5, 61184]
            # output_clusters=[10, 25]>
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaManufClusterAttributes.cluster_id,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
            242: {
                # <SimpleDescriptor endpoint=242 profile=41440 device_type=97
                # input_clusters=[]
                # output_clusters=[33]
                PROFILE_ID: 41440,
                DEVICE_TYPE: 97,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
            },
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    DinPowerManufCluster,
                    TuyaPowerMeasurement,
                    TuyaElectricalMeasurement,
                    TuyaOnOff,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
            242: {
                # <SimpleDescriptor endpoint=242 profile=41440 device_type=97
                # input_clusters=[]
                # output_clusters=[33]
                PROFILE_ID: 41440,
                DEVICE_TYPE: 97,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
            },
        }
    }

Delete the previous quirk file and put all the code inside a new file (with a new name). That quirk is not functional but I expect that could get all the info to create a functional one.

With that quirk it's expected to get a full of logs like:

2022-06-25 15:19:25 DEBUG (MainThread) [zigpy.zcl] [0xC958:1:0xef00] Received ZCL frame: b'\t\x97\x02\x00\xdf\x06\x01\x00\x01\x00'
2022-06-25 15:19:25 DEBUG (MainThread) [zigpy.zcl] [0xC958:1:0xef00] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=0, is_reply=1, disable_default_response=0, reserved=0, *is_cluster=True, *is_general=False), tsn=151, command_id=2, *is_reply=True)
2022-06-25 15:19:25 DEBUG (MainThread) [zigpy.zcl] [0xC958:1:0xef00] Decoded ZCL frame: TuyaWindowCoverManufCluster:set_data_response(data=TuyaCommand(status=0, tsn=223, dp=6, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>)))
2022-06-25 15:19:25 DEBUG (MainThread) [zigpy.zcl] [0xC958:1:0xef00] Received command 0x02 (TSN 151): set_data_response(data=TuyaCommand(status=0, tsn=223, dp=6, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>)))
2022-06-25 15:19:25 DEBUG (MainThread) [zigpy.zcl] [0xC958:1:0xef00] No datapoint handler for TuyaCommand(status=0, tsn=223, dp=6, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>))
2022-06-25 15:19:25 WARNING (MainThread) [zigpy.zcl] [0xC958:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=223, dp=6, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x00', *payload=<Bool.false: 0>)))
2022-06-25 15:19:25 DEBUG (MainThread) [zigpy.zcl] [0xC958:1:0xef00] Sending reply header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=False, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=151, command_id=<GeneralCommand.Default_Response: 11>, *is_reply=True)
2022-06-25 15:19:25 DEBUG (MainThread) [zigpy.zcl] [0xC958:1:0xef00] Sending reply: Default_Response(command_id=2, status=<Status.UNSUP_CLUSTER_COMMAND: 129>)

This kind of log (the No 'handle_set_data_response' tuya handler found lines) will tell us:

  • dp=6 the MCU datapoint that report a value
  • dp_type=<TuyaDPType.BOOL: 1> the datapoint type (necessary for the new quirk)
  • payload=<Bool.false: 0> reported value

With that info someone with the device must match the DP with the magnitude (Is the dp=4 the Power value or the Voltage? And the dp=11?). With all that info it will be possible to create the new quirk. Probably there will be a x10 or x100 factor in some magnitudes.

javicalle avatar Sep 23 '22 20:09 javicalle

Testing...

RealKanashii avatar Sep 23 '22 20:09 RealKanashii

Here the log...

2022-09-23 22:26:42.794 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=113, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'/\x04\x00\x00', *payload=1071)))
2022-09-23 22:26:42.859 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=114, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'/\x04\x00\x00', *payload=1071)))
2022-09-23 22:28:42.818 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=116, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'3\x04\x00\x00', *payload=1075)))
2022-09-23 22:28:42.885 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=117, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'3\x04\x00\x00', *payload=1075)))
2022-09-23 22:30:42.783 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=119, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'6\x04\x00\x00', *payload=1078)))
2022-09-23 22:30:42.840 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=120, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'6\x04\x00\x00', *payload=1078)))
2022-09-23 22:32:42.809 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=122, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'9\x04\x00\x00', *payload=1081)))
2022-09-23 22:32:43.087 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=123, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b':\x04\x00\x00', *payload=1082)))
2022-09-23 22:34:42.771 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=125, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'=\x04\x00\x00', *payload=1085)))
2022-09-23 22:34:42.837 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=126, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'=\x04\x00\x00', *payload=1085)))
2022-09-23 22:36:42.791 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=128, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'@\x04\x00\x00', *payload=1088)))
2022-09-23 22:36:42.848 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=129, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'@\x04\x00\x00', *payload=1088)))
2022-09-23 22:38:42.762 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=131, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'D\x04\x00\x00', *payload=1092)))
2022-09-23 22:38:42.820 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=132, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'D\x04\x00\x00', *payload=1092)))
2022-09-23 22:40:42.781 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=134, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'G\x04\x00\x00', *payload=1095)))
2022-09-23 22:40:42.850 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=135, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'G\x04\x00\x00', *payload=1095)))
2022-09-23 22:42:42.800 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=137, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'J\x04\x00\x00', *payload=1098)))
2022-09-23 22:42:42.870 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=138, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'J\x04\x00\x00', *payload=1098)))
2022-09-23 22:44:42.768 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=140, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'N\x04\x00\x00', *payload=1102)))
2022-09-23 22:44:42.844 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=141, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'N\x04\x00\x00', *payload=1102)))
2022-09-23 22:46:42.786 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=143, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'Q\x04\x00\x00', *payload=1105)))
2022-09-23 22:46:42.843 WARNING (MainThread) [zigpy.zcl] [0x8FFA:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=5, tsn=144, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'Q\x04\x00\x00', *payload=1105)))
2022-09-23 22:48:07.826 WARNING (MainThread) [zigpy.zcl] [0x7B96:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=2, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'S\x04\x00\x00', *payload=1107)))
2022-09-23 22:48:07.891 WARNING (MainThread) [zigpy.zcl] [0x7B96:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=3, dp=1, data=TuyaData(dp_type=<TuyaDPType.VALUE: 2>, function=0, raw=b'S\x04\x00\x00', *payload=1107)))
2022-09-23 22:48:15.512 WARNING (MainThread) [zigpy.zcl] [0x7B96:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=14, dp=16, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>)))
2022-09-23 22:48:15.588 WARNING (MainThread) [zigpy.zcl] [0x7B96:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=15, dp=16, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>)))
2022-09-23 22:48:15.669 WARNING (MainThread) [zigpy.zcl] [0x7B96:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=16, dp=16, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>)))

RealKanashii avatar Sep 23 '22 20:09 RealKanashii

Device is reporting only DPs 1 and 16. 🤔

DP16 is some incremental value. Consumed power, uptime, ... DP1 is a boolean. Usually it is a sensor or a switch. Is the current switch in HA working? if its not working try to replace in dp_to_attribute and the data_point_handlers the DP 11 for the 16 and try again. Or even better, switch off and on the device several times and look at the logs, you must be able to match the logs with the events.

Also you can try to unplug and plug again the device. Usually when the device is turned on it reports the status of its attributes.

javicalle avatar Sep 23 '22 22:09 javicalle

DP1-> kWh ( acumulative kWh ) <- For Energy panel I suppose. DP16 -> switch ( on/off)

I think you saw it inverted.... the incremental is DP1 and the boolean DP16. Aren't they?

RealKanashii avatar Sep 23 '22 22:09 RealKanashii

Some guy integrated it to HA via zigbee2mqtt I guess. Seems there are more values than the DP1 & DP16... image

RealKanashii avatar Sep 23 '22 22:09 RealKanashii

I changed the 11 for 1 ( as the incremental value is DP1 no DP16) now I only see the set_data_response from DP16:

Kanashii@casa:/usr/share/hassio/homeassistant $ grep "'handle_set_data_response" home-assistant.log
2022-09-24 01:30:08.620 WARNING (MainThread) [zigpy.zcl] [0x25C0:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=14, dp=16, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>)))
2022-09-24 01:30:08.762 WARNING (MainThread) [zigpy.zcl] [0x25C0:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=15, dp=16, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>)))
2022-09-24 01:30:08.846 WARNING (MainThread) [zigpy.zcl] [0x25C0:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=16, dp=16, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>)))
2022-09-24 01:30:57.365 WARNING (MainThread) [zigpy.zcl] [0x6EE2:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=14, dp=16, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>)))
2022-09-24 01:30:57.439 WARNING (MainThread) [zigpy.zcl] [0x6EE2:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=15, dp=16, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>)))
2022-09-24 01:30:57.517 WARNING (MainThread) [zigpy.zcl] [0x6EE2:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=16, dp=16, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>)))
2022-09-24 01:32:11.653 WARNING (MainThread) [zigpy.zcl] [0xF124:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=14, dp=16, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>)))
2022-09-24 01:32:11.739 WARNING (MainThread) [zigpy.zcl] [0xF124:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=15, dp=16, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>)))
2022-09-24 01:32:11.833 WARNING (MainThread) [zigpy.zcl] [0xF124:1:0xef00] No 'handle_set_data_response' tuya handler found for set_data_response(data=TuyaCommand(status=0, tsn=16, dp=16, data=TuyaData(dp_type=<TuyaDPType.BOOL: 1>, function=0, raw=b'\x01', *payload=<Bool.true: 1>)))

RealKanashii avatar Sep 23 '22 23:09 RealKanashii

Edit: miscoded, I used "on_off" as "ep_attribute" and "TuyaOnOff.ep_attribute". Which must I use?

Using this code I got no handle_set_data_response messages....

 dp_to_attribute: Dict[int, DPToAttributeMapping] = {
        # 1: DPToAttributeMapping(
        #     ContactSwitchCluster.ep_attribute,
        #     "zone_status",
        #     dp_type=TuyaDPType.BOOL,
        #     converter=lambda x: IasZone.ZoneStatus.Alarm_1 if x else 0,
        # ),
        # 2: DPToAttributeMapping(
        #     TuyaPowerConfigurationCluster.ep_attribute,
        #     "battery_percentage_remaining",  # 0x0021
        #     dp_type=TuyaDPType.VALUE,
        # ),
        16: DPToAttributeMapping(
            TuyaOnOff.ep_attribute,
            "on_off",
            dp_type=TuyaDPType.BOOL,
        ),
        1: DPToAttributeMapping(
            TuyaOnOff.ep_attribute,
            "on_off",
            dp_type=TuyaDPType.VALUE,
        )
    }

 data_point_handlers = {
        # 1: "_dp_2_attr_update",
        # 2: "_dp_2_attr_update",
        1: "_dp_2_attr_update",
        16: "_dp_2_attr_update",
    }

But still not seeing consumption (kWh) info. I don't want to use the switch 'cause I will shut down all my house.

RealKanashii avatar Sep 23 '22 23:09 RealKanashii

I think you saw it inverted.... the incremental is DP1 and the boolean DP16. Aren't they?

Yes, they are 🤦🏻‍♂️

It can't be 2 DP mapped to the same cluster (of the same endpoint). Don't worry for now, it can be addressed, just use one or another in the quirk.

You have 3 devices reporting values isn't it?

  • 0x25C0
  • 0x6EE2
  • 0xF124

Put a full trace from one device reporting. There must be something else.

javicalle avatar Sep 24 '22 00:09 javicalle

After trying the above with zha failing to load I put but the 1st changed ts0601_din_power.py deleted cache and restarted now i see this image

1st & 2nd value is constant 3rd is increasing seem to be the total energy consumption since install and greping the device id grep "0xb6e9" home-assistant.log

2022-09-24 08:16:35.492 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0x0000] Attribute id: 4 value: _TZE200_lsanae15
2022-09-24 08:16:35.493 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0x0000] Attribute id: 5 value: TS0601
2022-09-24 08:16:35.508 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0xef00] Attribute id: 4 value: 780
2022-09-24 08:16:37.392 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0x0000] Attribute id: 4 value: _TZE200_lsanae15
2022-09-24 08:16:37.392 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0x0000] Attribute id: 5 value: TS0601
2022-09-24 08:16:37.394 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0x0702] Attribute id: 768 value: 0
2022-09-24 08:16:37.394 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0x0b04] Attribute id: 1539 value: 1000
2022-09-24 08:16:37.395 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0x0b04] Attribute id: 1538 value: 1
2022-09-24 08:16:37.395 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0x0000] Attribute id: 1 value: 70
2022-09-24 08:16:37.396 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0x0000] Attribute id: 65506 value: 54
2022-09-24 08:16:37.397 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0x0000] Attribute id: 65508 value: 0
2022-09-24 08:16:37.397 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0x0000] Attribute id: 65503 value: ���*i���*i���*i���*i
2022-09-24 08:16:37.407 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0xef00] Attribute id: 513 value: 4422
2022-09-24 08:16:37.410 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0x0702] Attribute id: 0 value: 44.22
2022-09-24 08:16:37.411 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0xef00] Attribute id: 4 value: 780
2022-09-24 08:16:37.412 DEBUG (MainThread) [zigpy.appdb] [0xb6e9:1:0x0b04] Attribute id: 1291 value: 78.0
2022-09-24 08:18:49.163 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [8, 247, 0, 51, 145, 0, 11, 204] for attribute 0x0006 (command 0x0002)
2022-09-24 08:18:49.347 DEBUG (MainThread) [zhaquirks.tuya] [0xb6e9:1:0xef00] Received value [0, 0, 17, 116] for attribute 0x0201 (command 0x0002)

TommisGR avatar Sep 24 '22 05:09 TommisGR

If I could get the current power and a way to reset to total I would call it a win :)

TommisGR avatar Sep 24 '22 05:09 TommisGR