Repository: zigpy/zha-device-handlers

Issue:
[Device Support Request]  Tuya Zigbee smart energy meter DDS238-2 Zigbee (_TZE200_byzdayie)
Device description:

https://zigbee.blakadder.com/Hiking_DDS238-2.html

Device signature:

_TZE200_byzdayie TS0601

{
  "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=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, 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"
      ]
    }
  },
  "manufacturer": "_TZE200_byzdayie",
  "model": "TS0601",
  "class": "zigpy.device.Device"
}

Other information:

zigbee-herdsman-converters has this device and description is here:

https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/devices/tuya.js

Line 772

code snippet is:

   {
        fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_byzdayie'},
            {modelID: 'TS0601', manufacturerName: '_TZE200_fsb6zw01'}],
        model: 'TS0601_din',
        vendor: 'TuYa',
        description: 'Zigbee smart energy meter DDS238-2 Zigbee',
        fromZigbee: [fz.tuya_dinrail_switch],
        toZigbee: [tz.tuya_switch_state],
        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(1);
            await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
        },
        exposes: [e.switch().setAccess('state', ea.STATE_SET), e.voltage(), e.power(), e.current(), e.energy()],
    }

Home Assistant detect device but no entities are created.

Logs of discovery process:

------------------------------------------------------------

[0x0000:zdo] ZDO request ZDOCmd.Mgmt_Permit_Joining_req: [60, <Bool.false: 0>]
New device 0xce2e (bc:33:ac:ff:fe:fe:31:26) joined the network
[0xce2e] Scheduling initialization
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCE2E ieee=bc:33:ac:ff:fe:fe:31:26 is_initialized=False> from ep 0 to ep 0, cluster 19: b'\x9f.\xce&1\xfe\xfe\xff\xac3\xbc\x8e'
[0xce2e:zdo] ZDO request ZDOCmd.Device_annce: [0xCE2E, bc:33:ac:ff:fe:fe:31:26, 142]
Tries remaining: 3
[0xce2e] Requesting 'Node Descriptor'
Tries remaining: 2
[0xce2e] Extending timeout for 0x3b request
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCE2E ieee=bc:33:ac:ff:fe:fe:31:26 is_initialized=False> from ep 0 to ep 0, cluster 32770: b';\x00.\xce\x01@\x8e\x02\x10RR\x00\x00,R\x00\x00'
[0xce2e] 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=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, 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)
[0xce2e] Discovering endpoints
Tries remaining: 3
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCE2E ieee=bc:33:ac:ff:fe:fe:31:26 is_initialized=False> from ep 0 to ep 0, cluster 32773: b'=\x00.\xce\x01\x01'
[0xce2e] Discovered endpoints: [1]
[0xce2e] Initializing endpoints [<Endpoint id=1 in=[] out=[] status=<Status.NEW: 0>>]
[0xce2e:1] Discovering endpoint information
Tries remaining: 3
Received frame on uninitialized device <Device model=None manuf=None nwk=0xCE2E ieee=bc:33:ac:ff:fe:fe:31:26 is_initialized=False> from ep 0 to ep 0, cluster 32772: b'?\x00.\xce\x14\x01\x04\x01Q\x00\x01\x04\x00\x00\x04\x00\x05\x00\x00\xef\x02\x19\x00\n\x00'
[0xce2e:1] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=81, device_version=1, input_clusters=[0, 4, 5, 61184], output_clusters=[25, 10])
Unknown cluster 61184
[0xce2e:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=65 command_id=Command.Read_Attributes_rsp>
[0xce2e] Read model 'TS0601' and manufacturer '_TZE200_byzdayie' from <Endpoint id=1 in=[basic:0x0000, groups:0x0004, scenes:0x0005, None:0xEF00] out=[ota:0x0019, time:0x000A] status=<Status.ZDO_INIT: 1>>
[0xce2e] Discovered basic device information for <Device model='TS0601' manuf='_TZE200_byzdayie' nwk=0xCE2E ieee=bc:33:ac:ff:fe:fe:31:26 is_initialized=True>
Device is initialized <Device model='TS0601' manuf='_TZE200_byzdayie' nwk=0xCE2E ieee=bc:33:ac:ff:fe:fe:31:26 is_initialized=True>
Checking quirks for _TZE200_byzdayie TS0601 (bc:33:ac:ff:fe:fe:31:26)
Considering <class 'zhaquirks.xbee.xbee_io.XBeeSensor'>
Fail because endpoint list mismatch: {232, 230} {1}
Considering <class 'zhaquirks.xbee.xbee3_io.XBee3Sensor'>
Fail because endpoint list mismatch: {232, 230} {1}
Considering <class 'zhaquirks.smartthings.tag_v4.SmartThingsTagV4'>
Fail because device_type mismatch on at least one endpoint
Considering <class 'zhaquirks.smartthings.multi.SmartthingsMultiPurposeSensor'>
Fail because device_type mismatch on at least one endpoint
Considering <class 'zhaquirks.netvox.z308e3ed.Z308E3ED'>
Fail because device_type mismatch on at least one endpoint
Considering <class 'zhaquirks.gledopto.soposhgu10.SoposhGU10'>
Fail because endpoint list mismatch: {11, 13} {1}
Considering <class 'bellows.zigbee.application.EZSPCoordinator'>
Fail because device_type mismatch on at least one endpoint
device - 0xCE2E:bc:33:ac:ff:fe:fe:31:26 entering async_device_initialized - is_new_join: True
device - 0xCE2E:bc:33:ac:ff:fe:fe:31:26 has joined the ZHA zigbee network
[0xCE2E](TS0601): started configuration
[0xCE2E:ZDO](TS0601): 'async_configure' stage succeeded
[0xCE2E:1:0x0000]: finished channel configuration
[0xCE2E:1:0x0019]: finished channel configuration
Error handling '_save_attribute' event with (bc:33:ac:ff:fe:fe:31:26, 1, 0, 4, '_TZE200_byzdayie') params: FOREIGN KEY constraint failed
[0xCE2E:1:0x0000]: 'async_configure' stage succeeded
[0xCE2E:1:0x0019]: 'async_configure' stage succeeded
Error handling '_save_attribute' event with (bc:33:ac:ff:fe:fe:31:26, 1, 0, 5, 'TS0601') params: FOREIGN KEY constraint failed
[0xCE2E](TS0601): completed configuration
[0xCE2E](TS0601): stored in registry: ZhaDeviceEntry(name='_TZE200_byzdayie TS0601', ieee='bc:33:ac:ff:fe:fe:31:26', last_seen=1629129941.883796)
[0xCE2E](TS0601): started initialization
[0xCE2E:ZDO](TS0601): 'async_initialize' stage succeeded
[0xCE2E:1:0x0000]: initializing channel: from_cache: False
[0xCE2E:1:0x0000]: finished channel configuration
[0xCE2E:1:0x0019]: initializing channel: from_cache: False
[0xCE2E:1:0x0019]: finished channel configuration
[0xCE2E:1:0x0000]: 'async_initialize' stage succeeded
[0xCE2E:1:0x0019]: 'async_initialize' stage succeeded
[0xCE2E](TS0601): power source: Mains
[0xCE2E](TS0601): completed initialization
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=12 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x13\x01\x01\x00\x01\x01'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=13 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x14\x12\x02\x00\x04\x00\x00\x00\x00'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=13 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x14\x12\x02\x00\x04\x00\x00\x00\x00'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=13 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x14\x12\x02\x00\x04\x00\x00\x00\x00'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e: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=13 command_id=1>
[0xce2e:1:0xef00] Unknown cluster-specific command 1
[0xce2e:1:0xef00] ZCL request 0x0001: b'\x00\x14\x12\x02\x00\x04\x00\x00\x00\x00'
[0xce2e:1:0xef00] No handler for cluster command 1
[0xce2e:1:0xef00] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=0 command_id=36>
[0xce2e:1:0xef00] Unknown cluster-specific command 36
[0xce2e:1:0xef00] ZCL request 0x0024: b'\x00\x03'
[0xce2e:1:0xef00] No handler for cluster command 36
[0xce2e:1:0x000a] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=1 command_id=Command.Read_Attributes>
[0xce2e:1:0x000a] ZCL request 0x0000: [[7]]

------------------------------------------------------------


Discussion:
Hello, I have helped the developers to add support to this device on deCONZ REST-API plugin. Is there anything I can do to help add ZHA support?

https://github.com/dresden-elektronik/deconz-rest-plugin/pull/5287
Hello, I'm new in the quirck creation, and trying to write my own based on examples from this repository.
At first I want to get the power/voltage/current/total information from device.
Here the code of my _ts0601_din_power.py_ file:


`"""Tuya Din Power Meter."""
from zigpy.profiles import zha
from zigpy.zcl.clusters.general import Basic, Groups, Ota, Scenes, Time 
import zigpy.types as t
from zigpy.quirks import CustomDevice
from zhaquirks import Bus, LocalDataCluster
from zigpy.zcl.clusters.homeautomation import ElectricalMeasurement

from zhaquirks.const import (
    DEVICE_TYPE,
    ENDPOINTS,
    INPUT_CLUSTERS,
    MODELS_INFO,
    OUTPUT_CLUSTERS,
    PROFILE_ID,
)
from zhaquirks.tuya import (
    TuyaManufClusterAttributes,
)

TUYA_TOTAL_ENERGY_ATTR = 0x0211
TUYA_CURRENT_ATTR = 0x0212
TUYA_POWER_ATTR = 0x0213
TUYA_VOLTAGE_ATTR = 0x0214

class TuyaManufClusterDinPower(TuyaManufClusterAttributes):
    """Manufacturer Specific Cluster of the Tuya Power Meter device."""

    manufacturer_attributes = {
        TUYA_TOTAL_ENERGY_ATTR: ('total_energy', t.uint16_t),
        TUYA_CURRENT_ATTR: ('current', t.uint16_t),
        TUYA_POWER_ATTR: ('power', t.uint16_t),
        TUYA_VOLTAGE_ATTR: ('voltage', t.uint16_t),
    }

    def _update_attribute(self, attrid, value):
        super()._update_attribute(attrid, value)
        if attrid == TUYA_TOTAL_ENERGY_ATTR:
            self.endpoint.device.total_energy_bus.listener_event(
                "total_energy_reported", value
            )
        elif attrid == TUYA_CURRENT_ATTR:
            self.endpoint.device.current_bus.listener_event(
                "current_reported", value
            )
        elif attrid == TUYA_POWER_ATTR:
            self.endpoint.device.power_bus.listener_event(
                "power_reported", value
            )
        elif attrid == TUYA_VOLTAGE_ATTR:
            self.endpoint.device.voltage_bus.listener_event(
                "voltage_reported", value / 10
            )    

class TuyaTotalEnergyMeasurement(LocalDataCluster,ElectricalMeasurement):
   
    cluster_id = ElectricalMeasurement.cluster_id    
    TOTAL_ID = 0x0304
    VOLTAGE_ID = 0x0100
    POWER_ID = 0x0106
    CURRENT_ID = 0x0103

    def __init__(self, *args, **kwargs):
        """Init."""
        super().__init__(*args, **kwargs)
        self.endpoint.device.total_energy_bus.add_listener(self)
        self.endpoint.device.voltage_bus.add_listener(self)
        self.endpoint.device.power_bus.add_listener(self)
    def total_energy_reported(self,value):
        """Total Energy reported."""
        self._update_attribute(self.TOTAL_ID, value)
    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):
        """Current reported."""
        self._update_attribute(self.CURRENT_ID, value)            


class TuyaPowerMeter(CustomDevice):
    """Tuya power meter device."""

    def __init__(self, *args, **kwargs):
        """Init device."""
        self.total_energy_bus = Bus()
        self.current_bus = Bus()
        self.power_bus = Bus()
        self.voltage_bus = Bus()
        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]
        # <SimpleDescriptor endpoint=1 profile=260 device_type=51 device_version=1 input_clusters=[0, 4, 5, 61184] output_clusters=[10, 25]>
        MODELS_INFO: [
            ("_TZE200_byzdayie", "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,
                    TuyaManufClusterAttributes.cluster_id,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            }
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                DEVICE_TYPE: zha.DeviceType.METER_INTERFACE,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaTotalEnergyMeasurement,
                    TuyaManufClusterDinPower,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            }
        }
    }
`
And here I need any help, because I can't see values visible as entities in HA.
After pairing the device has only one entity:
 
![image](https://user-images.githubusercontent.com/49753351/135747636-98f4fcf2-656a-4e78-9d79-cf6dfed4bd0c.png)

On the cluster page I see values in cluster attributes
![image](https://user-images.githubusercontent.com/49753351/135747729-ebe06c5e-7843-4f93-a7cc-55df9c464abf.png)

... but I stuck on this step, and have no clue what to do the next, how to expose values to HA.

Any help or suggestions is more than appreciated!
FYI, it looks like support for more Zigbee clusters attributes is now being worked on for [ZHA integration](https://www.home-assistant.io/integrations/zha) in Home Assistant core, see:

https://github.com/home-assistant/core/pull/56909

and

https://github.com/home-assistant/core/pull/56666

Also, note the last comment from Adminiuga in PR for ZHA in Home Assistant core -> https://github.com/home-assistant/core/pull/56909

"**_Support for other attributes could be extended later, as I couldn't find too many devices other than Sinopé RM3250ZB Electrical Load Controller – 50A – Zigbee https://www.amazon.com/dp/B07CGJ6XH2/ reporting anything interesting on the electrical measurement cluster._**"

So maybe now you could try to get this working with the latest Home Assistant beta or wait for the next upcoming release:

https://www.home-assistant.io/faq/release/

PS: There is much more discussion about the current ZHA limitation of only supporting 1 sensor per cluster here -> https://github.com/zigpy/zha-device-handlers/issues/605 and https://github.com/zigpy/zha-device-handlers/issues/1045
Hi,
i bought this device. I can help to test it, if you want.

Hi @Celer21 , thank you for your readiness ))
I also have this device, but still the development progress is quite small. Last weekend I finally exposed two values: Current and Power to HA UI, but they appear with the lont names, like "sensor.tze200_byzdayie_ts0601_a9ffc9fe_electrical_measurement" and I didn't find how to make it shorter and more readable.

Because I have access to physical device only during weekend, development of quirk can be slow. And of cause, without support or development guideline this is trial and error method :(
I can share after the next weekend my results for testing, maybe I'll find how to expose the other values also.
Hi @darckly,
long namese are not problem. It can be change in GUI. Another devices have simillar names...
Share your next weekend result and I will be happy to test it. 
I am swiching from z2m to zha and found out that the zha is not support this device.
I am no mean programmer but I am willing to help test it out.
I attached the current quirck for DDS238-2, still not everything is available.
[ts0601_din_power.zip](https://github.com/zigpy/zha-device-handlers/files/7357602/ts0601_din_power.zip)

**The simplest installation for testing**
1. Create "quircks" directory in your /config folder
2. Extract and copy the ts0601_din_power.py file to the /config/quircks directory
3. Add the following into your configuration.yaml
`zha:
  custom_quirks_path: '/config/quircks'`
4. Restart HA
4. Pair your DDS238-2 device

Currently available as entities:
1. the Power value under *_electrical_measurement 
2. the Total Energy value under *_smartenergy_metering_summation_delivered
3. the Switch under *_on_off

Didn't find how to expose the Voltage and Current yet (((
In fact, they appear in the cluster attributes 0x0500 (Voltage) and 0x0502 (Current), but not as entities.
I have exactly the same issue here with a DIY metering board. I can see all the values coming in the log but I cannot expose the entities for voltage and current. I could only see power (W) using the ElectricalMeasurement cluster.
I wonder if there is any workaround to visualize such values maybe not using the ElectricalMeasurement cluster, until official support will be provided in the coming updates.
I found that this is a limitation of ZHA - today is only possible to expose one attribute per cluster. As a workaround, I can write the other values to MQTT server )))))
I also tried to use the PowerConfiguration cluster to expose the Voltage, unfortunately, without success - attributes are filled, but not exposed to UI, no idea why
This limitation no longer exists
Hmm, in this case, looks like I missed something essential. Because I have in ElectricalMeasurement cluster the correct values for Power (0x050B), Voltage (0x0500), and Current (0x0502), but in UI only Power is visible with the cluster name at the end (*_electrical_measurement)
Are you running dev? The support for the additional sensors for electrical measurement was merged after the beta was cut
No, I'm running the stable. Have only one system for home automation.
If this limitation will be removed soon, better I'll wait
I installed the latest dev and it works!
Now both voltage and amps are recognized

```
2021-10-16 16:45:07 DEBUG (MainThread) [homeassistant.components.zha.core.discovery] 'sensor' component -> 'ElectricalMeasurement' using ['electrical_measurement']
2021-10-16 16:45:07 DEBUG (MainThread) [homeassistant.components.zha.core.discovery] 'sensor' component -> 'ElectricalMeasurementRMSCurrent' using ['electrical_measurement']
2021-10-16 16:45:07 DEBUG (MainThread) [homeassistant.components.zha.core.discovery] 'sensor' component -> 'ElectricalMeasurementRMSVoltage' using ['electrical_measurement']
```

<img width="233" alt="state" src="https://user-images.githubusercontent.com/22558340/137594321-5cb4ef7e-8d21-4843-8f14-4db1ec168b1a.PNG">


Here is the quirk I'm testing, hope this can help

https://github.com/glcos/PTVOquirk/blob/main/pzem004t.py

Thank for your quirk @darckly.
I use stable version of HA, so get only two entities. But it better than nothing!



 
@Celer21 sometimes the Total Energy doesn't appear immediatelly, additional HA restart helps. Also, the load must be connected, so the total energy will start increasing.
@glcos excelent news! And thank you for sharing quirk, I'll take a look on it
Just a couple of remarks:

1. it would be nice to add

> 0x0300: ("ac_frequency", t.uint16_t)

> 0x0510: ("power_factor", t.int8s)

as some power related devices such as pzem004t provide those values

2. I would like to have at least one decimal for voltage, power, current. Is there any way to achieve that ?

> Just a couple of remarks:
> 
> 1. it would be nice to add
> 
> > 0x0300: ("ac_frequency", t.uint16_t)
> 
> > 0x0510: ("power_factor", t.int8s)
> 
> as some power related devices such as pzem004t provide those values

FYI, I understand the last comment from Adminiuga in PR for ZHA in Home Assistant core home-assistant/core#56909 the ZHA integration component in Home Assistant core could now be extended with other attributes on the electrical measurement cluster but have not yet so those you either have to code and submit that as a PR to Home Assistant core yourself or post a feature request on the Home Assistant community forum. Only once those are attributes are support by the ZHA component in Home Assistant core can you make quirks for them if available from the device and needed.

"**_Support for other attributes could be extended later, as I couldn't find too many devices other than Sinopé RM3250ZB Electrical Load Controller – 50A – Zigbee https://www.amazon.com/dp/B07CGJ6XH2/ reporting anything interesting on the electrical measurement cluster._**"

For that to happen might need to provide more information to Home Assistant core developers about missing sensors or attributes.



@Hedda thanks for your reply.
I'm already testing a patched version of core dev with these attributes included, and they seem to work, but I need some more testing. I might be raising a PR if my testing is successful.

<img width="259" alt="Entities added" src="https://user-images.githubusercontent.com/22558340/138055932-42d98d48-a9de-4e6c-8630-fc30e9fee71a.png">

Finally, after update HA to version 2021.11, I got all values as sensors.
Quirck for your testing is attached
[ts0601_din_power.zip](https://github.com/zigpy/zha-device-handlers/files/7490394/ts0601_din_power.zip)

![image](https://user-images.githubusercontent.com/49753351/140608886-17953121-e3a4-4333-a83f-cfe3fb210896.png)

Known issues, maybe someone can advise how to solve them:
1. After the first initialization not all sensors are available, after some period you should restart HA, and all sensors will appear
2. After HA restart the switch is OFF, even the device is ON. But it works later

@glcos I see the power factor and frequency parameters on the device LCD screen, but I don't know is the device sent them, and  what manufacturing_attribute read
@darckly Do you have trying taking the power away from the device and putting it back ?
Normally (but not always) tuya DP devices is sending all the DP commands / attribute then the tuya MCU is being restarted and you can getting them in the log if having debug for `zhaquirks: debug`.
The device must being paired so it can sending all the information to the system or its not working.
@darckly if you enable logging you can check whether additional attributes such as Frequency and PF are being sent or not.

This is what I have in my configuration.yaml to check ZigBee logs

```
logger:
  default: warning
  logs:
    homeassistant.components.zha: debug
    bellows.zigbee.application: debug
    zigpy.zcl: debug
    zhaquirks: debug
```

Anyway at this time Frequency and PF are not yet supported by ZHA so you are not going to see them even though your device sends them to HA.

I'm still testing my code and I will put it on my repository so you can test it too.


I have enabled the logging and powered off/on the device. In the log for [zhaquirks.tuya] I see that device is sending the information with using 0x0001, 0x0101, 0x0211, 0x0212, 0x0213 and 0x0214 attributes only.

I suspect that 0x0101 contains the information for switch status (I got [1] in the log, but the switch entity in UI is still OFF...), and the last four attributes are known.
So, looks like no more information from device we can get. 
Unfortunately I don't own this device so I cannot provide additional help 
I solved the issue with the switch state, now it always showed the correct state. Updated quirk is here:
https://github.com/darckly/zha-device-handlers/blob/master/zhaquirks/tuya/ts0601_din_power.py

I checked the log after taking power away and putting back - no information about the commands or attributes was sent.
Summary:
1. Information about voltage, power, current, and switch state the device sends every 30 seconds.
2. Information about total energy device sends after the change

Please test the quirk (who has the device), and if no issues will be found, I'll prepare PR the next weekend
@darckly I have tested the updated quirk.

It is working just find after paring it is not show sensor yet until restart HA agin (known issue).
switch state seems to work correctly and all sensor reading good except the rms current on my physical device show 0.25 A (I am testing with 60w light bulb). I guess it just the rounding down of the number that why it shows 0 on the HA. If that so, your script working perfectly now.
 

![image](https://user-images.githubusercontent.com/6989907/140696150-935883fc-5c00-4e30-8c82-3bb37d2ffa6d.png)

Edited: 

After some time when I turn off the switch in HA and let it off for a while. I notice that the switch status on the HA is turn back on by itself but the physical switch on the device still off. it happens couple of time already.

![image](https://user-images.githubusercontent.com/6989907/140698373-9aacc332-29e9-41b3-a943-7136e0615d93.png)

@darckly Thank you! New version works well. 
As @mrkaqz mrkaqz mentioned, OnOff switch is turning on itself (but HW switch on device is turned off).

For me, it is not problem, I want this device only for power monitoring...
But it would be great, if on off switch stays in correct state.
@mrkaqz I didn't find a way how to show the current with decimals. Maybe @glcos has progress here?

Regarding self-turned-on behaviour: interesting, I'll debug this tomorrow on my device.
Just to double-check the scenario:
1. Device is powered on and switched on
2. You switched off in HA interface, device switched off, red diode lighted up
3. After a few minutes the state of the switch in HA was self-changed to ON but the physical device is still off and the red diode is lighted on the device

Correct?
> @mrkaqz I didn't find a way how to show the current with decimals. Maybe @glcos has progress here?
> 
> Regarding self-turned-on behaviour: interesting, I'll debug this tomorrow on my device. Just to double-check the scenario:
> 
> 1. Device is powered on and switched on
> 2. You switched off in HA interface, device switched off, red diode lighted up
> 3. After a few minutes the state of the switch in HA was self-changed to ON but the physical device is still off and the red diode is lighted on the device
> 
> Correct?

Yes that correct. When it HA state changed itself to ON, the red LED still stay ON on the hardware.

For the decimal, it is not a deal breaker. Since I have test it with just a 1 light bulb. If we install it on the circuit breaker box, the power consumption is much more than a  1 A anyway.
> > @mrkaqz I didn't find a way how to show the current with decimals. Maybe @glcos has progress here?
> > Regarding self-turned-on behaviour: interesting, I'll debug this tomorrow on my device. Just to double-check the scenario:
> > 
> > 1. Device is powered on and switched on
> > 2. You switched off in HA interface, device switched off, red diode lighted up
> > 3. After a few minutes the state of the switch in HA was self-changed to ON but the physical device is still off and the red diode is lighted on the device
> > 
> > Correct?
> 
> Yes that correct. When it HA state changed itself to ON, the red LED still stay ON on the hardware.
> 
> For the decimal, it is not a deal breaker. Since I have test it with just a 1 light bulb. If we install it on the circuit breaker box, the power consumption is much more than a 1 A anyway.

On off switch behave same for me...

I have connected to my AC, so it is pretty big load. But Iam planning buying more DS238 for another appliances, so  consumption with 2 decimals would be better.
The code that is preventing the decimals from being shown is in:

/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/zha/sensor.py

I commented out the lines as per below picture and the decimals are shown.

<img width="543" alt="decimals" src="https://user-images.githubusercontent.com/22558340/140906277-df98f0d6-0700-4669-b6aa-795811be9ae4.png">


Honestly I don't see the point in this code, but that should be discussed with the developers.
It would be good at least to be able to manage this from inside the quirk maybe playing with multiplier and divisor... when I have time I will give it a try.

Did some testing but I could not figure out how to have decimals without touching the original code.
@Adminiuga would you mind checking this ?
I found a way how to show decimals for current (at least one sign after a point)
![image](https://user-images.githubusercontent.com/49753351/141000134-58dddd72-cabe-4657-b90c-215f0e88f607.png)

The quirk is attached
[ts0601_din_power.zip](https://github.com/zigpy/zha-device-handlers/files/7507783/ts0601_din_power.zip)

Regarding the switch state  - still debugging 
I'm puzzled a lot because I see that the device sends only four attributes, and attribute 0x0101 corresponds to the switch state. 
If you are switching between states, the device sends the [0] or [1] almost immediately. But if you switch off the device, I see the message with [0], and during the next push, the device sends [1]. 
So, this is how the device sends the data - may be an issue with firmware... Or I don't understand something.

@diegomontanaduarte do you have the same issue with zibgee2mqtt implementation for this device?
@darckly it's working fine with zigbee2mqtt implementation 


> I found a way how to show decimals for current (at least one sign after a point) ![image](https://user-images.githubusercontent.com/49753351/141000134-58dddd72-cabe-4657-b90c-215f0e88f607.png)
> 
> The quirk is attached [ts0601_din_power.zip](https://github.com/zigpy/zha-device-handlers/files/7507783/ts0601_din_power.zip)
> 
> Regarding the switch state - still debugging

@darckly I have tested this updated quirk. the decimal of the Amp is looking good but somehow the voltage is reading so high. It was correct before on the previous quirk. I am on 220VAC system here.

![image](https://user-images.githubusercontent.com/6989907/141040884-8f95b0db-4e27-4869-97f6-c98c61974be8.png)

Sorry, with voltage my mistake. Now should be fine
[ts0601_din_power.zip](https://github.com/zigpy/zha-device-handlers/files/7509951/ts0601_din_power.zip)


> Sorry, with voltage my mistake. Now should be fine [ts0601_din_power.zip](https://github.com/zigpy/zha-device-handlers/files/7509951/ts0601_din_power.zip)

This looks good for all the sensor now :)
@diegomontanaduarte are you sure that the issue with the switch state is not present on your device?
Today I configured zigbee2mqtt integration just to test this... and after 1 minute the switch was changed to ON, even device was still OFF.

So, for my device, the issue with the switch exists for both, ZHA and Zigbee2Mqtt integrations. I think the issue is with the device firmware.

Resolving patch:
diff --git a/zhaquirks/tuya/ts0601_din_power.py b/zhaquirks/tuya/ts0601_din_power.py
new file mode 100644
--- /dev/null
+++ b/zhaquirks/tuya/ts0601_din_power.py
@@ -0,0 +1,149 @@
+"""Tuya Din Power Meter."""
+from zigpy.profiles import zha
+import zigpy.types as t
+from zigpy.zcl.clusters.general import Basic, Groups, Ota, Scenes, Time
+from zigpy.zcl.clusters.homeautomation import ElectricalMeasurement
+from zigpy.zcl.clusters.smartenergy import Metering
+
+from zhaquirks import Bus, LocalDataCluster
+from zhaquirks.const import (
+    DEVICE_TYPE,
+    ENDPOINTS,
+    INPUT_CLUSTERS,
+    MODELS_INFO,
+    OUTPUT_CLUSTERS,
+    PROFILE_ID,
+)
+from zhaquirks.tuya import TuyaManufClusterAttributes, TuyaOnOff, TuyaSwitch
+
+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."""
+
+    manufacturer_attributes = {
+        TUYA_TOTAL_ENERGY_ATTR: ("energy", t.uint16_t),
+        TUYA_CURRENT_ATTR: ("current", t.int16s),
+        TUYA_POWER_ATTR: ("power", t.uint16_t),
+        TUYA_VOLTAGE_ATTR: ("voltage", t.uint16_t),
+        TUYA_DIN_SWITCH_ATTR: ("switch", t.uint8_t),
+    }
+
+    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, attrid, value)
+
+
+class TuyaPowerMeasurement(LocalDataCluster, ElectricalMeasurement):
+    """Custom class for power, voltage and current measurement."""
+
+    cluster_id = ElectricalMeasurement.cluster_id
+
+    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 TuyaPowerMeter(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_byzdayie", "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],
+            }
+        },
+    }
+
+    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],
+            }
+        }
+    }


Test patch: