Mi Magic Cube - Deconz (45+ actions!)

Tags: #<Tag:0x00007fc416a6d9e8> #<Tag:0x00007fc416a6d858>

A different blueprint would be fine too. Using the rotation on different sides would be awesome if you have multiple dimmers or receivers around the house and would kill the need for a lot of rocker switches.

I agree, next level volume/dimming!

Great idea!

1 Like

Amazing. Thank you so much for sharing!

1 Like

Hello, what a great project, congratulations @bergstrom. I would also very much like to see this project working with zigbee2mqtt. This is a great project to use and make available by blueprints. I bought 4 cubes of these and was starting to test it and thinking about how to do the automations, but the way you wrote the code is very good, very well thought out, congratulations. I also find it very cool to add the 10 most suggested functions by @fleeman. Great idea.

1 Like

Thank you @jvnrambo for the kind words. I have a lot of projects ongoing right now and won’t be able to make it work for z2mqtt but i guess it can’t be that hard to translate it for Someone who are using z2mqtt.

I can not seem to find the top 10 suggestions you are mentioning. Do you mean rotation on each side?

I think so, i never gave a top 10. But rotation on each side adds 10 triggers. Would be awesome.

Just a dummy question: what is the advantage of the blueprint, when I can also go to the integration and show triggers for the automations of the cube?


In what way can the blueprint do more?

If you go through integrations you need to set up a lot of automations or a huge one with many options.

This blueprint makes one automation with 45+ actions

1 Like

Hi @bergstrom - thank you very much for this template, it came at the right time for me, trying to replicate my existing OH setup in home assistant.

One question - I’m trying to modify this because I’m not interested in 5 different ways my cube flips onto a specific face; I just want an action once I flip it to “2”, for example.
I’m very new to this yaml/python stuff, and altough the modifications I made look sensible to me, I’m getting an error message when I try to actually configure an automation based on the modified blueprint.
The question is: would you be interested to have a look at my mod, and give me feedback if you can see where I messed up?

Hey @aGoodAutomation,

It’s not a default listening event. When looking on the automation side it simply doesn’t show any options to “Rotates to Side 2” or anything like that (image 1). You might be able to read part of the event to know the side up but it might mix things up with other events. I have to say I’m sorry because I don’t have the time to look into this “fix”. One solution though is to make the same action for every “From side X to Side 2”. You can easily copy/paste the action by editing it in YAML after you’ve done the action (image 2).

Can you please make a Blueprints for CC2531 or what do i need to change on your template?

I haven’t used CC2531 so my guess is as good as yours :slight_smile:

1 Like

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