🧯 Zigbee2MQTT - Xiaomi Cube Controller

There’s another patch out today with another fix for it.
My HA has been in limbo fo 24hrs now due to ssl problems, I have not been able to test anything. But I assure you, if you copy the blueprint from the repo and paste it into a file manually, it will work. This is a HA problem causing everyone with selectors and some other items that have enum’s to not import… At least that’s that the release notes said today.

New Version today.
I did this a couple of days ago but released it today because of the problems with 2033.5.0 and 2022.5.1 releases not allowing Blueprint Imports.

Please Click the :orange_heart: at the end of the Top Post if you find this Useful

  • 2022-05-05: Updated for 2022.5.0 HA. Added Markdown to !input Descriptions plus shortcut or.

Not getting any responses from the automation…
I get this error in debug:


Error: UndefinedError: 'dict object' has no attribute 'to_state'

Step ConfigChanged VariablesRelated logbook entries

any idea?

I think my z2m is not sending the expected data, I managed to change the template condition to something where the result is true, here is what I have :

condition:
  condition: template
  value_template: '{{ trigger.from_state.state in (''rotate_right'', ''rotate_left'',
    ''flip90'', ''flip180'', ''slide'', ''tap'', ''shake'', ''fall'') }}'

But then nothing happens because the “action” variable is set to ‘’.

what is your payload? wonder if thats my issue too.

Here’s what mine looks like when shaken:

{
    "action": "shake",
    "action_angle": null,
    "action_from_side": null,
    "action_side": null,
    "action_to_side": null,
    "battery": 99,
    "current": 0,
    "linkquality": 145,
    "power": 123,
    "side": 0,
    "temperature": 25,
    "voltage": 2975
}

Just need to verify you are in legacy mode and the action sensor exists and that action sensor is what you have listed as input 1 named “remote” in the blueprint builder… That is the most common problem. Details above in the posts from others. 🧯 Zigbee2MQTT - Xiaomi Cube Controller - #7 by Sir_Goodenough

That said, trigger.to_state.attributes.action is generated from the data received when the trigger happens, that is set to when the cube action sensor changes and the data populated in the state that the action sensor changed to. It will only triggers the blueprint cube actions when it contains one of the valid responses, (in (''rotate_right'', ''rotate_left'', ''flip90'', ''flip180'', ''slide'', ''tap'', ''shake'', ''fall'') ) because the thing tends to trigger 5 bad times for every time it has valid data. It you look in the traces you will see this happen. The blueprint will trigger multiple time and drop out at the check for valid in the conditions, however the valid ones will cascade thru the rest of the blueprint and start actions.

If it’s not getting a valid trigger at the action sensor, you likely are not looking at the right action sensor. It is possible there is a new firmware out there that is messing with this, but your data example contains ‘shake’ which should be valid.

Now if you are expecting to see the value when you drop the sensor in a dashboard, you aren’t going to see it, because like I said, it multi-triggers. The Blueprint will look for a valid result and act on it. If you want to ‘see’ the value that was acted on, you need to read the documentation and build the template sensor and drop that in a dashboard. (🧯 Zigbee2MQTT - Xiaomi Cube Controller) That will latch the valid last result for ‘training’. Believe me, this cube thing has a learning curve how hard to bang it for taps and flips, etc…

Once you dial it in, it’s awesome!

Thanks for the reply.

I have the legacy APIs enacted. I think i have the right action sensor also:

The Trace log shows this:

This was a slide on side 0 automation.

{
    "action": "slide",
    "action_angle": null,
    "action_from_side": null,
    "action_side": null,
    "action_to_side": null,
    "battery": 99,
    "current": 0,
    "linkquality": 69,
    "power": 242,
    "side": 0,
    "temperature": 22,
    "voltage": 2975
}

Look at prior traces in the list. Yes, there are false fires, as I mentioned above, where the condition statement screens out non-valid triggers from the cube.
The trace in your picture above is a non-valid trigger.
You need to click the little white arrows to see the successful actions from prior cube communications:
Screenshot_2022-05-10_11-19-30

Good run: (This was found 2 or 3 traces back from the most recent trigger of the cube.)

Either way, valid triggers will preform the actions matching the stack logic and triggers where the action doesn’t match anything will drop out at the condition, as in your picture, and you never know or care that they happened.

It seems to work now, on top of the legacy API stuff that was already enabled, I had to enable the following option in z2m. After a z2m restart it works.

Not sure if this will cause issues for other devices.

OK.
Apparently mine had defaulted to that setting. I don’t remember changing it.
I captured your input here and added it to the instructions in the top post.

I wanted to run a separate Zigbee/Zwave server off of an SSD-bootable raspberry Pi 4 so I ended up doing a fresh install of zigbee2MQTT and re-pairing all my sensors. (I’m planning a z-wave 7 upgrade also).

This is now working as a result and Man… what a fun project. Thanks for taking the time to build this blueprint and support questions. Any links to places that make stickers for it?

1 Like

I have a vinyl cutter similar to a cricket. That’s all I used.

Ya, I started with what someone else had and just kept coming up with variations.

It’s WAY more complicated that anyone can use now, BUT that means there are multiple ways so you can find one that works well for you.

Plus I added the simple mode that don’t care about sides for getting used to the thing.

Lots of fun for sure!

Updated the ‘other blueprints’ links.

25 may 2022 Added Troubleshooting Tip.

Hi,
im new and now finished flashing and passing my sonoff zigbee 3 stick through to haos.
@Sir_Goodenough
now i wonder if i can use the dimmer script to control my volume via a tasmota ir blaster?

with kind regards

Hardware is quite different, but if the IR Blaster can give you an angle value in degrees, then I’m sure you could adapt it.

the IR Blaster is this: auvisio S06 IR Controller Configuration for Tasmota

so i guess it doesn’t give anything back. The Cubes ration should send IR Volume Down or IR Volume UP to my Stereo :smiley: