Mi Magic Cube - Deconz (45+ actions!)

Wow! Great automation.
I have been using node-red code to automate magic cube but now with this blueprint it is much easier and requires only Home assistant.

Thanks @bergstrom !

1 Like

Firstly, pretty nice work!

I want to use each cube sides as a specific scene.
But I have problems using this blueprint as automation.
The Cube is working fine in the Phoscon Gateway and it is also discovered by HA.

Here is the error message:

Logger: homeassistant.components.automation
Source: components/automation/__init__.py:517
Integration: Automation (documentation, issues)
First occurred: 6:40:31 PM (3 occurrences)
Last logged: 6:47:05 PM
Blueprint Mi Magic Cube generated invalid automation with inputs OrderedDict([('remote', '778085774d4153bc127c68f7b9f334ca'),
 ('one_to_two', [OrderedDict([('service', 'input_number.set_value'), ('data', 2), ('entity_id', 'input_number.magiccube_preset')])]), 
('one_to_three', [OrderedDict([('service', 'input_number.set_value'), ('data', 3), ('entity_id', 'input_number.magiccube_preset')])]), 
('one_to_four', [OrderedDict([('service', 'input_number.set_value'), ('data', 4), ('entity_id', 'input_number.magiccube_preset')])]), 
('six_to_five', [OrderedDict([('service', 'input_number.set_value'), ('data', 5), ('entity_id', 'input_number.magiccube_preset')])]), 
('six_to_four', [OrderedDict([('service', 'input_number.set_value'), ('data', 4), ('entity_id', 'input_number.magiccube_preset')])]), 
('six_to_three', [OrderedDict([('service', 'input_number.set_value'), ('data', 3), ('entity_id', 'input_number.magiccube_preset')])]), 
('six_to_two', [OrderedDict([('service', 'input_number.set_value'), ('data', 2), ('entity_id', 'input_number.magiccube_preset')])]), 
('six_to_one', [OrderedDict([('service', 'input_number.set_value'), ('data', 1), ('entity_id', 'input_number.magiccube_preset')])]), 
('five_to_six', [OrderedDict([('service', 'input_number.set_value'), ('data', 6), ('entity_id', 'input_number.magiccube_preset')])]), 
('five_to_four', [OrderedDict([('service', 'input_number.set_value'), ('data', 4), ('entity_id', 'input_number.magiccube_preset')])]), 
('five_to_three', [OrderedDict([('service', 'input_number.set_value'), ('data', 3), ('entity_id', 'input_number.magiccube_preset')])]), 
('five_to_two', [OrderedDict([('service', 'input_number.set_value'), ('data', 2), ('entity_id', 'input_number.magiccube_preset')])]), 
('five_to_one', [OrderedDict([('service', 'input_number.set_value'), ('data', 1), ('entity_id', 'input_number.magiccube_preset')])]), 
('four_to_six', [OrderedDict([('service', 'input_number.set_value'), ('data', 6), ('entity_id', 'input_number.magiccube_preset')])]), 
('four_to_five', [OrderedDict([('service', 'input_number.set_value'), ('data', 5), ('entity_id', 'input_number.magiccube_preset')])]), 
('four_to_three', [OrderedDict([('service', 'input_number.set_value'), ('data', 3), ('entity_id', 'input_number.magiccube_preset')])]), 
('four_to_two', [OrderedDict([('service', 'input_number.set_value'), ('data', 2), ('entity_id', 'input_number.magiccube_preset')])]), 
('four_to_one', [OrderedDict([('service', 'input_number.set_value'), ('data', 1), ('entity_id', 'input_number.magiccube_preset')])]), 
('three_to_six', [OrderedDict([('service', 'input_number.set_value'), ('data', 6), ('entity_id', 'input_number.magiccube_preset')])]), 
('three_to_five', [OrderedDict([('service', 'input_number.set_value'), ('data', 5), ('entity_id', 'input_number.magiccube_preset')])]), 
('three_to_four', [OrderedDict([('service', 'input_number.set_value'), ('data', 4), ('entity_id', 'input_number.magiccube_preset')])]),
('three_to_two', [OrderedDict([('service', 'input_number.set_value'), ('data', 2), ('entity_id', 'input_number.magiccube_preset')])]), 
('three_to_one', [OrderedDict([('service', 'input_number.set_value'), ('data', 1), ('entity_id', 'input_number.magiccube_preset')])]),
('two_to_six', [OrderedDict([('service', 'input_number.set_value'), ('data', 6), ('entity_id', 'input_number.magiccube_preset')])]), 
('two_to_five', [OrderedDict([('service', 'input_number.set_value'), ('data', 5), ('entity_id', 'input_number.magiccube_preset')])]), 
('two_to_four', [OrderedDict([('service', 'input_number.set_value'), ('data', 4), ('entity_id', 'input_number.magiccube_preset')])]), 
('two_to_three', [OrderedDict([('service', 'input_number.set_value'), ('data', 3), ('entity_id', 'input_number.magiccube_preset')])]), 
('two_to_one', [OrderedDict([('service', 'input_number.set_value'), ('data', 1), ('entity_id', 'input_number.magiccube_preset')])]), 
('one_to_six', [OrderedDict([('service', 'input_number.set_value'), ('data', 6), ('entity_id', 'input_number.magiccube_preset')])]), 
('one_to_five', [OrderedDict([('service', 'input_number.set_value'), ('data', 5), ('entity_id', 'input_number.magiccube_preset')])])]): 
expected dict for dictionary value @ data['action'][1]['choose'][1]['sequence'][0]['default'][0]['data']. Got None

