Aqara Cube

Since the two days my cube automations work very slow.
They work, so there is defenitely a connection, but it takes minutes.

The actions are shown in the aqara app log.
But there is a big lag until ha gets the information update.

Is it a server issue? Is someone else facing these problems. Worked perectly for some days
bevor.

Updated to 0.77.2

I’ve also just updated to 0.77.2 and am having issues with the cube. I can still see the state changes, however my automations are not working with the cube anymore. No changes to my system have been made since I updated either and everything else is functioning as before, so I think it may be a version bug?

I haven’t played with this yet or read much about it, but I’m guessing the negative values in your code indicate CW motion and the positive values CCW, or vise versa? I’m looking to change my cube setup for volume control of my tv using an ir blaster and this could be really good for the volume commands.

Hopefully this can help. I use the original Xiaomi Cube for volume control by rotation via IR with this code:

cube_rotate.yaml (saved under /automations)

alias: Cube - Volume [Rotate]
initial_state: 'on'
trigger:
  - platform: event
    event_type: cube_action
    event_data:
      entity_id: binary_sensor.cube_158d00010fd152
      action_type: rotate
action:
  - service_template: >  
        {%if trigger.event.data.action_value | float > 0 %} 
             switch.turn_on
        {% else %} 
              switch.turn_off
        {% endif %}
    entity_id: switch.onkyo_amp_volume_up

where switch.onkyo_amp_volume_up is actually a bit of a typo in my code that I never fixed… it should have just been ‘switch.onkyo_amp_volume’ because it has two commands attached as per the following which uses the broadlink custom_component:

switches.yaml

  - platform: broadlink
    host: 192.xxx.xx.xx
    mac: 'xx:xx:xx:xx:xx:xx'
    friendly_name: IR Transceiver
    type: rm_mini
    switches:
      onkyo_amp:
        friendly_name: "Amp Power"
        command_on:  'JgBMAAYABD8AASiSFBEUNRQRFBEUNRQRFDYUNRU1FBEUNhQ1FBEUNhQ1FBEUERQQFDYUERQQFBEUEBQRFDYUNRQRFDYUNRU1FDYUNhQADQUAAAAAAAAAAAAAAAA='
        command_off:  'JgBIAAABKJEUERQ2FBAUERQ2FBAUNhQ2FBAUERQ2FDUUERQ2FDYUEBQ2FDYUNRQRFBEUEBQ2FBEUEBQRFBAUNhQ2FDYUEBQ2FAANBQ=='
      onkyo_amp_cd:
        friendly_name: "Amp CD Input"
        command_on:  'JgBQAAABKJIUEBQ2FBEUEBQ2FBETNhQ2FDYUERM2FDYUERM2FDYUERM2FBEUERM2FBEUERMRFBEUEBQ2FDYUERM2FDYUNhQ2EwAE8gABKEkTAA0FAAAAAAAAAAA='
      onkyo_amp_v1:
        friendly_name: "Amp V1 Input"
        command_on:  'JgBIAAABKJEUERM2FBEUERM2FBEUNhM2FDYUERQ1FDYUERQ2EzYUERQ2EzYUNhQ2FBETERQRExEUERQRExEUERQ1FDYUNhQ2EwANBQ=='
      onkyo_amp_volume_up:
        friendly_name: "Amp Volume"
        command_on:  'JgBIAAABKIwaERM2FBEUERM2FBEUNhM2FDYUERM2FDYUERQ1FDYUERQQFDYUERQQFBEUERMRFBEUNhMRFDYUNhM2FDYUNhQ2EwANBQ=='
        command_off:  'JgBQAAkADMILAAzsAAEqkRQRFDYUEBQRFDYUEBQ2FDYUNRQRFDYUNhMRFDYUNhQQFDYUNhQQFBEUERQQFBEUEBQRFBEUNRQ2FDYUNhQ1FDYUAA0FAAAAAAAAAAA='
      onkyo_amp_mute:
        friendly_name: "Amp Mute"
        command_on:  'JgBIAAABKJIUEBQ2FBEUEBQ2FBETNhQ2FDYUEBQ2FDYUERM2FDYUERQ1FBEUNhQQFBEUERMRFBEUEBQ2FBEUNRQ2FDYUNhQ1FAANBQ=='
        command_off:  'JgBIAAABKJIUEBQ2FBEUEBQ2FBETNhQ2FDYUEBQ2FDYUERM2FDYUERQ1FBEUNhQQFBEUERMRFBEUEBQ2FBEUNRQ2FDYUNhQ1FAANBQ=='
1 Like

Mine started working again this morning. No delay any more.

Are the cube alerts logged in your xiaomi app?

Does the status of your cube show up in ha?

I’ll have to try again and see if its working again when I get home from work.

When I tested it this morning I was still getting state changes showing in HA, and in the Xiaomi Home app too.

Hmm so I found the source of the error… apparently when I updated to 0.77.2 last night, my cube binary sensor decided to change its name from ‘binary_sensor.cube_158d00024a5f9f’ to ‘binary_sensor.cube_158d00024a5f9f_2’… Just changed the name to include the ‘_2’ in my automations and it’s working as expected again… No idea why it would do this, I’ve never seen that before.

I had the exact same thing happen when updating to 0.77.2

Thanks for posting your code sparkydave, I just modified the entity_id and have it changing the brightness of my I.R LED strip in my bedroom via my broadlink RM mini 3. Cheers works awesome.

I had the same issue with the cube entity_id being renamed. Thanks for the heads up, that made debugging a lot easier.

I am using deCONZ software on raspbian with a ZigBee Shield for the raspberry-pi.

Was able to connect my Aqara Cube with my Shield from dresden elektroniks. Cube get all the states what it should but HA just show me the battery sensor: sensor.zauberwurfel1_battery_level

Others sensors wokring nice, for example my xiaomi door sensor.
Can anybody tell what went wrong on my system?

Nothing is wrong. It is exposed through events in home assistant, all remotes are. Check deconz component documentation for examples.

Late reply but I think you could also change the entitiy_id in your config folder.

you can find it in /config/.storage/core.entity_registry

I don’t know if it is save to change that file while ha runs.
I can’t remember but I think I deleted the file core.entity_registry, did a reboot, and than it started a new file without the _2 entities

THX a lot!

No it runs well.

Hi, probably a newby question:). But I want to get this one: https://nl.aliexpress.com/item/Xiaomi-Aqara-Magische-Kubus-Schakelaar-Controller-Zigbee-Versie-Ondersteuning-Upgrade-Gateway-Smart-Home-Apparaat-Draadloze-MiHome/32906679664.html. I already have a Zwave.me UZB1. Can I use that to connect the cube to my Raspberry PI, or do I also need an Xiaomi gateway?

ZWave is a different protocol, you can use either deCONZ with a Conbee or the Xiaomi gateway

Or zigbee2mqtt

Kinda newbie here , learning the ropes along with the help available over here. Running HassIO 0.90.1 on Rpi3+.

So I , as like some others bought “Aqara” cube (not the “Mi” cube), its part number is MFKZQ01LM

I have a Nortek HUSBZB-1 configured correctly with HassIO and it can see Zwave and Zigbee devices. I was able to pair the Aqara Cube with Nortek via ZHA join functional and can see it device name and details as follows. Somehow it creates three devices (i tried removing and readding it to confirm).

Homeassistant sees it as lumi sensor cube

My objective was to control connected home devices (like smart bulb, switches, onkyo amplifier) by using various states of Aqara cube.

After adding it to Homeassistant ,I dont have any further clue how/where to see its states and how to configure any further automations or actions based on specific cube movement , tapping, flipping, or touching states.

In the ZHA configuration page I can see and choose a lot of options, however its a bit overwhelming to make sense and correlate all of them with real world usage.



Can someone here share a more gradual approach to understanding it and making it work for me, would be helpful for others in the same pursuit. Would be really thankful for the help.

I can, but I dont want to add a Xiaomi Aqara Gateway, just to be able to read the cube states, although I understand it may be a bit more easier with an aqara gateway though, is it correct. I already have a SmartThings V2 Hub integrated with HomeAssistant (as a local lan device , not via cloud - using SmartThings bridge), hence no need to add one more hub to the mix.

Hi @SFHasan,
I just received my cube, so I ran into the same situation. After several attempts of removing and adding the cube via the ZHA function, the sensors started receiving input.
So in the States overview I can follow most of the actions:

The actions that I am currently missing are knock and drop, all other actions can be tracked:

  • Sensor 2:
    • flip
    • slide
    • shake
  • Sensor 3:
    • rotate_left
    • rotate_right

Thanks for the info. I will try, which HassIO ver you are on.I am on 0.91.0. and currently afraid to upgrade as there are lot of breaking changes I am reading. I dont want to end in a situation to redo all of the of the config again .