<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Home Assistant on totoroot's blog</title><link>https://blog.thym.at/tags/home-assistant/</link><description>Recent content in Home Assistant on totoroot's blog</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Wed, 18 Feb 2026 23:59:00 +0200</lastBuildDate><atom:link href="https://blog.thym.at/tags/home-assistant/index.xml" rel="self" type="application/rss+xml"/><item><title>Aqara Shutter Switch H2: From ZHA Events to a Blueprint</title><link>https://blog.thym.at/p/aqara-h2-zha-blueprint/</link><pubDate>Wed, 18 Feb 2026 23:59:00 +0200</pubDate><guid>https://blog.thym.at/p/aqara-h2-zha-blueprint/</guid><description>&lt;h1 id="aqara-shutter-switch-h2-from-zha-events-to-a-blueprint"&gt;Aqara Shutter Switch H2: From ZHA Events to a Blueprint
&lt;/h1&gt;&lt;h2 id="how-we-got-there"&gt;How we got there?
&lt;/h2&gt;&lt;p&gt;I picked up the Aqara Shutter Switch H2 EU for a roller shutter, expecting it to work out of the box with ZHA.
The shutter control worked, but the two additional “wireless” buttons were nowhere to be found.&lt;/p&gt;
&lt;p&gt;I could open and close the cover, but I could not trigger automations from the extra buttons.
That is where the journey began.&lt;/p&gt;
&lt;h2 id="step-1-understand-what-zha-sees"&gt;Step 1: Understand what ZHA sees
&lt;/h2&gt;&lt;p&gt;The first step was to watch raw device events. In Home Assistant, that means listening for &lt;code&gt;zha_event&lt;/code&gt; and pressing the buttons.
The device was sending events, but only as single presses.
Double and hold events were not showing.&lt;/p&gt;
&lt;p&gt;That pointed to the multi‑click mode not being enabled.
The device was probably emitting different attribute values, but ZHA was not interpreting them.&lt;/p&gt;
&lt;h2 id="step-2-get-the-quirk-loaded"&gt;Step 2: Get the quirk loaded
&lt;/h2&gt;&lt;p&gt;I wrote a custom quirk and placed it under custom_zha_quirks. It loaded, but the first pass failed because my quirk used a newer zha-quirks API than the version shipped with my Home Assistant.&lt;/p&gt;
&lt;p&gt;After aligning the code to the version I had installed, the quirk loaded correctly. I verified it by looking for the &lt;code&gt;Checking quirks for Aqara lumi.switch.aeu003&lt;/code&gt; log entries and by observing entities created by the quirk.&lt;/p&gt;
&lt;h2 id="step-3-make-the-extra-buttons-usable"&gt;Step 3: Make the extra buttons usable
&lt;/h2&gt;&lt;p&gt;Once the quirk loaded, the additional endpoints appeared, but events still only showed single clicks.
The key change was enabling the multi‑click attribute on the manufacturer cluster.
With that on, I started seeing 3_double, 3_hold, 3_release, and the equivalent for button 4.&lt;/p&gt;
&lt;p&gt;To enable multi‑click reporting, I wrote the manufacturer‑specific multi‑click attribute directly on the Aqara cluster via ZHA’s service call.
This flips the device into a mode where it emits *_double, *_hold, and *_release events instead of only *_single.
In Home Assistant, I did this from &lt;code&gt;Developer Tools&lt;/code&gt; → &lt;code&gt;Services&lt;/code&gt; using:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;action: zha.issue_zigbee_cluster_command
data:
ieee: &amp;#34;54:ef:44:10:01:3e:3d:b5&amp;#34;
endpoint_id: 3
cluster_id: 0xFCC0
command_type: &amp;#34;client&amp;#34;
manufacturer: 0x115F
command: 2
args:
- 0x0286
- 0x20
- 2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;At that point I had enough signal to build automations.&lt;/p&gt;
&lt;h2 id="step-4-control-a-cover-properly"&gt;Step 4: Control a cover properly
&lt;/h2&gt;&lt;p&gt;There was a bigger problem, though. The cover UI in Home Assistant kept greying out.
It was acting as if the cover was always moving, or at end position when it was not.&lt;/p&gt;
&lt;p&gt;We tried mapping a raw “position” attribute.
It turned out to be a counter that only incremented on button events, not an absolute position.
That meant it could not be used as a reliable end stop.&lt;/p&gt;
&lt;p&gt;The solution was to avoid pretending we had perfect position and instead focus on reliable open, close, and stop behaviour.
We also kept the raw position value only as a diagnostic sensor and made it disabled by default.&lt;/p&gt;
&lt;h2 id="step-5-design-the-button-behaviour"&gt;Step 5: Design the button behaviour
&lt;/h2&gt;&lt;p&gt;After the device was stable, I mapped button 3 and 4 to a consistent model in an automation:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Single click toggles a light.&lt;/li&gt;
&lt;li&gt;Double click runs a custom action.&lt;/li&gt;
&lt;li&gt;Hold dims or brightens, depending on mode.&lt;/li&gt;
&lt;li&gt;Release stops dimming.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Two issues had to be dealt with here:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Hold behaviour intially caused flickering.
The initial implementation toggled direction on every loop, which caused the light to jump between on and off.
I added two helper booleans to store the current hold direction per button.
This avoids flickering.&lt;/li&gt;
&lt;li&gt;I noticed that aggressive intervals can flood the Zigbee protocol and can cause disconnects.
I added a minimum interval, a maximum hold duration, and a warning in the logbook when settings are too aggressive.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="step-6-build-a-blueprint"&gt;Step 6: Build a blueprint
&lt;/h2&gt;&lt;p&gt;Once the behaviour worked in automations, I turned it into a blueprint so it can be reused.&lt;/p&gt;
&lt;p&gt;The blueprint allows fo:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Choosing lights for button 3 and button 4&lt;/li&gt;
&lt;li&gt;Choosing custom actions for double‑clicks&lt;/li&gt;
&lt;li&gt;Configuring hold step and interval&lt;/li&gt;
&lt;li&gt;Setting a maximum hold duration, with 0 meaning no limit&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is much easier to share and re-use than a raw automation.&lt;/p&gt;
&lt;h2 id="step-7-create-the-repository"&gt;Step 7: Create the repository
&lt;/h2&gt;&lt;p&gt;With a working blueprint, the next step was to package it properly in a dedicated repository.&lt;/p&gt;
&lt;p&gt;The README is split into two sections: Blueprint and Custom ZHA quirk. The quirk section is a placeholder for now as it is not yet finalized, but the blueprint side is fully documented.&lt;/p&gt;
&lt;p&gt;&lt;a class="link" href="https://codeberg.org/totoroot/home-assistant-aqara-shutter-switch-h2" target="_blank" rel="noopener"
&gt;Codeberg Repo&lt;/a&gt;
&lt;a class="link" href="https://github.com/totoroot/home-assistant-aqara-shutter-switch-h2" target="_blank" rel="noopener"
&gt;GitHub Repo&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="design-choices-recap"&gt;Design choices recap
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Use zha_event as the truth rather than trying to interpret derived entities.&lt;/li&gt;
&lt;li&gt;Keep rate limiting in mind because Zigbee devices can be overwhelmed easily.&lt;/li&gt;
&lt;li&gt;Expose double‑click as a custom action since it is often user specific.&lt;/li&gt;
&lt;li&gt;Use helpers for hold direction to avoid flicker.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="the-repo"&gt;The repo
&lt;/h2&gt;&lt;p&gt;It now contains:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The blueprint: blueprints/automation/aqara-multifunction-shutter-switch-h2.yaml&lt;/li&gt;
&lt;li&gt;A README with setup instructions and helper definitions&lt;/li&gt;
&lt;li&gt;A place for the custom quirk to live next&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="closing-thoughts"&gt;Closing thoughts
&lt;/h2&gt;&lt;p&gt;This started as “why do my buttons not show up” and ended in a reusable blueprint and a clean repository. The main lesson was that ZHA gives you enough signal, but only if you listen to the right events and avoid over‑interpreting unreliable attributes.&lt;/p&gt;
&lt;p&gt;I will add the finished quirk next so the device can be set up end‑to‑end and will also &lt;a class="link" href="https://github.com/zigpy/zha-device-handlers/pull/4769" target="_blank" rel="noopener"
&gt;contribute the custom quirk to the community repo&lt;/a&gt;.&lt;/p&gt;</description></item></channel></rss>