[DRIVER] Aqara H2 US 2-Button 1-Channel Switch (lumi.switch.agl004 / agl009)

Hi all,

I've been trying to get the Aqara H2 US 2-Button 1-Channel switch working properly on Hubitat and couldn't find a driver that handled this specific device well, so I ended up writing one. Sharing it here in case it helps others.

GitHub: hubitat-drivers/AqaraH2Switch.groovy at main · krazik/hubitat-drivers · GitHub

Supported devices:

  • lumi.switch.agl004 (Aqara H2 US 2-Button 1-Channel, WS-K02E)
  • lumi.switch.agl009 (Aqara H2 EU 2-Button 1-Channel, WS-K07E)

What works:

  • On/Off relay control (top button, endpoint 01)
  • Button 1 events (top button): pushed, held, doubleTapped
  • Button 3 events (bottom/wireless button): pushed, held, doubleTapped
  • Top button LED control via Aqara FCC0 cluster: disable-at-night and flip indicator logic
  • Health check with configurable interval
  • No child devices created — all events reported on parent

Button mapping quirk worth knowing:
The bottom button reports as button 3, not button 2. This appears to be how the hardware exposes it over Zigbee. In Rule Machine or Button Controller, trigger on Button 3 pushed/held/doubleTapped for the bottom button.

Prerequisites — important:
This device ships in Thread mode. You must switch it to Zigbee mode using the Aqara Home app (free, no Aqara hub required — just Bluetooth on your phone). Hard reset the device first by pressing any button 10 times, then the app will auto-discover it and let you select Zigbee as the protocol. After that you can delete the app.

Known limitation:
The bottom button LED (wireless endpoint) cannot be independently controlled. This is a confirmed firmware limitation from Aqara — see LED on the wireless button in H2 switches - Developer Hub - Aqara Forum. The LED blinks on button press but its idle state cannot be set programmatically.

Based on prestonbrown's AqaraZigbeeDimmer driver as a starting point. Happy to take feedback or PRs on GitHub.

2 Likes