Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aquara smart plug (lumi.plug.maeu01) fw.0029 don’t read sensor values (but fw.0020 does) #1952

Closed
AndersWestman opened this issue Nov 21, 2022 · 12 comments

Comments

@AndersWestman
Copy link

Describe the bug
I have an Aquara smart plug (lumi.plug.maeu01) with fw.0020 that is working great since the quirk
zhaquirks.xiaomi.aqara.plug_eu.PlugMAEU01 earlier this year.

Now I have baught a second switch, which I can control as expected, but it will not read back any sensor values. They all show 0 all the time.

I notice two diffences between the “old” and the “new” plug.
Old plug Firmware: 0x00000020
New plug Firmware: 0x00000029

Old plug Sensors: Energy, Power, Electrical_measurement power_factor
New plug Sensors: Active power, Power factor, RMS voltage,Summation delivered

Can someone with the same plug please confirm if this is a problem with the newer firmware, or if I have a faulty unit.

To Reproduce
Steps to reproduce the behavior:

  1. Pair an Aquara smart plug (lumi.plug.maeu01) with fw.0029
  2. Try to read any sensor value
  3. All values are read as 0

Expected behavior
Sensors should be read with correct values

Screenshots
If applicable, add screenshots to help explain your problem.

Device signature
Paste the device signature here.
Don't remove the extra line breaks outside the ``` marks.
Diagnostic information
Paste the diagnostic information here.
Don't remove the extra line breaks outside the ``` marks.
Additional logs
Paste any additional debug logs here.
Don't remove the extra line breaks outside the ``` marks.

Additional context
Add any other context about the problem here.

@javicalle
Copy link
Collaborator

Are the device signature for both devices equals? If they have diferent sensors, probably they have diferent signature.
lumi.plug.maeu01 already have 3 diferents signatures, so another one would not be strange...

@AndersWestman
Copy link
Author

For some reason I'm not allowed to download the diagnostics for the older plug that works well.
The newer, non fully working plug, looks like this:

"data": {
   "ieee": "**REDACTED**",
   "nwk": 38225,
   "manufacturer": "LUMI",
   "model": "lumi.plug.maeu01",
   "name": "LUMI lumi.plug.maeu01",
   "quirk_applied": true,
   "quirk_class": "zhaquirks.xiaomi.aqara.plug_eu.PlugMAEU01",
   "manufacturer_code": 4447,
   "power_source": "Mains",
   "lqi": 175,
   "rssi": -72,
   "last_seen": "2022-11-22T21:42:30",
   "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=4447, maximum_buffer_size=127, maximum_incoming_transfer_size=100, server_mask=11264, 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",
           "0x0002",
           "0x0003",
           "0x0004",
           "0x0005",
           "0x0006",
           "0x0009",
           "0x0702",
           "0x0b04",
           "0xfcc0"
         ],
         "out_clusters": [
           "0x000a",
           "0x0019"
         ]
       },
       "21": {
         "profile_id": 260,
         "device_type": "0x0051",
         "in_clusters": [
           "0x000c"
         ],
         "out_clusters": []
       },
       "242": {
         "profile_id": 41440,
         "device_type": "0x0061",
         "in_clusters": [],
         "out_clusters": [
           "0x0021"
         ]
       }
     }
   },
   "active_coordinator": false,
   "entities": [
     {
       "entity_id": "button.lumi_lumi_plug_maeu01_identify_2",
       "name": "LUMI lumi.plug.maeu01"
     },
     {
       "entity_id": "sensor.lumi_lumi_plug_maeu01_active_power",
       "name": "LUMI lumi.plug.maeu01"
     },
     {
       "entity_id": "sensor.lumi_lumi_plug_maeu01_rms_voltage",
       "name": "LUMI lumi.plug.maeu01"
     },
     {
       "entity_id": "sensor.lumi_lumi_plug_maeu01_power_factor",
       "name": "LUMI lumi.plug.maeu01"
     },
     {
       "entity_id": "sensor.lumi_lumi_plug_maeu01_device_temperature_2",
       "name": "LUMI lumi.plug.maeu01"
     },
     {
       "entity_id": "sensor.lumi_lumi_plug_maeu01_summation_delivered",
       "name": "LUMI lumi.plug.maeu01"
     },
     {
       "entity_id": "switch.lumi_lumi_plug_maeu01_switch",
       "name": "LUMI lumi.plug.maeu01"
     },
     {
       "entity_id": "switch.lumi_lumi_plug_maeu01_power_outage_memory",
       "name": "LUMI lumi.plug.maeu01"
     }
   ],
   "neighbors": [
     {
       "device_type": "Router",
       "rx_on_when_idle": "On",
       "relationship": "Parent",
       "extended_pan_id": "**REDACTED**",
       "ieee": "**REDACTED**",
       "nwk": "0x999A",
       "permit_joining": "Unknown",
       "depth": "1",
       "lqi": "40"
     },
     {
       "device_type": "Router",
       "rx_on_when_idle": "On",
       "relationship": "Sibling",
       "extended_pan_id": "**REDACTED**",
       "ieee": "**REDACTED**",
       "nwk": "0x394C",
       "permit_joining": "Unknown",
       "depth": "2",
       "lqi": "57"
     },
     {
       "device_type": "Router",
       "rx_on_when_idle": "On",
       "relationship": "Sibling",
       "extended_pan_id": "**REDACTED**",
       "ieee": "**REDACTED**",
       "nwk": "0xEB96",
       "permit_joining": "Unknown",
       "depth": "2",
       "lqi": "52"
     },
     {
       "device_type": "Router",
       "rx_on_when_idle": "On",
       "relationship": "Sibling",
       "extended_pan_id": "**REDACTED**",
       "ieee": "**REDACTED**",
       "nwk": "0x1473",
       "permit_joining": "Unknown",
       "depth": "2",
       "lqi": "43"
     },
     {
       "device_type": "Coordinator",
       "rx_on_when_idle": "On",
       "relationship": "Sibling",
       "extended_pan_id": "**REDACTED**",
       "ieee": "**REDACTED**",
       "nwk": "0x0000",
       "permit_joining": "Unknown",
       "depth": "0",
       "lqi": "61"
     },
     {
       "device_type": "Router",
       "rx_on_when_idle": "On",
       "relationship": "Sibling",
       "extended_pan_id": "**REDACTED**",
       "ieee": "**REDACTED**",
       "nwk": "0x175E",
       "permit_joining": "Unknown",
       "depth": "2",
       "lqi": "26"
     },
     {
       "device_type": "Router",
       "rx_on_when_idle": "On",
       "relationship": "Sibling",
       "extended_pan_id": "**REDACTED**",
       "ieee": "**REDACTED**",
       "nwk": "0xD451",
       "permit_joining": "Unknown",
       "depth": "2",
       "lqi": "47"
     },
     {
       "device_type": "Router",
       "rx_on_when_idle": "On",
       "relationship": "Sibling",
       "extended_pan_id": "**REDACTED**",
       "ieee": "**REDACTED**",
       "nwk": "0x4F3D",
       "permit_joining": "Unknown",
       "depth": "2",
       "lqi": "49"
     },
     {
       "device_type": "Router",
       "rx_on_when_idle": "On",
       "relationship": "Sibling",
       "extended_pan_id": "**REDACTED**",
       "ieee": "**REDACTED**",
       "nwk": "0x1E92",
       "permit_joining": "Unknown",
       "depth": "2",
       "lqi": "77"
     },
     {
       "device_type": "Router",
       "rx_on_when_idle": "On",
       "relationship": "Sibling",
       "extended_pan_id": "**REDACTED**",
       "ieee": "**REDACTED**",
       "nwk": "0x4359",
       "permit_joining": "Unknown",
       "depth": "2",
       "lqi": "52"
     },
     {
       "device_type": "Router",
       "rx_on_when_idle": "On",
       "relationship": "Sibling",
       "extended_pan_id": "**REDACTED**",
       "ieee": "**REDACTED**",
       "nwk": "0xA2D3",
       "permit_joining": "Unknown",
       "depth": "2",
       "lqi": "63"
     },
     {
       "device_type": "Router",
       "rx_on_when_idle": "On",
       "relationship": "Sibling",
       "extended_pan_id": "**REDACTED**",
       "ieee": "**REDACTED**",
       "nwk": "0x9914",
       "permit_joining": "Unknown",
       "depth": "2",
       "lqi": "0"
     },
     {
       "device_type": "Router",
       "rx_on_when_idle": "On",
       "relationship": "Sibling",
       "extended_pan_id": "**REDACTED**",
       "ieee": "**REDACTED**",
       "nwk": "0xF57D",
       "permit_joining": "Unknown",
       "depth": "2",
       "lqi": "14"
     },
     {
       "device_type": "Router",
       "rx_on_when_idle": "On",
       "relationship": "Sibling",
       "extended_pan_id": "**REDACTED**",
       "ieee": "**REDACTED**",
       "nwk": "0xED4F",
       "permit_joining": "Unknown",
       "depth": "2",
       "lqi": "38"
     }
   ],
   "endpoint_names": [
     {
       "name": "SMART_PLUG"
     },
     {
       "name": "SMART_PLUG"
     },
     {
       "name": "unknown 97 device_type of 0xa1e0 profile id"
     }
   ],
   "user_given_name": "TestSwitch",
   "device_reg_id": "82ee60ba50d01ef7ddee111b39c2118c",
   "area_id": "datarum",
   "cluster_details": {
     "1": {
       "device_type": {
         "name": "SMART_PLUG",
         "id": 81
       },
       "profile_id": 260,
       "in_clusters": {
         "0x0000": {
           "endpoint_attribute": "basic",
           "attributes": {},
           "unsupported_attributes": {}
         },
         "0x0002": {
           "endpoint_attribute": "device_temperature",
           "attributes": {
             "0x0000": {
               "attribute_name": "current_temperature",
               "value": 30
             }
           },
           "unsupported_attributes": {}
         },
         "0x0003": {
           "endpoint_attribute": "identify",
           "attributes": {},
           "unsupported_attributes": {}
         },
         "0x0004": {
           "endpoint_attribute": "groups",
           "attributes": {},
           "unsupported_attributes": {}
         },
         "0x0005": {
           "endpoint_attribute": "scenes",
           "attributes": {},
           "unsupported_attributes": {}
         },
         "0x0006": {
           "endpoint_attribute": "on_off",
           "attributes": {
             "0x0000": {
               "attribute_name": "on_off",
               "value": 1
             }
           },
           "unsupported_attributes": {
             "0x4003": {
               "attribute_name": "start_up_on_off"
             }
           }
         },
         "0x0009": {
           "endpoint_attribute": "alarms",
           "attributes": {},
           "unsupported_attributes": {}
         },
         "0x0702": {
           "endpoint_attribute": "smartenergy_metering",
           "attributes": {
             "0x0000": {
               "attribute_name": "current_summ_delivered",
               "value": 0
             },
             "0x0300": {
               "attribute_name": "unit_of_measure",
               "value": 0
             },
             "0x0301": {
               "attribute_name": "multiplier",
               "value": 1
             },
             "0x0302": {
               "attribute_name": "divisor",
               "value": 1000
             },
             "0x0303": {
               "attribute_name": "summation_formatting",
               "value": 35
             },
             "0x0306": {
               "attribute_name": "metering_device_type",
               "value": 0
             }
           },
           "unsupported_attributes": {
             "0x0400": {
               "attribute_name": "instantaneous_demand"
             },
             "0x0200": {
               "attribute_name": "status"
             },
             "0x0304": {
               "attribute_name": "demand_formatting"
             }
           }
         },
         "0x0b04": {
           "endpoint_attribute": "electrical_measurement",
           "attributes": {
             "0x0304": {
               "attribute_name": "total_active_power",
               "value": 0
             },
             "0x0402": {
               "attribute_name": "power_multiplier",
               "value": 1
             },
             "0x0403": {
               "attribute_name": "power_divisor",
               "value": 1
             },
             "0x0505": {
               "attribute_name": "rms_voltage",
               "value": 0
             },
             "0x050b": {
               "attribute_name": "active_power",
               "value": 0
             },
             "0x0604": {
               "attribute_name": "ac_power_multiplier",
               "value": 1
             },
             "0x0605": {
               "attribute_name": "ac_power_divisor",
               "value": 10
             }
           },
           "unsupported_attributes": {
             "0x0600": {
               "attribute_name": "ac_voltage_multiplier"
             },
             "0x0601": {
               "attribute_name": "ac_voltage_divisor"
             },
             "0x0602": {
               "attribute_name": "ac_current_multiplier"
             },
             "0x0603": {
               "attribute_name": "ac_current_divisor"
             },
             "0x0401": {
               "attribute_name": "ac_frequency_divisor"
             },
             "0x0400": {
               "attribute_name": "ac_frequency_multiplier"
             },
             "0x0000": {
               "attribute_name": "measurement_type"
             },
             "0x050f": {
               "attribute_name": "apparent_power"
             },
             "0x0508": {
               "attribute_name": "rms_current"
             },
             "0x0507": {
               "attribute_name": "rms_voltage_max"
             },
             "0x050a": {
               "attribute_name": "rms_current_max"
             },
             "0x050d": {
               "attribute_name": "active_power_max"
             },
             "0x0300": {
               "attribute_name": "ac_frequency"
             },
             "0x0302": {
               "attribute_name": "ac_frequency_max"
             }
           }
         },
         "0xfcc0": {
           "endpoint_attribute": "opple_cluster",
           "attributes": {
             "0x0201": {
               "attribute_name": "power_outage_memory",
               "value": 1
             }
           },
           "unsupported_attributes": {}
         }
       },
       "out_clusters": {
         "0x000a": {
           "endpoint_attribute": "time",
           "attributes": {},
           "unsupported_attributes": {}
         },
         "0x0019": {
           "endpoint_attribute": "ota",
           "attributes": {},
           "unsupported_attributes": {}
         }
       }
     },
     "21": {
       "device_type": {
         "name": "SMART_PLUG",
         "id": 81
       },
       "profile_id": 260,
       "in_clusters": {
         "0x000c": {
           "endpoint_attribute": "analog_input",
           "attributes": {},
           "unsupported_attributes": {}
         }
       },
       "out_clusters": {}
     },
     "242": {
       "device_type": {
         "name": "unknown",
         "id": 97
       },
       "profile_id": 41440,
       "in_clusters": {},
       "out_clusters": {
         "0x0021": {
           "endpoint_attribute": "green_power",
           "attributes": {},
           "unsupported_attributes": {}
         }
       }
     }
   }
 }
}

@maverich
Copy link

I also have a similar issue except that I have a working device with firmware 0x00000029 and not working but not reporting any data kind of device with the same version. I think issue is related to some kind of mapping because the entity id given to the working device is sensor.lumi_lumi_plug_maeu01_electricalmeasurement as its but my new not-reporting one has sensor.lumi_lumi_plug_maeu01_active_power. In between my two installations, something has changed but I don't know what yet. If you found any solutions please share here as well :/

@DlargeX
Copy link

DlargeX commented Nov 24, 2022

I have the same problem with firmware 0000029. On/Off is working but Sensors for Power not.

@javicalle
Copy link
Collaborator

javicalle commented Nov 24, 2022

Can any of you test with another quirk?

Enable your local quirk configuration an copy in your folder the current plug_eu.py:

At the bottom of file, add the this quirk:

PlugEU_Var07
class PlugEU_Var07(XiaomiCustomDevice):
    """Aqara plug EU (variant 07)."""

    def __init__(self, *args, **kwargs):
        """Init."""
        self.voltage_bus = Bus()
        self.consumption_bus = Bus()
        self.power_bus = Bus()
        super().__init__(*args, **kwargs)

    signature = {
        MODELS_INFO: [
            (LUMI, "lumi.plug.maeu01"),
        ],
        ENDPOINTS: {
            # "profile_id": 260,
            # "device_type": "0x0051",
            # "in_clusters": ["0x0000","0x0002","0x0003","0x0004","0x0005","0x0006","0x0009","0x0702","0x0b04","0xfcc0"],
            # "out_clusters": ["0x000a","0x0019"]
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    DeviceTemperature.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    Alarms.cluster_id,
                    Metering.cluster_id,
                    ElectricalMeasurement.cluster_id,
                    OppleCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
            # "profile_id": 260,
            # "device_type": "0x0051",
            # "in_clusters": ["0x000c"],
            # "out_clusters": []
            21: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
                INPUT_CLUSTERS: [AnalogInput.cluster_id],
            },
            # "profile_id": 41440,
            # "device_type": "0x0061",
            # "in_clusters": [],
            # "out_clusters": ["0x0021"]
            242: {
                PROFILE_ID: XIAOMI_PROFILE_ID,
                DEVICE_TYPE: XIAOMI_DEVICE_TYPE,
                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
            },
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
                INPUT_CLUSTERS: [
                    BasicCluster,
                    DeviceTemperature.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    Alarms.cluster_id,
                    MeteringCluster,
                    ElectricalMeasurementCluster,
                    OppleCluster,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
            21: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
                INPUT_CLUSTERS: [AnalogInputCluster],
            },
            242: {
                PROFILE_ID: XIAOMI_PROFILE_ID,
                DEVICE_TYPE: XIAOMI_DEVICE_TYPE,
                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
            },
        },
    }

Save changes, delete any __pycache__ folder, restart HA and repair the device.

@AndersWestman
Copy link
Author

Can any of you test with another quirk?

I have tried to test your quirk, but it looks like it is not used.
After restart of HA and re-pairing it still show Quirk: plug_eu.PlugMAEU01 and behave like before.

I have never used a local quirk before, so probebly I have made somthing wrong...

This is what I have done:

  • Created a folder "zha_quirks" under config
  • Created a file named plug_eu.py in the new folder
  • Copied your new quirk into that new, emty file
  • Added the following to my configuration.yalm
zha:
  enable_quirks: true
  custom_quirks_path: /config/zha_quirks
  • Checked the configuration and restarted HA
  • Removed the non working plug and re-pair it
  • The Zigbee info section tells that it still use Quirk: plug_eu.PlugMAEU01

What have I messed up...?

@javicalle
Copy link
Collaborator

Ouuuch, I didn't realized that the signature was already with the quirk loaded 🤦🏻‍♀️
Forget about the custom quirk.

I have read something about the coordinator update. Which Zigbee coordinator do you have?

@AndersWestman
Copy link
Author

I have read something about the coordinator update. Which Zigbee coordinator do you have?

Yes, I recent saw that to. Issue #1897 looks like it covers the same problem.
I use the ConBeeII so it can absolutely be relevant for that update. I'm not sure which firmware I have on the stick, it was bought in October 2021.
Referring to this changelog
it should have some off the latest stabile versions - assuming it was updated then sold...

  • Anyone who knows which firmware version that has this update?
  • Is there any easy way to check which fw-version that is on the stick right now?

However, I will give the update a try, cross my fingers that it not destroy my ZigBee network, and report back the resolut here.

@MattWestb
Copy link
Contributor

MattWestb commented Nov 25, 2022

From: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Firmware-Changelog

0x266b0700 Beta 2021-04-29
Support custom Node Descriptor manufacturer code when requesting device has Xiaomi T1 MAC address prefix

Its also implanted in later first gen adapters in the latest release.
but with deCONZ adapters the latest firmware is recommended.

Edit:
Instruction https://github.com/dresden-elektronik/gcfflasher#run
Win bins is in https://deconz.dresden-elektronik.de/win/

@AndersWestman
Copy link
Author

0x266b0700 Beta 2021-04-29
Support custom Node Descriptor manufacturer code when requesting device has Xiaomi T1 MAC address prefix

Its also implanted in later first gen adapters in the latest release. but with deCONZ adapters the latest firmware is recommended. Look in DE wiki for instructions how doing upgrade in Windows or Linux.

Thanks for pointing that out! I have read through that but totally missed it...

@DlargeX
Copy link

DlargeX commented Nov 25, 2022

Is there a solution now, I have the Sonoff Stick and reading out the values doesn't work?

@AndersWestman
Copy link
Author

AndersWestman commented Nov 25, 2022

After updating the ConBeeII firmware to the today latest version, 26780700, and re-pairing the device, the sensors started to work!
Power (W) worked right away, while voltage and "Summation delivered" (kWh) took a couple of minutes to show up.
Power factor is still unavailable "as usual".
Thanks all for your effort!

Edit:
For me the easiest way to update the firmware was to use a Windows machine, but the workflow is similar for Linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants