Push the button – cheap wireless Aqara mini switch
Some actions in a smarthome still need a manual trigger. This is where cheap wireless buttons like the Aqara mini switch come in very handy. Just put a couple of those in the right spots to start a scene or control a light. This is how you can use them with Home Assistant.
The Aqara mini switch
The mini switch from Aqara comes in a couple of different versions that were slightly changed over time. Overall they are all the same though: one small case of around 4,5cm x 4,5cm with one button on top. They use Zigbee for communication and can therefore run for a long time using a CR2032 battery (they claim around 2 years). In contrast to the single/double rocker switches that I already described here these are build more for triggering one action quickly.
With this small form factor and the included tape they can be placed pretty much anywhere in your home, which makes them very handy. They come in a nice unobtrusive white color, unfortunately I was not able to find any other colors.
Consider buying the switches via these affiliate links to support the blog!
Aqara mini switch
Aqara new H1 double switches
Connecting the switch to Home Assistant
Of course the Aqara devices are built to work with their own gateway. For everybody looking for a bit more control fortunately all the Aqara Zigbee product are easily integrated with Home Assistant via ZHA or Zigbee2MQTT. In both cases you only need a cheap computer, like a Raspberry Pi, to serve as your home server. I described such a smarthome server setup in depth before. A cheap Zigbee to USB stick or a Tasmota Wifi to Zigbee bridge can then enable your Home Assistant instance to directly talk to Zigbee devices.
Zigbee2MQTT or ZHA are both great systems that work very well. If you need some help deciding which one to chose read the comparison here. I personally use ZHA right now and described the setup using the smarthome server from above in more detail in this post.
Once you have set up your Home Assistant with ZHA it is pretty easy to connect the Aqara mini switch. Just go to integrations, find the ZHA one and click the “configure” button. In the next screen click “add device” in the bottom right. ZHA should now start scanning for new devices. Now all you need to do is press the small button at the side of the switch for around 5 seconds until the blue LED starts blinking. Your switch should then show up in the ZHA screen.
The pairing process works great most of the times, but once I had a problem with the new device stuck in pairing. Pressing the small button again for 5 seconds and then pressing it repeatedly for just a short time to keep it active fixed the problem.
Finally in the same screen you can chose a better name and move the device to an area for easier management.
Using the mini switch in automations
Using the switch in automations works the same way as other devices connected via ZHA. You just need to listen to the right zha_event. You can use a blueprint like this one (more on how to use blueprints here). Otherwise you can just manually build an automation. Go to developer tools and the events tab. Type in zha_event
and start listening. Then just click the button and you should see a new event.
Note down the device_ieee and/or the unique_id. The command part will show the kind of action. This can be a “single” click, a “double” click or “hold” long click. Some versions have slightly different events. Then just create a new automation and use the event trigger type. It will look like
platform: event
event_type: zha_event
event_data:
device_ieee: 00:15:8d:00:06:36:da:da
unique_id: 00:15:8d:00:06:36:da:da:1:0x0012
command: single
to react to a click from this mini switch.
Automations for the mini switch
You can really use the switch to trigger any action you want to – that is the great thing about smarthome controllers! I use it mainly to trigger more complex actions or scenes. For example there is one right next to the door which I press when I leave. It will turn of all the lights and set my status to away. I could also combine it with my smart robo cleaner for example – endless options here. If you are looking for some more inspiration for automation here are my favorite automations.