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

[Device Support Request] Update for lumi.plug quirk for total energy consumption

Open Brazen00 opened this issue 2 years ago • 5 comments

The Xiaomi smart plug (lumi.plug) is not appearing in the Home Assistant Energy integration under Individual Devices.

See https://github.com/home-assistant/core/issues/59032

According to @Adminiuga "The quirk for lumi plug in zha-device-handlers needs to get updated to provide summation attribute for energy consumed."

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=4447, maximum_buffer_size=127, maximum_incoming_transfer_size=100, server_mask=0, maximum_outgoing_transfer_size=100, 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",
        "0x0001",
        "0x0002",
        "0x0003",
        "0x0004",
        "0x0005",
        "0x0006",
        "0x000a",
        "0x0010",
        "0x0b04"
      ],
      "out_clusters": [
        "0x000a",
        "0x0019"
      ]
    },
    "2": {
      "profile_id": 260,
      "device_type": "0x0009",
      "in_clusters": [
        "0x000c"
      ],
      "out_clusters": [
        "0x0004",
        "0x000c"
      ]
    },
    "3": {
      "profile_id": 260,
      "device_type": "0x0053",
      "in_clusters": [
        "0x000c"
      ],
      "out_clusters": [
        "0x000c"
      ]
    }
  },
  "manufacturer": "LUMI",
  "model": "lumi.plug",
  "class": "zhaquirks.xiaomi.aqara.plug.Plug"
}

Pairing log (hopefully I managed to capture all the relevant info):

2021-11-09 08:16:58 INFO (MainThread) [zigpy_deconz.zigbee.application] New device joined: 0xa5cd, 00:15:8d:00:01:b7:97:df
2021-11-09 08:16:58 INFO (MainThread) [zigpy.application] New device 0xa5cd (00:15:8d:00:01:b7:97:df) joined the network
2021-11-09 08:16:58 DEBUG (MainThread) [zigpy.device] [0xa5cd] Scheduling initialization
2021-11-09 08:16:58 DEBUG (MainThread) [zigpy.application] Received frame on uninitialized device <Device model=None manuf=None nwk=0xA5CD ieee=00:15:8d:00:01:b7:97:df is_initialized=False> from ep 0 to ep 0, cluster 19: b'\xa1\xcd\xa5\xdf\x97\xb7\x01\x00\x8d\x15\x00\x8e'
2021-11-09 08:16:58 DEBUG (MainThread) [zigpy.zdo] [0xa5cd:zdo] ZDO request ZDOCmd.Device_annce: [0xA5CD, 00:15:8d:00:01:b7:97:df, 142]
2021-11-09 08:16:58 DEBUG (MainThread) [zigpy.util] Tries remaining: 3
2021-11-09 08:16:58 INFO (MainThread) [zigpy.device] [0xa5cd] Requesting 'Node Descriptor'
2021-11-09 08:16:58 DEBUG (MainThread) [zigpy.util] Tries remaining: 2
2021-11-09 08:16:58 DEBUG (MainThread) [zigpy.device] [0xa5cd] Extending timeout for 0x30 request
2021-11-09 08:17:02 INFO (MainThread) [homeassistant.components.nmap_tracker] No MAC address found for 192.168.1.133
2021-11-09 08:17:17 ERROR (SyncWorker_2) [homeassistant.components.influxdb] InfluxDB database is not accessible due to '401: {"code":"unauthorized","message":"Unauthorized"}'. Please check that the database, username and password are correct and that the specified user has the correct permissions set. Retrying in 60 seconds.
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.util] Tries remaining: 1
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.device] [0xa5cd] Extending timeout for 0x32 request
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.application] Received frame on uninitialized device <Device model=None manuf=None nwk=0xA5CD ieee=00:15:8d:00:01:b7:97:df is_initialized=False> from ep 0 to ep 0, cluster 32770: b'2\x00\xcd\xa5\x01@\x8e_\x11\x7fd\x00\x00\x00d\x00\x00'
2021-11-09 08:17:26 INFO (MainThread) [zigpy.device] [0xa5cd] 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=4447, maximum_buffer_size=127, maximum_incoming_transfer_size=100, server_mask=0, maximum_outgoing_transfer_size=100, 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)
2021-11-09 08:17:26 INFO (MainThread) [zigpy.device] [0xa5cd] Discovering endpoints
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.util] Tries remaining: 3
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.application] Received frame on uninitialized device <Device model=None manuf=None nwk=0xA5CD ieee=00:15:8d:00:01:b7:97:df is_initialized=False> from ep 0 to ep 0, cluster 32773: b'4\x00\xcd\xa5\x03\x01\x02\x03'
2021-11-09 08:17:26 INFO (MainThread) [zigpy.device] [0xa5cd] Discovered endpoints: [1, 2, 3]
2021-11-09 08:17:26 INFO (MainThread) [zigpy.device] [0xa5cd] Initializing endpoints [<Endpoint id=1 in=[] out=[] status=<Status.NEW: 0>>, <Endpoint id=2 in=[] out=[] status=<Status.NEW: 0>>, <Endpoint id=3 in=[] out=[] status=<Status.NEW: 0>>]
2021-11-09 08:17:26 INFO (MainThread) [zigpy.endpoint] [0xa5cd:1] Discovering endpoint information
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.util] Tries remaining: 3
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.application] Received frame on uninitialized device <Device model=None manuf=None nwk=0xA5CD ieee=00:15:8d:00:01:b7:97:df is_initialized=False> from ep 0 to ep 0, cluster 32772: b'6\x00\xcd\xa5\x1e\x01\x04\x01Q\x00\x01\t\x00\x00\x04\x00\x03\x00\x06\x00\x10\x00\x05\x00\n\x00\x01\x00\x02\x00\x02\x19\x00\n\x00'
2021-11-09 08:17:26 INFO (MainThread) [zigpy.endpoint] [0xa5cd:1] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=81, device_version=1, input_clusters=[0, 4, 3, 6, 16, 5, 10, 1, 2], output_clusters=[25, 10])
2021-11-09 08:17:26 INFO (MainThread) [zigpy.endpoint] [0xa5cd:2] Discovering endpoint information
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.util] Tries remaining: 3
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.application] Received frame on uninitialized device <Device model=None manuf=None nwk=0xA5CD ieee=00:15:8d:00:01:b7:97:df is_initialized=False> from ep 0 to ep 0, cluster 32772: b'8\x00\xcd\xa5\x0e\x02\x04\x01\t\x00\x01\x01\x0c\x00\x02\x0c\x00\x04\x00'
2021-11-09 08:17:26 INFO (MainThread) [zigpy.endpoint] [0xa5cd:2] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=2, profile=260, device_type=9, device_version=1, input_clusters=[12], output_clusters=[12, 4])
2021-11-09 08:17:26 INFO (MainThread) [zigpy.endpoint] [0xa5cd:3] Discovering endpoint information
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.util] Tries remaining: 3
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.application] Received frame on uninitialized device <Device model=None manuf=None nwk=0xA5CD ieee=00:15:8d:00:01:b7:97:df is_initialized=False> from ep 0 to ep 0, cluster 32772: b':\x00\xcd\xa5\x0c\x03\x04\x01S\x00\x01\x01\x0c\x00\x01\x0c\x00'
2021-11-09 08:17:26 INFO (MainThread) [zigpy.endpoint] [0xa5cd:3] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=3, profile=260, device_type=83, device_version=1, input_clusters=[12], output_clusters=[12])
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.zcl] [0xa5cd: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=60 command_id=Command.Read_Attributes_rsp>
2021-11-09 08:17:26 INFO (MainThread) [zigpy.device] [0xa5cd] Read model 'lumi.plug' and manufacturer 'LUMI' from <Endpoint id=1 in=[basic:0x0000, groups:0x0004, identify:0x0003, on_off:0x0006, binary_output:0x0010, scenes:0x0005, time:0x000A, power:0x0001, device_temperature:0x0002] out=[ota:0x0019, time:0x000A] status=<Status.ZDO_INIT: 1>>
2021-11-09 08:17:26 INFO (MainThread) [zigpy.device] [0xa5cd] Discovered basic device information for <Device model='lumi.plug' manuf='LUMI' nwk=0xA5CD ieee=00:15:8d:00:01:b7:97:df is_initialized=True>
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.application] Device is initialized <Device model='lumi.plug' manuf='LUMI' nwk=0xA5CD ieee=00:15:8d:00:01:b7:97:df is_initialized=True>
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.quirks.registry] Checking quirks for LUMI lumi.plug (00:15:8d:00:01:b7:97:df)
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.quirks.registry] Considering <class 'zhaquirks.xiaomi.aqara.plug.Plug'>
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.quirks.registry] Found custom device replacement for 00:15:8d:00:01:b7:97:df: <class 'zhaquirks.xiaomi.aqara.plug.Plug'>
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.discovery] 'sensor' component -> 'ElectricalMeasurement' using ['electrical_measurement']
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.discovery] 'sensor' component -> 'ElectricalMeasurementRMSCurrent' using ['electrical_measurement']
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.discovery] 'sensor' component -> 'ElectricalMeasurementRMSVoltage' using ['electrical_measurement']
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.gateway] device - 0xA5CD:00:15:8d:00:01:b7:97:df entering async_device_initialized - is_new_join: True
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.gateway] device - 0xA5CD:00:15:8d:00:01:b7:97:df has joined the ZHA zigbee network
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0xA5CD](lumi.plug): started configuration
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:ZDO](lumi.plug): 'async_configure' stage succeeded
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:1:0x0006]: skipping channel configuration
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:1:0x0b04]: skipping channel configuration
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:1:0x0000]: skipping channel configuration
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:1:0x0019]: skipping channel configuration
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:2:0x000c]: skipping channel configuration
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:3:0x000c]: skipping channel configuration
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:1:0x0006]: 'async_configure' stage succeeded
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:1:0x0b04]: 'async_configure' stage succeeded
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:1:0x0000]: 'async_configure' stage succeeded
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:1:0x0019]: 'async_configure' stage succeeded
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:2:0x000c]: 'async_configure' stage succeeded
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:3:0x000c]: 'async_configure' stage succeeded
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0xA5CD](lumi.plug): completed configuration
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0xA5CD](lumi.plug): stored in registry: ZhaDeviceEntry(name='LUMI lumi.plug', ieee='00:15:8d:00:01:b7:97:df', last_seen=1636409846.8312185)
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0xA5CD](lumi.plug): started initialization
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:ZDO](lumi.plug): 'async_initialize' stage succeeded
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.appdb] Error handling '_save_attribute' event with (00:15:8d:00:01:b7:97:df, 1, 0, 4, 'LUMI') params: FOREIGN KEY constraint failed
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:1:0x0006]: 'async_initialize' stage succeeded
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:1:0x0b04]: 'async_initialize' stage succeeded
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:1:0x0000]: 'async_initialize' stage succeeded
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:1:0x0019]: 'async_initialize' stage succeeded
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:2:0x000c]: 'async_initialize' stage succeeded
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:3:0x000c]: 'async_initialize' stage succeeded
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0xA5CD](lumi.plug): power source: Mains
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0xA5CD](lumi.plug): completed initialization
2021-11-09 08:17:26 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.zha entity: sensor.lumi_lumi_plug_df97b701_electrical_measurement
2021-11-09 08:17:26 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.zha entity: sensor.lumi_lumi_plug_df97b701_electrical_measurement_rms_current
2021-11-09 08:17:26 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.zha entity: sensor.lumi_lumi_plug_df97b701_electrical_measurement_rms_voltage
2021-11-09 08:17:26 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.zha entity: sensor.lumi_lumi_plug_df97b701_analog_input
2021-11-09 08:17:26 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.zha entity: sensor.lumi_lumi_plug_df97b701_analog_input_2
2021-11-09 08:17:26 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:1:0x0006]: attempting to update onoff state - from cache: False
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.appdb] Error handling '_save_attribute' event with (00:15:8d:00:01:b7:97:df, 1, 0, 5, 'lumi.plug') params: FOREIGN KEY constraint failed
2021-11-09 08:17:26 DEBUG (MainThread) [zigpy.zcl] [0xa5cd:1:0x0006] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=62 command_id=Command.Read_Attributes_rsp>
2021-11-09 08:17:26 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.zha entity: switch.lumi_lumi_plug_df97b701_on_off
2021-11-09 08:17:31 DEBUG (MainThread) [zigpy.zcl] [0xa5cd:1:0x000a] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=False disable_default_response=True> manufacturer=None tsn=124 command_id=Command.Read_Attributes>
2021-11-09 08:17:31 DEBUG (MainThread) [zigpy.zcl] [0xa5cd:1:0x000a] ZCL request 0x0000: [[0]]
2021-11-09 08:17:33 INFO (MainThread) [homeassistant.components.nmap_tracker] No MAC address found for 192.168.1.133
2021-11-09 08:17:44 DEBUG (MainThread) [zigpy.zcl] [0xa5cd:2:0x000c] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=138 command_id=Command.Report_Attributes>
2021-11-09 08:17:44 DEBUG (MainThread) [zigpy.zcl] [0xa5cd:2:0x000c] ZCL request 0x000a: [[Attribute(attrid=85, value=<TypeValue type=Single, value=48.619998931884766>)]]
2021-11-09 08:17:44 DEBUG (MainThread) [zigpy.zcl] [0xa5cd:2:0x000c] Attribute report received: present_value=48.619998931884766
2021-11-09 08:17:49 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0xA5CD:1:0x0b04]: async_update
2021-11-09 08:17:49 DEBUG (MainThread) [zigpy.appdb] Error handling '_unsupported_attribute_added' event with (00:15:8d:00:01:b7:97:df, 1, 2820, 1293) params: FOREIGN KEY constraint failed
2021-11-09 08:17:49 DEBUG (MainThread) [zigpy.appdb] Error handling '_unsupported_attribute_added' event with (00:15:8d:00:01:b7:97:df, 1, 2820, 1288) params: FOREIGN KEY constraint failed
2021-11-09 08:17:49 DEBUG (MainThread) [zigpy.appdb] Error handling '_unsupported_attribute_added' event with (00:15:8d:00:01:b7:97:df, 1, 2820, 1290) params: FOREIGN KEY constraint failed
2021-11-09 08:17:49 DEBUG (MainThread) [zigpy.appdb] Error handling '_unsupported_attribute_added' event with (00:15:8d:00:01:b7:97:df, 1, 2820, 1285) params: FOREIGN KEY constraint failed
2021-11-09 08:17:49 DEBUG (MainThread) [zigpy.appdb] Error handling '_unsupported_attribute_added' event with (00:15:8d:00:01:b7:97:df, 1, 2820, 1287) params: FOREIGN KEY constraint failed

Brazen00 avatar Nov 08 '21 22:11 Brazen00

Any update on this?

erik-de-neve avatar Nov 29 '21 15:11 erik-de-neve

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

github-actions[bot] avatar May 28 '22 15:05 github-actions[bot]

Have updated and am confirming that this plug still doesn't work.

hacshacdgacs avatar May 30 '22 13:05 hacshacdgacs

yes still not working

tias2001 avatar Aug 03 '22 00:08 tias2001

Please fix this. Energy consumption is a very important part of this device and we don't want to loose it in ZHA. Zigbee2mqtt has it, but I like ZHA for its stability.

SpeedFire0 avatar Aug 16 '22 18:08 SpeedFire0

Same issue here. Did you find a fix?

cobch avatar Jan 03 '23 18:01 cobch

I did not, I've been slowly replacing this device because of this issue

On Wed, 4 Jan 2023, 07:58 cobch, @.***> wrote:

Same issue here. Did you find a fix?

— Reply to this email directly, view it on GitHub https://github.com/zigpy/zha-device-handlers/issues/1135#issuecomment-1370119283, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUMWJOGE4PJWG4CNG24356LWQRZGTANCNFSM5HT3LCHA . You are receiving this because you commented.Message ID: @.***>

hacshacdgacs avatar Jan 03 '23 19:01 hacshacdgacs

Alternativ is to switch to Z2m? I see... I have just received the SkyConnect but did not see any support yet on z2m. Maybe I should wait in that case since I want to switch from deconz to something more futur proof...

cobch avatar Jan 03 '23 20:01 cobch

My hub doesn't allow me to use ZigBee2Mqtt so unfortunately that's not an option for me

On Wed, 4 Jan 2023, 09:22 cobch, @.***> wrote:

Alternativ is to switch to Z2m? I see... I have just received the SkyConnect but did not see any support yet on z2m. Maybe I should wait in that case since I want to switch from deconz to something more futur proof...

— Reply to this email directly, view it on GitHub https://github.com/zigpy/zha-device-handlers/issues/1135#issuecomment-1370190139, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUMWJOH4KUFXW2ROX6Q6W2LWQSC7RANCNFSM5HT3LCHA . You are receiving this because you commented.Message ID: @.***>

hacshacdgacs avatar Jan 03 '23 20:01 hacshacdgacs

Please post the diagnostic information from a lumi.plug that has been plugged in for some time with a load attached. Also, is the "current power consumption" working and it's just the "total power consumption" that's missing?

I have just received the SkyConnect but did not see any support yet on z2m.

It's experimental support but you just need to set the adapter type to "ezsp".

TheJulianJES avatar Jan 04 '23 04:01 TheJulianJES

image Attached is an image that shows the sensors I can see. zha-15ab6f75612ea7563bff7a66500abca9-LUMI lumi.plug-c9dd4f08acd91871e2f7c5411c386d1b.json.txt And the text file is the diagnostics report from a plug I've had connected to my dishwasher for over a month now.

hacshacdgacs avatar Jan 04 '23 04:01 hacshacdgacs

The "0.4" seems to be a power consumption of "0.4 W", right? And is "130.7" the total energy consumption? (So does that value only ever increase?)

If so, we'd just need to put the values on a LocalDataCluster (energy and metering).

Also, what's the binary input sensor for the plug doing?

TheJulianJES avatar Jan 04 '23 05:01 TheJulianJES

That value only ever increases, yes. I assume the binary sensor is the power for the plug (on-off)

On Wed, 4 Jan 2023, 18:30 TheJulianJES, @.***> wrote:

The "0.4" seems to be a power consumption of "0.4 W", right? And is "130.7" the total energy consumption? (So does that value only ever increase?)

If so, we'd just need to put the values on a LocalDataCluster (energy and metering).

Also, what's the binary input sensor for the plug doing?

— Reply to this email directly, view it on GitHub https://github.com/zigpy/zha-device-handlers/issues/1135#issuecomment-1370505134, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUMWJOD3T5THBMMJMKP5IS3WQUDI5ANCNFSM5HT3LCHA . You are receiving this because you commented.Message ID: @.***>

hacshacdgacs avatar Jan 04 '23 05:01 hacshacdgacs

Does the second AnalogInput automatically increase (when the attached device is powered on) or does it only update on HA restarts?

TheJulianJES avatar Jan 04 '23 06:01 TheJulianJES

Both analog inputs only update when HomeAssistant restarts, and the binary input is not tied into whether or not the switch is on (currently running a dishwasher cycle and the binary input still says off)

On Wed, 4 Jan 2023, 19:39 TheJulianJES, @.***> wrote:

Does the second AnalogInput automatically increase (when the attached device is powered on) or does it only update on HA restarts?

— Reply to this email directly, view it on GitHub https://github.com/zigpy/zha-device-handlers/issues/1135#issuecomment-1370538793, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUMWJOFKBKQGNZC3N2YUP5DWQULLHANCNFSM5HT3LCHA . You are receiving this because you commented.Message ID: @.***>

hacshacdgacs avatar Jan 04 '23 06:01 hacshacdgacs

Can you use the "reconfigure this device" option for the plug and see if one or both AnalogInputs then update without restarting?

(At least the first one might need a power change of like 10W)

TheJulianJES avatar Jan 04 '23 07:01 TheJulianJES

No luck, device reconfiguration fails and the inputs don't update. image

hacshacdgacs avatar Jan 04 '23 08:01 hacshacdgacs

Download

Please try this custom quirk: TJJ_lumi_plug_test_v3.zip EDIT: Updated to v3

Install Instructions

In your configuration.yaml, you might need to define the following if you don't have it already:

zha:
  custom_quirks_path: /config/zha_custom_quirks

This assumes you're running Home Assistant OS (points to /config).

Then, put the tjj_lumi_plug_v3 folder in that zha_custom_quirks folder, reboot HA, and then re-pair the plugs! (This is important)

In the end, the folder structure should look like this: /config/zha_custom_quirks/tjj_lumi_plug_v3 The last folder should contain two files: __init__.py and plug.py

More Info

(Make sure you re-paired the plug!) (It's possible that you even need to remove the plug from ZHA and then re-add it)

Let me know what works with this quirk and what doesn't (if values update and so on).

If the total power consumption (i. e. the second AnalogInputCluster) never updates, try uncommenting the commented lines in the plug.py file (marked withUNCOMMENT BELOW TO TEST 2nd PART OF POSSIBLE FIX): Then, restart HA. A re-pairing shouldn't be necessary here.

TheJulianJES avatar Jan 14 '23 01:01 TheJulianJES

Okay so enabling this zha: custom_quirks_path: /config/zha_custom_quirks in my config causes my Zigbee network to crash.

image

hacshacdgacs avatar Jan 15 '23 14:01 hacshacdgacs

Ah yeah, (remove it for now). I'll fix it soon-ish

TheJulianJES avatar Jan 15 '23 14:01 TheJulianJES

Please try this: ~~TJJ_lumi_plug_test_v2.zip~~

EDIT: Check newer posts for v3 version

TheJulianJES avatar Jan 15 '23 17:01 TheJulianJES

Okay now the first analog input is updating but the second even with the possible fix is still refusing to update. (image showing the values of the first) [image: image.png]

On Mon, 16 Jan 2023 at 06:38, TheJulianJES @.***> wrote:

Please try this: TJJ_lumi_plug_test_v2.zip https://github.com/zigpy/zha-device-handlers/files/10420799/TJJ_lumi_plug_test_v2.zip

— Reply to this email directly, view it on GitHub https://github.com/zigpy/zha-device-handlers/issues/1135#issuecomment-1383208789, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUMWJOFTSMRTTEHHXMC5HHLWSQYYVANCNFSM5HT3LCHA . You are receiving this because you commented.Message ID: @.***>

hacshacdgacs avatar Jan 15 '23 21:01 hacshacdgacs

Images apparently aren't sent correctly via email. (Can you send it again using GitHub directly?) And just to confirm, you tried removing the plug from HA and re-pairing it while the "v2 quirk" is installed?

Also, what coordinator do you have (and what firmware)?

TheJulianJES avatar Jan 15 '23 22:01 TheJulianJES

updated quirk, restarted HA, removed device, re-paired.

without 2nd part enabled, minimal load (xiaomi bedside lamp powered, but lamp off): image

without 2nd part enabled, higher load (xiaomi bedside lamp on): image

without 2nd part enabled, higher load after 5 minutes (xiaomi bedside lamp on) - no change on second analogue input image

WITH 2nd part enabled, higher load (xiaomi bedside lamp on) enabled: image

WITH 2nd part enabled, higher load (xiaomi bedside lamp on) enabled, after one hour: image

jonwaland avatar Jan 16 '23 01:01 jonwaland

Please try this: TJJ_lumi_plug_test_v3.zip

You'll need to re-pair the plug again though. A new sensor for the total consumption should show up. (The AnalogInput sensors can be ignored then). Let me know if the total consumption sensor updates properly (without adding back the commented code for now).

I've also increased the logging to warning of Xiaomi attribute reports for that plug, so you'll (hopefully) see some logs containing: DEBUG TJJ QUIRK. These are expected (please send them here).

TheJulianJES avatar Jan 16 '23 09:01 TheJulianJES

Will be another 12 hours before I can test. But will do.

Do I need to uncomment TO TEST 2nd PART OF POSSIBLE FIX ?

jonwaland avatar Jan 16 '23 10:01 jonwaland

Test it without uncommenting that part first. (You can try to uncomment it later, but I doubt it'll help anyway)

TheJulianJES avatar Jan 16 '23 10:01 TheJulianJES

updated quirk, restarted HA, removed device, re-paired.

without 2nd part enabled, minimal load (xiaomi bedside lamp powered, but lamp off): image

without 2nd part enabled, maxload (xiaomi bedside lamp powered, and lamp on full brightness): image

without 2nd part enabled, maxload (xiaomi bedside lamp powered, and lamp on full brightness) - 13 minutes later - summation delivered has increased. image

debug:

2023-01-17 14:56:04.678 WARNING (MainThread) [lumi2] 00:15:8d:00:02:8b:71:cf - (DEBUG TJJ QUIRK) Attribute report. attribute_id: [65281] value: [{'0xff01-100': <Bool.false: 0>, 'temperature': 25, 'power': 0.0, 'consumption': 11.694486618041992, 'voltage': 2380, 'X-attrib-5': 51, '0xff01-154': 16, '0xff01-8': 4886, '0xff01-7': 0, '0xff01-9': 512}]
2023-01-17 15:01:47.622 WARNING (MainThread) [lumi2] 00:15:8d:00:02:8b:71:cf - (DEBUG TJJ QUIRK) Attribute report. attribute_id: [65281] value: [{'0xff01-100': <Bool.true: 1>, 'temperature': 39, 'power': 5.296999931335449, 'consumption': 11.694499969482422, 'voltage': 2380, 'X-attrib-5': 51, '0xff01-154': 0, '0xff01-8': 4886, '0xff01-7': 0, '0xff01-9': 512}]
2023-01-17 15:06:52.621 WARNING (MainThread) [lumi2] 00:15:8d:00:02:8b:71:cf - (DEBUG TJJ QUIRK) Attribute report. attribute_id: [65281] value: [{'0xff01-100': <Bool.true: 1>, 'temperature': 39, 'power': 13.088000297546387, 'consumption': 11.69559097290039, 'voltage': 2380, 'X-attrib-5': 51, '0xff01-154': 0, '0xff01-8': 4886, '0xff01-7': 0, '0xff01-9': 512}]
2023-01-17 15:13:54.615 WARNING (MainThread) [lumi2] 00:15:8d:00:02:8b:71:cf - (DEBUG TJJ QUIRK) Attribute report. attribute_id: [65281] value: [{'0xff01-100': <Bool.true: 1>, 'temperature': 39, 'power': 13.088000297546387, 'consumption': 11.697200775146484, 'voltage': 2380, 'X-attrib-5': 51, '0xff01-154': 0, '0xff01-8': 4886, '0xff01-7': 0, '0xff01-9': 512}]

jonwaland avatar Jan 17 '23 04:01 jonwaland

So "active power", "summation delivered", and "voltage" are updating correctly now (without restarting HA)?

(Ignore power factor and AnalogInput sensors)

TheJulianJES avatar Jan 17 '23 06:01 TheJulianJES

yes - active power, summation delivered, and voltage appear to be correctly updating (Note that I restarted HA as part of redoing the quirk)

image image image

(summation is increasing, but the graph scale hides it) image

jonwaland avatar Jan 17 '23 06:01 jonwaland