zha-device-handlers: [BUG] Aqara plug (lumi.plug.maeu01) generates errors post-2022.2
Describe the bug I use this plug with HA 2022.2.3, where it’s been updated to use the quirk for lumi.plug.mmeu01 after this pull.
There are errors popping up in the log after this update.
Logger: homeassistant.util.logging
Source: util/logging.py:105
First occurred: 4:34:56 PM (16 occurrences)
Last logged: 4:55:26 PM
Exception in async_state_changed when dispatching 'LUMI lumi.plug.maeu01_54:ef:44:10:00:0e:52:9d_available_entity': () Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/zha/entity.py", line 107, in async_state_changed self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 530, in async_write_ha_state self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 563, in _async_write_ha_state state = self._stringify_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 536, in _stringify_state if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 371, in state value = self.native_value
File "/usr/src/homeassistant/homeassistant/components/zha/sensor.py", line 175, in native_value return self.formatter(raw_state)
File "/usr/src/homeassistant/homeassistant/components/zha/sensor.py", line 472, in formatter return self._channel.summa_formatter(value)
File "/usr/src/homeassistant/homeassistant/components/zha/core/channels/smartenergy.py", line 196, in _formatter_function return self._summa_format.format(value).lstrip() AttributeError: 'NoneType' object has no attribute 'format'
To Reproduce Steps to reproduce the behavior: unknown
Additional context
{
"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"
],
"out_clusters": [
"0x000a",
"0x0019"
]
},
"21": {
"profile_id": 260,
"device_type": "0x0009",
"in_clusters": [
"0x000c"
],
"out_clusters": [
"0x0004",
"0x000c"
]
},
"242": {
"profile_id": 41440,
"device_type": "0x0061",
"in_clusters": [],
"out_clusters": [
"0x0021"
]
}
},
"manufacturer": "LUMI",
"model": "lumi.plug.maeu01",
"class": "zhaquirks.xiaomi.aqara.plug_mmeu01.Plug"
}
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 165
Great now we know what the issue is. Xiaomi devices are such a pain in the ass!
Summation is working as expected.
Happy to help.
OK that will break the other plug… give me a few to push a change to the PR and then can you test it again if you have a few?
@dmulcahey I get mode 0
And the plug measurements are updated as expected
@husjon Hi, but here we are still missing a fundamental sensor: active power, and I’m quite sure a multiplier factor x100 on device temperature.
@dmulcahey …summarizing an unwanted breaking change in 2022.m.r has pushed aqara plug into the “red water”, adding lumi.plug.maeu01 in the quirks models list has not been enough to rescue the plug.
The unknown entity has been unknown for a while, IIRC.
I’ve plugged in an electric heater and nothing happens after a couple of minutes. At 1kW, it should start moving the needle pretty quickly, I guess.
The error is because the
_summa_formatattribute for the smart energy metering cluster isNone. This cluster is not replaced by the quirk from what I can tell so I am unsure how this was working previously. I will try to look at this closer later tonight.Seems like I have the same situation as @Kuinox , mine isn’t working either. No sensors added besides temperature which is incorrect. I do have the latest firmware, linked above. I don’t even see an Opple Cluster for the device so can’t change that.
I have tried to reset the plug around 10 times, do I need to continue - what is the magic number? 20 times? 25?
Perfect, that fixed it. Thanks a lot @dmulcahey !! Now just the temperature isn’t with the right multiplier, but that’s not so much an issue for now
I can confirm the same results as @husjon . I’m currently charging my phone and the values seem to be ok (except temperature). I’m using a custom quirk with the file downloaded from the fix-xiaomi-maeu01 branch
OK if this tracks true we can just remove it for now. Thanks for testing.
@Stefano0042, yep. I was mainly adding my comment as a summary of what was mentioned previously. I’m still hoping for a solution as I mainly bought these plugs for appliance monitoring in addition to the switching.
I haven’t been able to do much troubleshooting lately, but if someone could point me in the right direction I’ll try to assist as needed.
Hi, I purchased 3 of these EU plugs today hoping to monitor a few of my appliances.
I’ve got the following HA setup:
Using
SONOFF ZigBee 3.0After going through all the comments I was able to get the plugs to report summed metering, but that’s it. Following these steps.
Before commenting out
SKIP_CONFIGURATION:After commenting out
SKIP_CONFIGURATION:@cloudbr34k84, let me see if I understand you correctly. Are you saying that you have three “lumi.plug.maeu01” integrated on the latest build of HA; and on which HA version (if you can remember) did you initially start using them? Did you change the quirk or is this how it got configured?
I bought mine quite recently and this is my configuration with a Conbee II:
Hi, normally you can have a chance in Koenkk repository (just click here) 09.2020
@Lampyridae1984 https://developers.home-assistant.io/docs/operating-system/debugging/
@dmulcahey it didn’t do anything for me, apparently.
I have a feeling that it depends a lot on how the plug was initially paired (i.e. what data it exchanged with the coordinator). I say that because neither of my plugs had the signature that the quirk demanded initially, but after multiple pairing attempts, it sort of worked.
I would like to debug this in more detail, but I don’t know exactly how to set things up. @dmulcahey are there any docs/tutorial for setting up and debugging zigpy? I have a bit of experience in software development and debugging, but not with Python. However, I’m willing to give it a go, as long as I can learn a bit about how to set things up.
Here’s something interesting about the other plug (the one that, apparently, DOES report energy consumption): I’ve plugged in the same heater for more than 1/10 of an hour, and the energy consumption (measured in kWh with single decimal precision) has not increased with 0.1kWh, as expected.
More over, here’s the log
which is, basically, the same error as in the originally reported issue.