šŸ§Æ Zigbee2MQTT - Xiaomi Cube Controller

(Hundreds of possible actions!!) Works with MQTT Directly bypassing both Legacy and non-Legacy trigger issues. Uses a Zigbee2MQTT built MQTT sensor to sort out the 38(+54) commands available from the Xiaomi Magic Cube. This gives you the ability to trigger actions using the remote. NOTICE: Using this Blueprint and example scripts, this cube can be triggered many ways, but only 38(+54) of them are uniqueā€¦

:bookmark_tabs: Changelog

  • 2024-06-02: Blueprint Input Sections for enhanced Descriptions.
    • (Documentation change 2-7-2024 to add License notice. Changes only to Descriptions.)
  • 2023-12-09: Stop log spamming leak. #32
  • 2023-10-20: Enhancement Add flip to side from any
  • 2023-08-07: Updates for Home Assistant 2023.8
    • LOOK THIS LINK FOR IMPORTANT UPDATE INSTRUCTIONS
    • Selector syntax change
    • Condition Selector addition (where applicable)
    • MQTT Discovery name changes (where applicable)
    • Clean-up code formatting
  • 2022-03-01-A: Beef-up the note not to use spaces and non alpha in MQTT topics.
  • 2023-03-01: Add Author Tag. Bump HA required Version to 2023-3-0
  • 2022-12-28: Code cleanup.
    • Add note to fix configuration conflict template error:
    • Update angle configuration text to help with config errors. No Code Change.
    • Error while executing automation automation.friendly_name_automations: TemplateError: Must provide a device or entity ID
  • 2022-12-22: Change instances of the attribute angle to action_angle to fix non-legacy bug.
    • Add note not to use spaces and non alpha in MQTT topics.
  • 2022-12-12: Add Update Method Note, minor code change.
    • Name of Blueprint may have changed meaning you have to re-download with a new link.
    • If name changed, it is similar. Variables have not changed.
  • 2022-12-04: Re-did the backend to use MQTT instead of the Z2M Legacy configuration.
    • This removes the legacy trigger requirement and makes it respond much faster.
    • Old version Deprecated and available on the original Github link but will be no longer supported.
    • Old Github link still works if you need it for somethingā€¦
  • 2022-05-05: Updated for 2022.5.0 HA. Added Markdown to !input Descriptions plus shortcut or.
  • 2022-04-26 update-B: UPDATE: No code changes. Added examples to provide another 30 more ways to trigger something using conditionals in Group 3 :pear:,
  • 2022-04-26 update-A UPDATE: No code changes. Added examples to provide 24 more ways to trigger something using the rotate sensor as a device toggle, both long and short for each rotate sensor.
  • 2022-04-26: Re-configure to add 30 Action Methods !!NOTICE!! If you are upgrading the Blueprint, upgrade the template sensor as well. The variables are differentā€¦
    • Add 30 flip actions for any side to any side addressing
    • Add ā€˜last_sideā€™ variable to display sensor and code
    • Change variable named ā€˜eventā€™ into ā€˜actionā€™ fo clarity
    • Change variable named ā€˜sub-eventā€™ into ā€˜sideā€™ for clarity
    • dded Group 1 :apple:, Group 2 :cherries:, & Group 3 :pear: to help users decide which sensors to populate
    • Added Emojis to help people visualize what action is in what Group
  • 2022-04-11: No Code Change. Added guidance to solve missing Action Sensor condition in this document.
  • 2022-03-17: Added 6 functions that do not care about side. Makes it simple if you only want a couple of functions.
    • Added some aliases on some choose statements to improve Trace Diagrams and Troubleshooting.
  • 2022-03-12: Changed de-bounce logic from not repeating the last action to single mode and added a 1 second delay at the end. Was hard to do the same action twice (IE: Rotation) as the logic would prevent it.
  • 2022-02-15.1: Later that same day realized that if you have more than 1 cube, the event will be lacking so added ID.
  • 2022-02-15: :tada: Forked from Z2M - Xiaomi Cube Controller Version 1.2
    • Updated Documentation.
    • Added Latched event sensor.

:wrench: * Hardware Versions

Aqara / Lumi has released a new version of the cube. Box name listed as Cube T1 Pro. This Blueprint is NOT for that cube. It will work, sorta, but you will be missing Functions. Please see this Blueprint to configure that version of the cube.

:crystal_ball: About this blueprint

Type of blueprint: AUTOMATION

What if I am having problems getting it going?

You can contact me for help, see the links below.

Why do I need this?

The Cube remote/switch device has a lot of ways to trigger it. This Blueprint makes it a bit easier to figure out what you are doing and remembering that in the future. It also makes sure the trigger is as clean and repeatable as possible, screening out false triggers and making the log clean and the experience good overall.

:moyai:License Notice:

  • Copies of the original Blueprint that were converted via the ā€˜Take Controlā€™ feature or other means are officially not supported by me.

  • I may or may not be able to support you when you have a problem after you make changes to my code, as some of the code is no longer mine.

  • I & my license also require attribution as a link back to the original should you use this code in your own creation.

  • Here is a link to my license & the original github post expected to be followed & referenced as attribution should you use this code elsewhere.

:wrench: Configuration

Requirements

  • To make the Blueprint work you will need a functional Magic Cube integrated to Home Assistant thru Zigbee2MQTT.
  • My ā€˜suggestionā€™ is that you do separate scripts for most, if not all of the actions you generate here. If you are using the UI editor for the simple things you are fine, but for more complicated things scripts may work better for you. This is my opinion and how I am using it, to each their own. See my example dimmer script belowā€¦
  • IF YOU SEE ā†’ TemplateError: Must provide a device or entity ID ā€¦
    • If you get an error like that, The friendly_name in Z2M likely does not match the friendly_name on HA. To fix go into the Z2M Open web UI and set the friendly_name there. Setting this in just HA or in Z2M without ticking the update HA box will cause this.
  • This version of the Blueprint uses MQTT to deal with cube interface duties. This means that if you have Legacy triggers enabled on your setup or not, it will still work. It also created itā€™s own number helper to track a variable needed to do all the tricks. You as the user will not have to deal with that.

You will also need the correct MQTT topic to talk to your device.

This blueprint has been known to freak out when there are spaces or odd characters in the MQTT Topic. Make sure there are no spaces, ONLY a single word, and ONLY A thru Z, a thru z, and 0 thru 9 in the topic. ( / is ok between device and topic) If there are, you will need to change the name of the cube to remove those characters.

Wise advice from: HiveMQ:

Never use spaces in a topic

A space is the natural enemy of every programmer. When things are not going the way they should, spaces make it much harder to read and debug topics. Just because something is allowed, doesnā€™t mean it should be used. UTF-8 has many different white space types, such uncommon characters should be avoided.

Use only ASCII characters, avoid punctuation and non printable characters

Because non-ASCII UTF-8 characters often display incorrectly, it is very difficult to find typos or issues related to the character set. Unless it is absolutely necessary, we recommend avoiding the use of non-ASCII characters in a topic.

The topic can be found by going into devices and finding your cube device. Open your Home Assistant instance and show your devices.

Then clicking on MQTT INFO:

Click MQTT INFO

Then looking for the subscribed topic that looks like thisā€¦ zigbee2nqtt/[your device name here]:

That is what belongs in the the topic question you get when setting up a new automation with this blueprint.

:beetle: Template error

If you see an error similar to: Error while executing automation automation.magic_cube_automations: TemplateError: Must provide a device or entity ID there is a way to fix it. It happens (usually) because the friendly_name that is in HA does not match the friendly_name that is in Z2M.
In order to fix I suggest you go into the Z2M web UI and change the friendly name. Below is how to do this if you are using the Z2M Addon.

  1. Open the Z2M Web UI:

2: Select the change name icon in the row of the cube device:

3: Change the name and be certain to tick the box to update HA at the same time:

After this find the topic again the same way as above and it should work.

:card_index_dividers: Input fields

topic/name: Topic
    The main MQTT Topic for your cube. 

additional_conditions:
    Extra conditions you may want to add to this automation 
    (Example: Home occupied, TV on, etc)

shake:
  name: Shake the cube šŸ• Group 4
    This trigger only occurs once in the set-up.
    It can be combined in any group.'

drop:
  name: Drop the cube šŸ• Group 4
    **NOTE: NOT available with the ```Cube T1 Pro``` version of the cube!!**
    This trigger only occurs once in the set-up.
    It can be combined in any group.'

slide_any:
  name: Group 2 actions šŸ’ Slide the cube with any side

doubletap_any:
  name: Group 2 actions šŸ’ Double tap the cube with any side

flipped90_any:
  name: Group 2 actions šŸ’ Flip the cube 90 degrees to any side

flipped180_any:
  name: Group 2 actions šŸ’ Flip the cube 180 degrees any side

rotate_cw_any:
  name: Group 2 actions šŸ’ Rotate cube clockwise with any side

rotate_ccw_any:
  name: Group 2 actions šŸ’ Rotate cube counter clockwise with any side

**There is a set of these šŸŽ for all 6 sides. 36 inputs total..**

slide_face_0:
  name: Group 1 actions šŸŽ Slide the cube with face 0 up

doubletap_face_0:
  name: Group 1 actions šŸŽ Double tap the cube with face 0 up

flipped90_face_0:
  name: Group 1 actions šŸŽ Flip the cube 90 degrees to face 0

flipped180_face_0:
  name: Group 1 actions šŸŽ Flip the cube 180 degrees to face 0

flip_from_any_to_face_0:
  name: Group 1 actions šŸŽ Flip the cube from any to face 0

rotate_cw_face_0:
  name: Group 1 actions šŸŽ Rotate cube clockwise with face 0 up

rotate_ccw_face_0:
  name: Group 1 actions šŸŽ Rotate cube counter clockwise with face 0 up

**There is a set of these šŸ for all 6 sides. 30 inputs total..**

0_from_1:
  name: Group 3 actions šŸ Flip the cube to side 0 from side 1

0_from_2:
  name: Group 3 actions šŸ Flip the cube to side 0 from side 2

0_from_3:
  name: Group 3 actions šŸ Flip the cube to side 0 from side 3

0_from_4:
  name: Group 3 actions šŸ Flip the cube to side 0 from side 4

0_from_5:
  name: Group 3 actions šŸ Flip the cube to side 0 from side 5

:eyes: :airplane: Extended Information

This Blueprint uses a Zigbee2MQTT built sensor to sort out the commands available from the Xiaomi Magic Cube Remote.

The split out of functions gives you the ability to assign local scripts or functions
to do the things you want the remote to do.

Functions that are left empty will simply do nothing.

:apple: There is a set of 36 event functions that will trigger on specific actions

on specific sides that are listed as Group 1 actions :apple:.

:cherries: There is a set of 6 event functions that will trigger on specific actions

on ANY side that are listed as Group 2 sctions :cherries:.

:pear: There is a set of 30 event functions that will trigger on cube flips to

& froma specific sides that are listed as Group 3 sctions :pear:.

:pizza: There are 2 actions (shake and drop) that only occur once and are OK to

be combined with any other group. Listed as Group 4 sections :pizza:.

Please be aware that ALL actions except the 2 listed above,

:pizza: will trigger an action in ALL 3 groups at the same time every time. Therefore
I suggest if you just have a couple of things you want this remote to do that
you choose the ANY / Group 2 / :cherries: events.

If you want more than a few events, you should select actions in Group 1 / :apple:
OR Group 3 / :pear:
.

With careful selection you can use mixed groups, but you run the risk of a single
cube action triggering more than 1 Home Assistant action and making a mess of
things :bento:.

:magic_wand: My Cube triggers on the Desk with a slight Bump. How do I fix that?

I have 3 of these cubes. If you arenā€™t careful they trigger and do all kinds of things just sitting on the desk. Awesome when you want it to do this, but a HUGE PITA if you donā€™t.

A friend of mine came up with this and it works awesome. He didnā€™t want people hassling him about remixes and such, so he let me put it on the Thingiverse. I printed one for each of my cubes and because itā€™s now parked at a diagonal it will not trigger, unless you knock it on the floor or something. I highly suggest you print yourself one of these or find someone to print one for youā€¦ It will make cube life much simplerā€¦

NOTICE: This cube can be triggered over a hundred ways, but only 38 of them are unique

:wrench: How does this darn cube work?

There is sample code to make the template sensor in the help file on GitHib named the same as this one and in the community page related to this.

Seeing the cube commands for training the operator

Within this blueprint there is an event handler that will latch the last command that the blueprint finds and sends that to the event buss. From there a simple Template sensor can grab it and show you the last action sent. This will help when setting up new functions and to troubleshoot strange behaviors. Add an entity card in your dashboard for sensor.cube_last_action to see what actions occur as you move the cube.

Yaml file that contains the sample code here

Event Sensor in Action

If you wish to ā€˜storeā€™ these events you can add this sensor to recorder and it will save them for you.

:palm_down_hand: Getting Tap and Flip actions to work

I have had reports of the ā€˜tapā€™ action working. It was due to the lack of instructions provided by the manufacturer of the cube. Tap actions on the cube are initiated by sharply tapping the cube 2x on a hard surface like this:

Demo of Tap Action

In a similar manner, flips need to tap the surface at the end of the 90 or 180 flip. Setting up the template sensor above will help train you in the force needed for all the actions.

:speak_no_evil: Acknowledgments

This was ā€˜forkedā€™ from

Aqara Cube ZHA - Simplified face-based device control
Project authored by EdwardTFN (Edward Firmo) and he based on on several other giants that came up with most of the base code.

ZHA - Aqara Magic Cube (57 actions)

Aqara Magic Cube ZHA (51 actions)

ZHA - Aqara Magic Cube (24 actions)

I sincerely thank Them for their work.
I wanted to support a version that was virtually the same as my Z2M version,
and leverage all the documentation and code samples there but still port it
to ZHA. I also had a better idea for troubleshooting info.

:sun_with_face: Dimmer Control

If you are looking for a dimmer control to change brightness based on rotation, hereā€™s something I cobbled together from other community posts here and there. ( Credit Profile - yourigh - Home Assistant Community and others )

I did this with all the complicated stuff in a script that is called with data from the blueprint automation. Then the complicated part is all in 1 place and there is only 1 copy of it. The same script works for both increase and decrease of brightness because the angle in the cube goes positive when turning clockwise and negative when going counter clockwise.

Code Examples are found in the Yaml file here
If you want to create the script file using a script BluePrint, I have that for you right here: Dimmer Control BluePrint

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

  • The script reduces the angle number to 40% of the rotation angle (you can change this, but 40% works well for my needs).
  • It then grabs the current brightness from the light entity (as a % of the full scale 255 number).
  • The new_brightness target is then calculated.
  • It then checks if the light is already off, and if so, leaves it off.
  • It makes sure the new_brightness is above, in my case, 10% so all the lights come on.
  • It then makes sure that if new_brightness >90%, it is set to 100% and not over that.
  • Finally it provides the calculated brightness %.

NOTICE when building action scriptsā€¦

It has been found that some set-ups use trigger.payload_json.action_angle here and others only accept trigger.payload_json.angle here. I have not been able to determine which attributes are available in which version of firmware and/or configurations, so it is up to you to determine the one you need here. Look in the Device listing for this cube and determine which version of angle is one of the listed sensors. That would be the one to use here.

:vertical_traffic_light: Color Control

I also extended this to controlling the color one octet (color) at a time. Each color will use both rotations on one side of the cube. Colors are changed one at a time (Red or Green or Blue) and change the amount (positive ot negative) based on how far you rotate the cube.

Code Examples are found in the Yaml file here
If you want to create the color change script file using a script BluePrint, I have that for you right here: Color Change BluePrint

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

  • The script reduces the angle number to 60% of the rotation angle (you can change this, but 60% works well for my needs).
  • It then grabs the current colors from the light entity and puts them into a list.
  • The new color target is then calculated.
  • It makes sure the new color is not negative.
  • It then makes sure that the new color is not over 255.
  • Finally it provides the calculated color if not in the limits.

This can be used over and over for as many lights as you want to control. But you will need to repeat this and modify it for red and blue color octets.

NOTICE when building action scriptsā€¦

It has been found that some set-ups use trigger.payload_json.action_angle here and others only accept trigger.payload_json.angle here. I have not been able to determine which attributes are available in which version of firmware and/or configurations, so it is up to you to determine the one you need here. Look in the Device listing for this cube and determine which version of angle is one of the listed sensors. That would be the one to use here.

:repeat: :red_circle: Using Rotate CW and CCW as a Short-Press / Long-Press Toggle

Not enough switch positions for you? How about a possible 24 more? I came up with some scripts you can add to Home Assistant and call for more actions. One is for CW rotation < 100 degrees, another for > 100 degrees. Also the same for CCW. These are can be called from the Group 1 :apple: rotate actions and the Group 2 :cherries: rotate actions. Match the CW call/recieve or the CCW call/receive pairs together or you are going to be sad. :weary:

Here is a sample of what you put into the script Blueprint UI. It will need to be a manual YAML edit and contain your specific variables. What you see here is one from my config.

Code Examples are found in the Yaml file here
If you want to create the long / short rotation switch script file using a script BluePrint, I have that for you right here: Long Short Rotation Switch BluePrint

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

You can also do this buy going full gui and picking the matching template out of the below section and filling it in similar to this:

This is a homeassistant.toggle action, so it can toggle anything that that service can handle. Changing it to homeassistant.turn_on or homeassistant.turn_off would change the behavior slightly if this fits your needs better. Using this integration, you can control lights, switches, locks, and lots of different things.

NOTICE when building action scriptsā€¦

It has been found that some set-ups use trigger.payload_json.action_angle here and others only accept trigger.payload_json.angle here. I have not been able to determine which attributes are available in which version of firmware and/or configurations, so it is up to you to determine the one you need here. Look in the Device listing for this cube and determine which version of angle is one of the listed sensors. That would be the one to use here.

:headphones: Volume Control

This script was invented to be used with my Magic Cube Blueprints. I released it as a standalone Script Blueprint because because of requests to extend the function of my BPā€™s with how to convert cube rotation to volume in other places. Research found me this Post from Petro which had a very elegant solution to the problem, It was very easy decision to adopt it here.

Code Examples are found in the Yaml file here
If you want to create the script file using a script BluePrint, I have that for you right here: Volume Control BluePrint
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

  • The script scales the angle number of the rotation angle (you can change this, but 30 works well for my needs).
  • You send the script the media_player that you want to adjust.
  • You use a template (examples in the script BP description) to send the angle to the script.
  • Some math happens and it uses the amount you turn the cube to adjust the volume.

NOTICE when building action scriptsā€¦

It has been found that some set-ups use trigger.payload_json.action_angle here and others only accept trigger.payload_json.angle here. I have not been able to determine which attributes are available in which version of firmware and/or configurations, so it is up to you to determine the one you need here. Look in the Device listing for this cube and determine which version of angle is one of the listed sensors. That would be the one to use here.

Method to use Group 3 :pear: actions and not interfere with Group 1 :apple:

Not enough switch positions for you still? How about another posible 30 more?

This is another ā€˜actionā€™ that I stumbled upon. I noticed if you turn the cube from side to side very gently, it will internally register as being on a new side, but the flip action doesnā€™t register. Then if you slide the cube, it will send out an action of slide on side 5 from side 2, or whatever side comboā€™s you choose. I used 5 from 2 in the example, but you can use any of them.

Showing slide 5 from 2 on the Cube Action Sensor

Iā€™ll be honest, this is the trickiest thing to do yet and Iā€™m not sure it is worth the trouble, but if you want an action in your pocket as a secret action that only you know, this is the trick. Using a soft surface like a towel helps to keep the flip from registering when you set it down.

NOTE: In this example the slide side 5 will also trigger. You may need to add a condition to prevent that from triggering. An example for this 5 from 2 example is to put this condition on the slide side 5 action {{ not last_side == 2 }} before the thing you want to do. Or you can just not have a slide 5 action.

It is as simple as adding a condition of letā€™s say ā€˜slideā€™ in one of the Group 3 :pear: slots.

Here is the GUI editor showing this.

Code Examples are found in the Yaml file here

:sun_with_face: :snowflake: Troubleshooting tip

If you are troubleshooting and you want to see more traces back when doing so, here is a TIP Iā€™ve found.
Manually edit the automation created with the ui editor (or manually with a text editor) and add the following to have this automation contain 10 traces instead of the normal 5. Then if the automation is triggering often, you can see the last 10 traces to help you decide what the issue is.
HA Docs on this here.

trace:
  stored_traces: 10

:envelope_with_arrow: Version Updates

Updates will be published on my GIT repository with the rest of my Home Assistant Blueprint collection.

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

:calling: Software to Download :floppy_disk:

HA link to download blueprint: Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Direct link to download Blueprint: https://github.com/SirGoodenough/HA_Blueprints/blob/master/Automations/Zigbee2MQTT-Xiaomi_Cube_Controller_MQTT_Triggered.yaml

HA_Blueprints/Automations/Zigbee2MQTT-Xiaomi_Cube_Controller_MQTT_Triggered.yaml at master Ā· SirGoodenough/HA_Blueprints Ā· GitHub.

:globe_with_meridians: All My Blueprints

Link to ALL my Blueprints

https://github.com/SirGoodenough/HA_Blueprints/blob/master/README.md

:man_juggling:t5: Contact Links or see my other work

What are we Fixing Today Homepage / Website: https://www.WhatAreWeFixing.Today/

Channel Link URL: (WhatAreWeFixingToday) https://bit.ly/WhatAreWeFixingTodaysYT

Discord Guild: (Sir_Goodenough#9683) WhatAreWeFixingToday?

:cheese: If you want to support me

Buy me Coffee: https://www.buymeacoffee.com/SirGoodenough

PayPal one-off donation link: PayPal.Me

#WhatAreWeFixingToday

#SirGoodEnough

60 Likes

Hi all,

I can not find the sensor: sensor.xxYour_Hamexx_action
I can only see :

  • action side
  • action to side
  • action from side
  • action angle

How can I create a custom sensor with only action?

Make sure the action sensor is enabled.

Maybe my z2m config but I donā€™t understand why only 4 sensors are present and not 5

Above is looking at the Device in Home assistant. That is where you enable or disable entities for the device. I have the action enabled, and I have the other 4 disabled as I donā€™t use them.

You canā€™t really make one. It should be part of the presets for the Device as Z2M finds it.
I am assuming you are using current version of Z2m.
Does the firmware on your device match mine?

I am using the addon,
Screenshot_2022-04-06_03-53-29

1 Like

Iā€™m not using add-on but docker version of Z2M
http://www.citrowallon.com/hass/hassio-magic.png
http://www.citrowallon.com/hass/z2m-magic.png

Is that docker container up to date?
Otherwise not sure what to say, your Z2M is not creating the sensor.
There is something called ā€˜actionā€™ in that 2nd picture, I donā€™t know what that screen is however.

Z2M ui probablyā€¦

I have Legacy API enabled. Sometimes that setting messes with devices differently.

Screenshot_2022-04-06_04-14-07

Same configuration for Legacy API.

Thank you very very much. fifth sensor is present now.

1 Like

What was it, may I ask.
In case others find the problem.

enabling of legacy API. It was disabled on my Z2M config.

Iā€™ve just forgot to add ā€œnowā€ in my previous message about ā€œLegacy APIā€

1 Like

I have fixed the Documentation to prevent this problem in the future. It is fixed on the Git Repo but I have not pushed it up to here yet because I anticipate other changes this week related to todayā€™s 2022.4 release and the multiple entity selector.

Donā€™t forget to click the :orange_heart: in the top document if you find this useful.

2022-04-11: No Code Change. Added guidance to solve missing Action Sensor condition in this document.

In the Dimmer Control example, I think the second line above should be {% if new_brightness < 5 %}, right? I found that if the light was off (cb == 0), I couldnā€™t turn it on, until I made that change.

Setting it up to control my home theater lights, volume, and a few other things. Only issue Iā€™m running into is if I pick up the cube and rotate it to a face (e.g. face #2 for volume control) and then put it down to rotate it, often it doesnā€™t pick up the face change, and thinks itā€™s still on face #1 (lights). I guess the cube expects to be ā€œflippedā€ to a face while on a table, not picked up, rotate, and put back down.

Thanks for the blueprint fork! Having lots of fun with itā€¦

Good catch. Iā€™ll fix that right away.

Yes, my solution is to set it on another side and 90-it to the correct side. There is the 1 second delay so you canā€™t be too quick, though. Pop the entity sensor somewhere in a dashboard and move the cube around, you will see what works and what doesnā€™t

I did see a de-bounce setting in Z2M but havenā€™t played with it yet, that may help here. One of these days.


UPDATE: doneā€¦

  • Example code bug fix from Michael Fischer
    2022-04-17 - Added new blueprint link to the family
    2022-04-26 - Re-configure to add 30 Action Methods 74 total nowā€¦

!!NOTICE!! If you are upgrading the Blueprint, upgrade the template sensor as well. The variables are differentā€¦

New Update todayā€¦ (27-APR-2022)

NO Blueprint CODE changesā€¦

Just some scripts to show you how to add 24 more actions using some template magic. LOOK HEREā€¦

  • 2022-04-26 update-A UPDATE: No code changes. Added examples to provide 24 more ways to trigger something using the rotate sensor as a device toggle, both long and short for each rotate sensor.

New Update todayā€¦ (29-APR-2022)

NO Blueprint CODE changesā€¦

WE ARE NOW AT ABOUT 128 WAYS TO TRIGGER, ( at least 128, maybe moreā€¦ )

Just some scripts to show you how to add 30 more actions using some template magic. LOOK HEREā€¦

  • 2022-04-26 update-B UPDATE: No code changes. Added examples to provide another 30 more ways to trigger something using conditionals in Group 3 :pear:,

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

Hello,

I got problem with importing blueprints. This is what I get:

image

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.