Aqara Cube ZHA - Simplified face-based device control

That would be why, I’ll upgrade to 2022.2.

1 Like

Works great with 2022.2. Thank you!

1 Like

FINALLY!! A ZHA cube blueprint that works!! Thank you!!

1 Like

Can you use the angle of rotation in ZHA or is that only available in Z2MQTT?

Angle is also available on ZHA.
What is your use case? Maybe I can adjust this Blueprint to use the angle.

Want to use rotation to dim lights/control volume. I think the angle can act as a multiplier for the dimming value.

If you see in this Blueprint, the flip_degrees is available as a local variable. The Blueprint was made to support any action (not only light), so angle is not used as a parameter.
In order to use this, a new Blueprint (or automation) will be needed, with small modification.

Do you have any experience with building your own automation with YAML or do you wanna help building it?

By the way, I’ve used increase/decrease brightness as actions and it works fine. It’s probably better than using degree as you don’t have to calibrate it.

Also, I cannot test right now, but most likely the Blueprint that I’ve created will work as it is if you select “call a service” as an action for one of the turning sides and then adding the variable as a template in YAML mode:

EDIT on 2022-05-07: Use relative_degrees or trigger.event.data.args.relative_degrees instead of flip_degrees.

I’ve tried both in automations before and prefer the one using degrees as a multiplier. If you set it right, you can get finer control over the adjustment. Low angle = low change in brightness/volume. High angle = high change. Versus a static X% no matter how much the turn angle.

hi thanks for your blueprint!

I have 3 of these cubes and they control various thongs like blids, fans, lights, etc. I’m currently using the 51 action blueprint one now, besides geting erros messages in the my log files when I rotate the cube:

Template variable warning: 'dict object' has no attribute 'flip_degrees' when rendering '{{ trigger.event.data.args.flip_degrees }}'

2:24:17 PM – (WARNING) helpers/template.py - message first occurred at 2:24:06 PM and shows up 28 times

just curious what your blueprint does that is better than the 51 action one? I’d be happy to change to this!

Have you tried using flip_degrees as in my last example?

Hi @Anto79-ops,
I don’t know which Blueprint you are talking about. Please share the link here and I can try to identify the difference between them.
By the way, this is not a competition between blueprints. :wink:

It’s the wrong zigbee flavor, but if you are able to get the angle into my template, this template logic I suggest for angle actions should work for you… (This is a link to the dimmer control section)

At that level, it’s just an action. You would need to pass the angle in. Z2M gives me pos angles for CW and negative angles for CCW, so the template doesn’t change and called script gets used for multiple sensors.

I also provide in there a scheme to set the R, G, & B Colors using rotation, and another section to use a short rotation for a short press and a larger rotation as a long press. These are all template things you can do regardless of the Zigbee flavor as long as you can get the angle out of the Integrations Data Attributes.

@EdwardTFN thanks!

Here’s what im using now, its in your OP

I tried your blue-print, and it acutally fixes that error in logs that I posted above! so that is great news.

With your blue-print, how does one:

  1. set a command to fire when, for example, something is flipped from side 1 to side 2

@Sir_Goodenough

its sounds like things are greener over at the Z2M side, in terms of features. I’m slowly building up momentum to make the switch. That’s an impressive blue-print for the cube!

That is simply an action sensor called by te zigbee stuff. It’s a Home Assistant script.

If ZHA has the angle as an attribute, that is the input and the rest should be close.

1 Like

I was about to try Z2M when I got this cube and couldn’t find so much material, but in the end I invested a bit more time to learn a bit more on how to work with events and discovered I can have very similar capabilities with ZHA, with an smoother user experience, so I decided to stay.

Maybe I can help you here… What you want is that Blueprint converted for ZHA?

1 Like

On my Blueprint I don’t take in account the “from” side, I just use the side the needed showing up after each action.

1 Like

@EdwardTFN @Sir_Goodenough

Sometimes simplicity the best solultion, I can guarantee you that if I start talking about angles to control devices with my wife, she is going to through that cube out the window.

I think in my household, I will be using both your blueprints :smiley:

thanks again for your awesome dev work here!!

1 Like