dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.89k stars 496 forks source link

Xiaomi Aqara Plug EU lumi.plug.maeu01 shows wrong power values #6372

Closed grimmaldus closed 1 year ago

grimmaldus commented 1 year ago

Describe the bug

Power sensors of Aqara power plugs EU show readings that are 10x higher than actual power consumption.

Steps to reproduce the behavior

Use version deCONZ 2.18.2 with ConBee II fwversion 266B0700.

Expected behavior

Expected value 10x lower than actual.

Screenshots

deconz_aquara_plug

Environment

deCONZ Logs

Additional context

Smanar commented 1 year ago

There is a DDF for this device but only enabled for some versions.

"comment": "DDF for device firmwares at least above 0.0.0_0022, paired with xBee I fw 0x26400500 / xBee II fw 0x266f0700 and above", "matchexpr": "R.endpoints.includes(0x15) && R.endpoints.includes(0x1F)",

Do you have endpoint 0x15 and 0x1F on your ? it's visible on the GUI. Else try direclty to edit the DDF devices\xiaomi\xiaomi_sp-euc01_smart_plug.json

        {
          "name": "state/power",
          "refresh.interval": 10,
          "read": {
            "at": "0x0055",
            "cl": "0x000C",
            "ep": 21,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0055",
            "cl": "0x000C",
            "ep": 21,
            "eval": "Item.val = Math.round(Attr.val);"
          }
        },

replace the "eval" line by "eval": "Item.val = Math.round(Attr.val / 10);"

Smanar commented 1 year ago

Perhaps some infos here https://forum.phoscon.de/t/aqara-powersocket-consumption-issues/2494/5

grimmaldus commented 1 year ago

There is a DDF for this device but only enabled for some versions.

"comment": "DDF for device firmwares at least above 0.0.0_0022, paired with xBee I fw 0x26400500 / xBee II fw 0x266f0700 and above", "matchexpr": "R.endpoints.includes(0x15) && R.endpoints.includes(0x1F)",

Do you have endpoint 0x15 and 0x1F on your ? it's visible on the GUI. Else try direclty to edit the DDF devices\xiaomi\xiaomi_sp-euc01_smart_plug.json

        {
          "name": "state/power",
          "refresh.interval": 10,
          "read": {
            "at": "0x0055",
            "cl": "0x000C",
            "ep": 21,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0055",
            "cl": "0x000C",
            "ep": 21,
            "eval": "Item.val = Math.round(Attr.val);"
          }
        },

replace the "eval" line by "eval": "Item.val = Math.round(Attr.val / 10);"

Thank you, I've already fixed it in similar fashion. I just wanted to report it as a bug since it has been introduced in 2.18.2.

Smanar commented 1 year ago

So the patch is working ?

SwoopX commented 1 year ago

DDF is working as expected, my Sonos SL is consuming 5W

"20:32:57:445": {
        "e": "changed",
        "id": "182",
        "r": "sensors",
        "state": {
            "lastupdated": "2022-10-02T18:32:57.435",
            "power": 5
        },
        "t": "event",
        "uniqueid": "54:ef:44:10:00:4d:da:0e-15-000c"
    }

grafik

grimmaldus commented 1 year ago

So the patch is working ?

My working solution was to alter the value right in the HA for the sensor.

I wanted to do it via ddf file within Home Assistant however there is no mapping for the addon container to this day to my knowledge (if you know any other way how to do it). I will try to locate it right within container and alter it via DDF file and let you know.

manup commented 1 year ago

The wiki has a few remarks for the device in https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Xiaomi-smart-plugs-not-working-correctly from what I understand the plug should work with the DDF when it's updated to the recent OTA firmware. The older Xiaomi firmware is a bit messy.

I'd suggest to also update the ConBee firmware to 0x26780700 as 0x266B0700 is older when the needed one (with a backup first).

Side note: The following PR adds the "known issues" section with a link to this wiki in the DDF in https://github.com/dresden-elektronik/deconz-rest-plugin/pull/6386 to show up in https://dresden-elektronik.github.io/deconz-rest-doc/devices/xiaomi/xiaomi_sp-euc01_smart_plug

erik3rik commented 1 year ago

I have the exact same case, originally reported as a bug of the deCONZ addon to Home Assistant, but since that is only wrapping the deCONZ software the fault is in the underlying deCONZ rather than the addon itself.

https://github.com/home-assistant/addons/issues/2679

Power values increased with a 10x after the update, and was "fixed" by rolling back (to deCONZ 2.17.1 from 2.18.2)

Screenshot 2022-09-24 at 11 48 10

Mimiix commented 1 year ago

@manup so we can close this issue?

carentius commented 1 year ago

All my Aqara Smart Plugs measuring with a factor of 10. Rolling back to 6.15.0 resolve the issue.

grimmaldus commented 1 year ago

@manup so we can close this issue?

I have not have time to test ddf since I'm away from home atm but I will do it this weekend.