Here is the automation:


- id: '1611510026320'
  alias: Mi Magic Cube Preset Chooser
  description: Mi Magic Cube Preset Chooser
  use_blueprint:
    path: bergstrom/mi-magic-cube-deconz-45-actions.yaml
    input:
      remote: 778085774d4153bc127c68f7b9f334ca
      one_to_two:
      - service: input_number.set_value
        data: 2
        entity_id: input_number.magiccube_preset
      one_to_three:
      - service: input_number.set_value
        data: 3
        entity_id: input_number.magiccube_preset
      one_to_four:
      - service: input_number.set_value
        data: 4
        entity_id: input_number.magiccube_preset
      six_to_five:
      - service: input_number.set_value
        data: 5
        entity_id: input_number.magiccube_preset
      six_to_four:
      - service: input_number.set_value
        data: 4
        entity_id: input_number.magiccube_preset
      six_to_three:
      - service: input_number.set_value
        data: 3
        entity_id: input_number.magiccube_preset
      six_to_two:
      - service: input_number.set_value
        data: 2
        entity_id: input_number.magiccube_preset
      six_to_one:
      - service: input_number.set_value
        data: 1
        entity_id: input_number.magiccube_preset
      five_to_six:
      - service: input_number.set_value
        data: 6
        entity_id: input_number.magiccube_preset
      five_to_four:
      - service: input_number.set_value
        data: 4
        entity_id: input_number.magiccube_preset
      five_to_three:
      - service: input_number.set_value
        data: 3
        entity_id: input_number.magiccube_preset
      five_to_two:
      - service: input_number.set_value
        data: 2
        entity_id: input_number.magiccube_preset
      five_to_one:
      - service: input_number.set_value
        data: 1
        entity_id: input_number.magiccube_preset
      four_to_six:
      - service: input_number.set_value
        data: 6
        entity_id: input_number.magiccube_preset
      four_to_five:
      - service: input_number.set_value
        data: 5
        entity_id: input_number.magiccube_preset
      four_to_three:
      - service: input_number.set_value
        data: 3
        entity_id: input_number.magiccube_preset
      four_to_two:
      - service: input_number.set_value
        data: 2
        entity_id: input_number.magiccube_preset
      four_to_one:
      - service: input_number.set_value
        data: 1
        entity_id: input_number.magiccube_preset
      three_to_six:
      - service: input_number.set_value
        data: 6
        entity_id: input_number.magiccube_preset
      three_to_five:
      - service: input_number.set_value
        data: 5
        entity_id: input_number.magiccube_preset
      three_to_four:
      - service: input_number.set_value
        data: 4
        entity_id: input_number.magiccube_preset
      three_to_two:
      - service: input_number.set_value
        data: 2
        entity_id: input_number.magiccube_preset
      three_to_one:
      - service: input_number.set_value
        data: 1
        entity_id: input_number.magiccube_preset
      two_to_six:
      - service: input_number.set_value
        data: 6
        entity_id: input_number.magiccube_preset
      two_to_five:
      - service: input_number.set_value
        data: 5
        entity_id: input_number.magiccube_preset
      two_to_four:
      - service: input_number.set_value
        data: 4
        entity_id: input_number.magiccube_preset
      two_to_three:
      - service: input_number.set_value
        data: 3
        entity_id: input_number.magiccube_preset
      two_to_one:
      - service: input_number.set_value
        data: 1
        entity_id: input_number.magiccube_preset
      one_to_six:
      - service: input_number.set_value
        data: 6
        entity_id: input_number.magiccube_preset
      one_to_five:
      - service: input_number.set_value
        data: 5
        entity_id: input_number.magiccube_preset

What is wrong here?

I think your automation should look like this. Please reply how it goes :slightly_smiling_face:

value: 3

Not value:| 3

1 Like

Yeees! That did the trick!

Thank you very much!

1 Like

no one using it with CC2531 :(((

A Great oppurtunity for you to shine :wink:

1 Like

Thanks for this great Blueprint!!

I am using the event “2003”. But it is only working if I do this change:

Old version:

    - conditions:
           - "{{ event == 2003 }}"
        sequence: 
          - choose:
              - conditions: "{{ double_tap_any_side }}"
                sequence: !input cube_double_tap_any
            default: !input three_to_two

New working version:

- conditions:
           - "{{ event == 2003 }}"
        sequence: 
          - choose:
              - conditions: "{{ flip_90 }}"
                sequence: !input cube_flip_90
            default: !input three_to_two
1 Like

And the Event == 2004 must be changed to:

- conditions:
           - "{{ event == 2004 }}"
        sequence: 
          - choose:
              - conditions: "{{ flip_90 }}"
                sequence: !input cube_flip_90
            default: !input four_to_two

Thank you for your kind words! Of course, you’re right. Must have mixed things up in the lots of copy->paste->edits the blueprint is made of.

I will try to change the code asap. I might have time tomorrow

It is fixed. Thank you @BjoernM !

I actually haven’t used the cube since I wrote this blueprint

Thank you @bergstrom !

I actually haven’t used the cube since I wrote this blueprint

That the cool thing about blueprints. Even if the original coder is not using the code, others can benefit!

I am using the Magic Cube now as input device for a bluetooth speaker. With each side of the cube i can choose a web radio station. Turning left set the raises the volume, and turning right …

This way my little bluetooth speaker becomes a nice radio in my kitchen.

1 Like

Hi,

first of all, great job, but is it possible to make the both rotations side dependend?
I will have the movement options for every device that will be choose at which side is shown.

Hello,

I’m sure it’s possible with some variables being set depending on the side that is down. You are welcome to edit my blueprint, I don’t really have time and energy to test it out.

For future reference, on Jan 20 Mikkel Møller discovered 51 actions in total, jumping off the work done in this topic.

Hi @bergstrom,

thank you so much for this great blueprint. Now it’s so easy to control spotify.

I’ve just one question: Is it possible to retrieve the information from the cube, on which side I do the rotation? So I could extend the blueprint and adjust the volume on side 1 and control the brightness of a lamp on side 3.

Thank you
Matthias

Edit: It won’t work well - reddit

Hello, I guess It is possible With some input booleans to Keep track of its whereabouts


If anybody finds this handy - I just checked which side is which (using aqara if that makes any difference). Thanks!

7 Likes

Double tap does not work for me, has anyone had this issue and found a solution? The double tap is registered and triggers the automation but the action does not run. The slides, shake and fall work great though.

Edit: never mind, tapping the wrong way :wink: Not recieving double-tap events into home assistant from an Aqara Magic Cube · Issue #3084 · dresden-elektronik/deconz-rest-plugin · GitHub

Hey, just wanna share some information about this Blueprint:

I was trying to use my Aqara Magic Cube MFKZQ01LM (im using it with Deconz on a docker and integrated that to HA) in HA and i used this blueprint: deCONZ - Xiaomi Aqara MFKZQ01LM Cube Controller
But then i read that you can actually use all different sites of your cube so i tried this integration here but i didnt work.
But then i realized why: You need to disable/delete the other deCONZ Automation and just activate the Mi Magic Cube Automation. So there must be only 1 Automation active otherwise it doesnt work.

1 Like

Hmm, I get most of the things working but not rotation. There is nothing happening in the event viewer when I listen to deconz_event when I rotate the cube. Does anyone experience the same thing?