How to prevent Aqara Smart Plug power on when "On" is pressed on a Hue Remote?

Hey there,

since 2023.1 I have the following issue with my Aqara Smart Plug (SP-EUC01) and my Philips Hue Dimmer Switch (RWL021)

When the Aqara Smart Plug is off and I press the “On” button on the Hue Dimmer, the Smart Plug turns on, which I don’t want.

In the past 11 months since I’m using the Aqara Smart Plug (I have Hue dimmer round about two years longer), this issue occurred at the beginning, but I had fixed it by installing newer Firmware (ZHA says Firmware: 0x00000029, which is afaik the latest. I also triggered OTA update, but no newer firmware was found or installed).

Is there a way to prevent this issue?

Thanks in advance

A few words about my system:

  • HAOS (9.4) VM on Proxmox
  • HA 2023.1.4
  • SONOFF Zigbee 3.0 USB Dongle Plus with Z-Stack-firmware 20220219

Had a similar problem with my aquara plugs and sonoff buttons, turns out to be a firmware problem described here which can be solved by downgrading the firmware (check bottom of first post)

Since I also use ZHA I then used this guide to apply the modified firmware

I had to use step 4 in the guide and I recommend using the logging configuration to be able to see the progress of the ota transfer (it took quite a while for me).
After waiting a while the plugs just kept flashing red so I repaired them and now they work great!

Mine have reported Firmware: 0x00000029 from the beginning and are still reporting the same after the modified firmware ota update, I think you have to look at “Manager zigbee device” > Clusters > Ota > current_file_version > Read attribute. 41 is the bugged one.

As to why this stopped happening for you and then came back after your update I have no clue but afaik the problem only occurs if the button is routed through the smart plug (which you can see on the network visualization) so maybe it wasn’t routed through your plug before.

Thank you for you reply

I have unfortunately installed FW version 41. Please excuse the stupid question, but how do I downgrade to FW version 32 within HA?

Sorry if I oversee this. There is a lot of linking to other issues. I think a simple how-to would be helpful here on the forum for many perhaps

No worries, I’ll try to give a step by step rundown of how I did it for ZHA using the resources I linked above.

  1. Make sure you really are running the SP-EUC01 (lumi.plug.maeu01) (not the square US version) and keep in mind that although mine came out fine, applying this modified firmware can brick your plug! Do this at your own risk!

  2. Download or build the modified firmware version 32 zip from this comment , the download and build instructions are collapsed (little :arrow_forward: icon).
    Reason: Downgrades are normally not accepted by the plug so this modification tricks the plug into thinking this is a newer version (Just header information, if successful it will report version 32, meaning you can still “upgrade” it back to 41)

  3. Unzip the download and upload it to a new directory inside HA, I placed my .ota file inside of the /config/zigpy_ota directory I created

  4. Modify your configuration.yaml file to include the following:

Required: (change the otau_directory if you chose a different directory)

      otau_directory: /config/zigpy_ota

Optional but recommended:

  default: info
    homeassistant.components.zha: debug
    zigpy: debug
  1. Restart home assistant

  2. If logging has been configured:

  • If you have a terminal via ssh or UI addon use cat /config/home-assistant.log | egrep 'zigpy.ota|zigpy.util|zigpy.*OTA' to check previous progress or tail -f /config/home-assistant.log | egrep 'zigpy.ota|zigpy.util|zigpy.*OTA' to tail new messages which might be related to the ota update.

  • If you don’t have a terminal you can check the full logs in Settings > System > Logs > Load full logs and search for “OTA” or “zigpy” but there might be a lot of unrelated messages.

    If you see many lines ending in some increasing progress value the update started by itself. Skip step 7.
    If the update didn’t start by itself (and mine didn’t either) see step 7.

  1. Manually start the update for each plug: (You can keep the logs open)
    7.1 Navigate to the plug and inside the Zigbee info copy the IEEE number
    7.2 Issue the following command in Developer Tools > Services: (replace the ieee)
service: zha.issue_zigbee_cluster_command
  ieee: 12:34:56:78:12:34:56:78
  endpoint_id: 1
  cluster_type: out
  command_type: client
  cluster_id: 25
  command: 0
    - 0
    - 100

Check the logs again, the ota update should now slowly transfer to the plug. If you didn’t enable logs wait half an hour, the transfer is pretty slow.

  1. After the update mine started to flash red and I had to repair them again (the same way one initially pairs them) but home assistant will recognize them as your existing plugs so your automations shouldn’t be impacted.

  2. Cleanup: Remove or comment out (#) the logging configuration if you don’t want your logs to be spammed by zha and zigpy messages. Remove or move the .ota file so HA doesn’t try to automatically update your plugs in the future since technically the .ota firmware version will always be greater than the reported firmware version.

That’s it! On the plug’s device page you can check “Manager zigbee device” > Clusters > Ota > current_file_version > Read attribute and it should now report 32 :tada:

Hopefully Aqara will fix this issue in the future via some official firmware update but until then I hope my guide helps! :smiley:

Thank you for your reply. idk what I’m doing wrong. Here my steps

  • Open a terminal on Linux machine (notebook with Arch Linux, if relevant)
  • wget
  • unzip
  • rm
  • wget
  • python3
    • import pathlib
    • from zigpy.ota.image import parse_ota_image
    • data = pathlib.Path('OTA_lumi.plug.maeu01_V32_20200922_C11F8A.20200924102946.ota').read_bytes() image, remaining = parse_ota_image(data)
    • assert not remaining
    • image.header.file_version = 42
    • pathlib.Path('OTA_lumi.plug.maeu01_V32_20200922_C11F8A.20200924102946_modded_to_v42.ota').write_bytes(image.serialize())
    • exit()
  • Timestamp of OTA_lumi.plug.maeu01_V32_20200922_C11F8A.20200924102946_modded_to_v42.ota changed to current time
  • uploaded the OTA_lumi.plug.maeu01_V32_20200922_C11F8A.20200924102946_modded_to_v42.ota with changed timestamp via File Editor and triggerd the update

I’ve got this message via terminal

What I’m doing wrong? Thanks and sorry

Seems like your header is still version 32.

But I think you misunderstood my second instruction, you can either
A) Download the modified firmware file provided in the comment by TheJulianJES, provided you trust him
B) Modify the original v32 ota file yourself.
you don’t have to do both!

Or are you trying to compare the files?
In that case I both downloaded the modded version and used the build script and both files ended up being exactly the same.

sha256sum OTA_lumi.plug.maeu01_V32_20200922_C11F8A.20200924102946_modded_to_v42.ota 
67078519a1336af083ec3e2be050743c459e04a9b0ed72e41c58feb7d58068a9  OTA_lumi.plug.maeu01_V32_20200922_C11F8A.20200924102946_modded_to_v42.ota

That being said your build instructions should still have produced a v42 image, was there any Python error?
If your ota file does not produce this very same sha256 hash you likely uploaded the unmodified v32 image to your ota directory