Using The Aqara Cube With HomeKit

If you’re one of those people that, for better or worse, has decided to take the plunge and bought into the Aqara side of HomeKit integration, with the hub and assorted ‘child devices’ like their temperature, door and motion sensors, for example, then you may also be aware of the Aqara ‘Cube’. If you aren’t, then basically it is, as the name implies, a cube, which can act as a controller for other Aqara, Mijia or Yeelight devices. It acts based on an internal accelerometer that registers different movements, so you can create automations based on a variety of different ‘motions’ – flip the cube 90°, flip it 180°, push it, rotate it, shake it, tap it twice, or if motion is detected after 1 minute. Pretty, pretty good.

Now, this all sounds great, but in actual fact, this kind of device isn’t currently supported in the HomeKit framework, so how can I use it with my HomeKit devices? Well, with a little ingenuity, you can use it to control a device or a scene, but you’re going to need a few basics in place, which I’ll outline below, but I should point out that unfortunately, this method will only work in the Aqara app, and with an Aqara hub ‘binded’ to the app. So as it stands, if you’re using the Mi Home app, as far as I can tell, this procedure isn’t possible, all due to the fact that you can’t currently create a scene in the Mi Home app that specifies the colour or brightness of the light in the hub, which is necessary for the method I’ll be outlining.

You’ll need the following;

  • Aqara hub – connected to the Aqara app
  • Aqara app – signed in to Mainland China with an account
  • Aqara Cube
  • Eve HomeKit app (or other apps that allow for more granular control)

The process is quite simple, but as an outline, the process is;

  1. Create a scene in the Aqara with the Aqara hub night light
  2. Create an automation in the Aqara app, with the Aqara Cube to trigger the scene
  3. Get a HomeKit based scene to be enacted when certain parameters in the Aqara hub are enabled.

Section #1 – Creating a scene in the Aqara app
Now assuming you’ve got all of the above and have added the Aqara Cube, we start off in the Aqara app.

  • Open the Aqara app. You’ll see the Aqara Hub and Cube. create a ‘scene’ by clicking on the ‘Scene’ tab
  • The Scene page will probably say ‘No Scenes’, so click on ‘Create’ and create your first Scene
  • you’ll then see a page to add an ‘Action’. Click Add
  • Select the Aqara hub, which then takes you to a list of options
  • Choose the ‘Adjusts night light brightness’ option, which opens an option for adjusting the brightness
  • I’ve selected 5% as the preferred brightness, but feel free to choose what you want, although it won’t be on for long anyway
  • Once you’ve selected your preferred brightness level, you have a complete scene
  • you can then add an icon if you wish (not necessary)
  • Then name the scene while saving it

Section #2 – Creating an automation for the Cube to trigger the scene
We’ve now created a preset ‘scene’ in the app, where the hub night light will be set to 5%, but now we want to use the Aqara cube to trigger that scene.

  • To create your automation, click the ‘Automation’ tab at the bottom of the screen
  • You then get an ‘IF-THEN’ page. Click on ‘Add’ in the ‘IF’ section
  • In the ‘IF’ section, select the Aqara Cube
  • Selected the specific motion that will trigger the scene we created – I have chosen ‘Flip 90°’
  • After you’ve made your selection, click on ‘Add’ in the ‘THEN’ section
  • From the list of options, choose ‘Scene’
  • Select the scene you previously created – in this case, ‘hub 5 pc’
  • Another page will appear with just one option – Run – select this and you’ll return to the ‘IF-THEN’ section
  • You can go ahead and name this automation, although there are still some additions to be made

Essentially what you’ve created so far is an automation that when the Aqara Cube is flipped by 90°, the Aqara hub night light will turn on at 5% brightness. However, we have to create additional steps in the automation in order for the eventual ‘HomeKit’ scene to work on each occasion, so…

With the Aqara app, you can place additional actions or scenes to the initial ‘THEN’ action, so in this case, after the scene is triggered, I’ve…

  • added a 1-second delay
  • then a simple automation to set the hub night light to 50% brightness
  • then another delay of 1 second
  • before a final action that will turn the night light off.

I’ll explain why this would seem necessary at the end of this tutorial, so for now, bear with me. That’s it for the Aqara app side of things, so now we move over to the Eve app.

Section #3 – Creating a ‘Rule’ in Eve that will trigger a HomeKit automation

First off, you do need to have created a scene of your own, and in the example here, I already had a scene for my bedroom lights to be at 100%, with the scene named ‘Lights Bright’, so make sure you’ve either got the scene created or create one before you proceed.

  • Open the Eve app, click on the ‘Scenes’ tab at the bottom, then click on the ‘Rules’ tab at the top.
  • Scroll down until you get to the last of any scenes or ‘Rules’ as they’re called in the Eve app, and click on ‘Add Rule’
  • You’ll be presented with a screen that shows the process of the automation – Trigger > Conditions > Scenes. Click Next
  • You’ll then have a screen where you need to add your ‘trigger’, so click on ‘Add Trigger’
  • Then you’ll see a list with sections, listed as ‘accessory’, ‘location’ and ‘time’.
  • In the ‘Accessory’ list, click on ‘Other Value’, then scroll to the room your hub is located in
  • once in that room, you’ll see all the accessories, along with their respective parameters – in this example I want ‘Aqara Hub 3’, which is where the scene I created earlier should match with the parameter I set in the Eve app
  • The Scene in the Aqara app set the night light to 5%, so I need to set the brightness to 5% to be the trigger, so turn on the brightness toggle and set the brightness to 5% like in the example.
  • Click ‘Add’, then you’ll be taken back to a page that will show that when the Aqara hub light is at 5% brightness, this will act as a trigger. Click Next
  • The next page will have Value and Time conditions. We won’t bother with these for the purpose of this tutorial, but you can effectively get even more control should you explore at another time. Click Next.
  • Finally, you get to choose your HomeKit based scene to be triggered by the Aqara hub light coming on at 5% brightness. I have chosen ‘Lights Bright’ as mentioned before. Select the scene and click Next, where you then have to finally name the ‘Rule’. You’re done!

So now, whenever I flip my Aqara Cube 90°, the Aqara hub night light will come on at 5%, then after 1 second, it will go to 50%, then after another 1-second interval, the light will switch off. While the first part occurs (5% brightness), the Rule we created will see the light turn on at 5% brightness, which will trigger the ‘Lights Bright’ Scene.

Because the Aqara Cube has a variety of different actions, you can just simply repeat the process for each HomeKit scene you want to trigger, although to distinguish each scene, you need to set the brightness to a different level for each scene. Another thing to note is that I originally tried to set scenes and tie them to a Rule with different colours rather than brightness levels, but I found that the colour references in the Aqara app and the Eve app wouldn’t match, and so failed, so brightness seems to be a more accurate measurement in this respect.

So, why do I have those extra steps that I mentioned earlier? Well, I found the action to turn the night light to 5% as the automation won’t work a 2nd time as the hub will already be at 5% from previously, and so won’t trigger the HomeKit automation. The 1-second delay just there to ensure the Rule I created in the Eve app has time to register that the light came on. The 50% brightness action then ensures that the next time the scene is triggered by the Cube, it’s not already at 5% from the previous automation, and so ensures that it’ll trigger the subsequent Rule again.

Simon T Bramley

Editor - Musician, graphic designer and HomeKit aficionado, living in Taipei, Taiwan.

4 thoughts on “Using The Aqara Cube With HomeKit

  • 9th March 2019 at 11:55 pm
    Permalink

    Wonder if Xiaomi Cube works as well?

    Reply
    • 10th March 2019 at 12:28 am
      Permalink

      In theory, yes, as they’re essentially both the same device. It would all be down to whether you can add it to the Aqara app to begin with. When adding a device, the aqara app only shows ‘Cube’ as a device and doesn’t specify whether it’s Aqara or Mi, so it should be able to be added, and if it can, everything else in the tutorial would be the same.

      Reply
  • 13th March 2019 at 5:47 pm
    Permalink

    Could you confirm that indeed the Aqara Cube does not with other HomeKit devices? For example, turning on/off Hue lights.

    Reply
    • 13th March 2019 at 5:51 pm
      Permalink

      Hi
      the Aqara cube doesn’t get exposed to HomeKit, but with the tutorial instructions, you can get it to control other HomeKit devices (via the Aqara Hub), including Hue bulbs, although you’re limited to the different types of motions that Cube is capable of.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.