šŸ§Æ Zigbee2MQTT - Xiaomi Cube Controller

Hmm.
Iā€™ll have to see what I have different on mineā€¦

OK. I have left legacy stuff on. When I look at MQTT-explorer the topic zigbee2mqtt/yertle (which is the cube name and is the topic Iā€™m using to grab the changes) has the angle as an attribute. I see it, mine is working.

Screenshot_20221220_054204

What are you seeing?
What topic are you using?
If you are using the equiv of zigbee2mqtt/yertle/action, that wonā€™t work.

Screenshot_20221220_054626

This is the script Iā€™m usingā€¦

I have turned on all Legacy settings:
image
image

It seems that Iā€™m not getting the ā€œangleā€ payload piece. I get the action_angle though:

image

I am using the cube name (Cube1) as the topic:

And again, it looks like ā€œangleā€ isnā€™t included in the payload as it is in yours.

Maybe I could use ā€œaction_angleā€ as the input?

EDIT: Sure enough, "changing the code to use ā€˜{{ trigger.payload_json.action_angle }}ā€™ has it working as expected. :man_shrugging:

Iā€™m having the same exact issue.

This is my automation from the blueprint: dpaste/XtSiD (YAML)

home assistant log errors: Imgur: The magic of the Internet

I looked in mqtt explorer and see the mqtt messages showing it working for shake, tap etc. I also see the home assistant actions showing the expected actions. Thereā€™s some issue with the blueprint that home assistant doesnā€™t like and throws those errors in the log.

I just tried the shake action to control an area with light.toggle like you didā€¦ it works for me OK

      shake:
      - service: light.toggle
        data: {}
        target:
          area_id: office

The only difference I see from your example is my area is using a friendly name, and my Cube name contains no spaces.

For light.toggle, entity_id is a required parameterā€¦

I donā€™t see where it talks about area toggles. But if it worked with a name, I would go with that.

Whatā€™s your cube model or firmware and version / type of Z2M. If I need to change it I can, trying to figure out exactly why, however. I also have action_angle, but was weird about using it because it goes to null sometimes. Maybe itā€™s right when it needs to be, but that would need to be tested.

My cube reports as: MFKZQ01LM
Iā€™m not sure how to extract the firmware version.
Z2M running in HASS, directly installed on Raspberry Pi with Sonoff 3.0 USB dongle:

image

I changed this specific setting in Z2M settings for the cube (it was un-set before):
image

And suddenly, I get this:

image

Success! I guess I should leave all the other Legacy things enabled as well? Everything seems to work with my other Zigbee devices.

1 Like

I deleted everything and started fresh and changed the name in z2m to one with no spaces and it all works. Thanks for the help and man what a great blueprint I really appreciate it!

1 Like

Well itā€™s a good thing to know that a space in the topic is bad. I will add that to the instructions. Thanks for contributing!

OK, so itā€™s another legacy attribute. I will check it all over and adjust things. Thanks for contributing. I will have another version in a day or 2 . All the changes likely to be documentation.

Thank you so much James! Iā€™m happy to help however I can :slight_smile:

Added bug fixes from above 2 problems
Thanks:
Profile - brainhig - Home Assistant Community
Profile - bharvey88 - Home Assistant Community

  • 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.
1 Like

Hi sorry, Iā€™ve been scanning this thread for weeks and trying to figure this out.

  1. I have zigbee2mqtt and the aqara cube is shown

  2. I installed the blueprint.

but literally nothing happens. Iā€™m trying to keep it simple with just 1 thing ; to see how this works.
How can I further investigate this to provide helpful questions for experts here ?

The blueprint has had 3 revisions since 2022-12-01, so I donā€™t know what version you are running.
I also need to see your automation yaml to know anything.
There is an extensive write-up about how it works and what is needed to get you started. This is literally a switch with a hundred places to toggle it.
Also there is the description about the event sensor that I wrote in here to help you get oriented on using the cube. Have you tried setting that up?

I need more info to help you.

Hi @Sir_Goodenough , thx for all the work you have put into this Blueprint. I have an issue I am hoping you can help me with.

Imported the latest version of blueprint
Created Automation (added my cube MQTT topic) and just Group 1 action Double tab the cube with gace 0 up
It is to activate a scene

When I double tap the Cube, I see this in the Logs:
Error while executing automation automation.magic_cube_automations: TemplateError: Must provide a device or entity ID

Here is my Automation yml

alias: Magic Cube Automations
description: Automatons related to Magic Cube
use_blueprint:
  path: SirGoodenough/Zigbee2MQTT-Xiaomi_Cube_Controller_MQTT_Triggered.yaml
  input:
    topic: zigbee2mqtt/Magic_Cube
    doubletap_face_0:
      - service: scene.turn_on
        target:
          entity_id: scene.all_lights_off
        metadata: {}

Thank you!

I have not used scenes in my set-up at all, but I would expect that they work.
The complication here is, is the scene working. I would test that the scene command you are using works outside of the blueprint, maybe call it up in developer tools. Open your Home Assistant instance and show your service developer tools.
I would also test things by using light / switch toggle to control a single light / switch, just to get you going.

I changed the action to call service with light off , still get the same error in the logs. TemplateError: Must provide a device or entity ID

Removed the Automation and BluePrint, re added BP, then automation with call service, even changed the automation name(just in case) still same error in Logs !

@Sir_Goodenough got it working!!! lool, It was the device name, after seeing your note about spaces, I changed it to ā€œMagic_Cubeā€ ā€¦ I guess ā€œ_ā€ is still a no, changed device to Magic and everything is working now!!!

I thought underscore would be fine. I guess notā€¦ Good catch.
UPDATEā€¦
I did some further testing, and found if the friendly_name in HA doesnā€™t match the friendly_name and topic in Z2M, you get this error.
Therefore I added some pictures and text to show how to fix and avoid this problem. I also cleaned up a little of the discovery codeā€¦

  • 2022-12-28: Code cleanup.
    • Add note to fix configuration conflict template error:
    • Error while executing automation automation.friendly_name_automations: TemplateError: Must provide a device or entity ID