šŸ§Æ Zigbee2MQTT - Xiaomi Cube Controller

looking into into it now.
Sorry, sir. I just imported it 2x and cannot replicate.

I am betting you have an old version of HA that does not know what the multiple is.
I just noticed that I did not lock out versions older than

  homeassistant:
    min_version: 2022.4.0

So I am adding that now. You should now get an error that you need to update HAā€¦

Hello, I canā€™t get the automation to work.

The trace shows that it fails at the condition template at the beginning but I donā€™t understand why, here is the ā€œChanged variableā€ information :

this:
  entity_id: automation.aqara_magic_cube_zigbee2mqtt_2022_04_26
  state: 'on'
  attributes:
    last_triggered: '2022-05-05T23:40:18.659537+00:00'
    mode: single
    current: 0
    id: '1651792422338'
    friendly_name: Aqara Magic Cube Zigbee2MQTT - 2022-04-26
  last_changed: '2022-05-05T23:58:00.273312+00:00'
  last_updated: '2022-05-05T23:58:00.273312+00:00'
  context:
    id: 018096a8b451b854700e524ea4e71690
    parent_id: null
    user_id: null
trigger:
  id: '0'
  idx: '0'
  platform: state
  entity_id: sensor.aqara_cube_salon_action
  from_state:
    entity_id: sensor.aqara_cube_salon_action
    state: ''
    attributes:
      icon: mdi:gesture-double-tap
      friendly_name: Aqara Cube - Salon action
    last_changed: '2022-05-06T00:06:37.296813+00:00'
    last_updated: '2022-05-06T00:06:37.296813+00:00'
    context:
      id: 018096b097f05413d086c4b94da96997
      parent_id: null
      user_id: null
  to_state:
    entity_id: sensor.aqara_cube_salon_action
    state: rotate_right
    attributes:
      icon: mdi:gesture-double-tap
      friendly_name: Aqara Cube - Salon action
    last_changed: '2022-05-06T00:06:37.785562+00:00'
    last_updated: '2022-05-06T00:06:37.785562+00:00'
    context:
      id: 018096b099d920ccc36cf85229c67c2d
      parent_id: null
      user_id: null
  for: null
  attribute: null
  description: state of sensor.aqara_cube_salon_action

There are some hints above. Legacy needs to be on so that the action sensor is available. Also you need at least HA Version 2022.4.0 for some of the other stuff to work.
Check over the issues that others had above and let me know if you still have a problem.

WOWā€¦ I spent all afternoon fighting this thingā€¦ Tearing my hair out I didā€¦

There was a bug. Iā€™m about to load 2022.5.1 and see if itā€™s fixed.

@Stormweaker

I had the same issues as above and updated to 2022.5.0 and checked legacy API in z2m (v1.25.0) before posting here.

I updated to 2022.5.1 now but same issue.

Not sure if I can get more debug information, thatā€™s my first time using a blueprint.

Thank you for your time.

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.
2 Likes

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?

1 Like

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:

Solution: it seems like you have to create Scripts for the IR remote and call them with this blueprint

Hi there. I just got this setup, thank you for this extremely detailed blueprint!

Iā€™m seeing about 1 second delay between interacting with the cube, and having Zigbee2MQTT show anything in its logs. Is this latency expected? Thanks.