šŸ§Æ ZHA - Xiaomi Cube Controller

@Sir_Goodenough Thank you for all your hard work on this. The blueprint looks fantastic. I have what I hope is a quick (albeit bone-headed) question. I read through everything here including your tidbit about the T1 Pro missing functionality in zigpy. In my case I only seem to be able to trigger rotation (right/left) and ā€œshakenā€ events. I considered the cubeā€™s mode is incorrect, but the scene mode doesnā€™t appear to support rotation, so Iā€™m assuming Iā€™m in action mode. Any tips?

Scene mode does rotate. You are in scene mode, switch it to action mode.
Here is a jump link to a list of what happens in action mode and scene mode with Z2M anywayā€¦

Awesome. Thank you. Changing the mode seems to have done the trick. I do have one more question. I noticed that when you describe the helper entity, you indicate the range should be 0-6. Iā€™m curious as to why itā€™s not 0-5 (assuming that 6 would actually be out of range).

Thanks again for all your help and hard work.

0 to 6 or 0 to 5 would be fine there. Either will work.
It was a carry-over from when I used to need to have people make an input helper for Z2M, which is the BP I built first.

I now build the input helper for you in the Z2M ones. I would do that here if I couldā€¦

I have added 3 new script blueprints to replace the yaml scripts I had offered as samples before. I have also cleaned the coding up on these and simplified them.
They may now be suitable for use in other people Blueprints and/or your bare automation to help with light dimming with the cube, color change with the cube, and simulating long / short button press with the cube.
I am now working on one to do volume control.

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

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

Cube Long/Short Press Simulation: Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

2 Likes

Hey @Sir_Goodenough, Iā€™m using your BPs and they work flawlessly, thank you so much!

I was wondering about volume control - you mentioned back in April that you were working on one. I was curious to see how far you got. I was also wondering if I could adapt the light dimmer script yaml by changing domain from light to media_player (and a few other things). I did try instead using a basic binding of cw/ccw to media_player.volume_up/down, which does work, but the rotation fidelity isnā€™t smooth or consistent so I was looking for something nicer.

Try changing the multipliet so that you have to spin it way more times. This will smooth it out some. Otherwise we would have to make it do 5% bumps each time it detects a movement.
There is a helper BP I wrote in my library which does ā€˜short pressā€™ / ā€˜long pressā€™. You could move the volume like 5% on the short and 10% on the long?
Just thinking out of the box on how I would do this.

I am in the middle of an update of all my BPā€™s right now, so if you come up with something you think works well, drop it into an issue as a feature request, we can incorporate it in as a helper BP or something.

1 Like

I opened a feature request. It would be helpful if you could add any code you tried so far or details that would help me. I am not much of a media player person and want this to work for you (everyone)ā€¦

I have a beta version of the volume control BP Iā€™m about to release if you want to test it.
It is your request after all.

(For future inquiriesā€¦) This link will not work forever and will eventually get merged into master upon release then deleted. Change ā€˜Nuggetsā€™ to ā€˜masterā€™ and you should be able to find it again.

NEW UPDATE:

Hi!

I have your blueprint woking and set up the dimmer script. It works great!
Before using the dimmer scrrpt I set up cw and ccw rotation to change light brigthness. This way I can set transition time as I want. Is there any way to set transition time with the dimmer script? I would like to smooth the transition between brightness settings.
Iā€™m really new to this.

Thanks!

I donā€™t plan on doing so, but between the dimmer script and the volume script and other examples in the exchange, you should be able to craft something that works for transition.
Give it a shot, itā€™s just yaml.

Iā€™ll give ir a try. I have never used YAML
But firs I have to solve another isue. The cube works when I pair it but after an hour it doesnā€™t respond anymore

Itā€™s probably asleep. Trigger it on one of the triggers not used, then try the one you want. If you are using this BP, you can install the sensor I built to see when the cube is responding, without having to have an action on everything. It helps you learn what physical actions are needed to make it happen.

I was looking in the device feed on ZHA. When the cube works I see triggered actions even if the donā€™t have automations asdociated (unused gestures). But after an hour is like communication between cube and coordinator is droped. Iā€™m using an XBee3 dongle (supported but not recommended). Tomorrow Iā€™ll receive a Sonoff dongle.

Hello Team,

I get follow error : : Error: UndefinedError: ā€˜dict objectā€™ has no attribute ā€˜eventā€™
The cube is available in HA with Sonoff Zigbee 3.0 USB Dongle Plus - Sonoff Zigbee 3.0 ā€ŽZBdongle-P
any idea ?

Thanks W1z

You have to trigger it using the cube device. That error looks like you are hitting run in the ui editor.

Hi Sir Goodenough,

looks like I was not good enough :slight_smile: that was the solution. I tested it with the run in the gui not with the device.

Many thanks
W1z

1 Like

NEW VERSION

:bookmark_tabs: Changelog

Hi, thanks for your impressive work and documentation!

I have the problem that i canā€™t switch the mode. Iā€™am in Scene mode and tried so many ways to switch it. I tried it paired, unpaired, wait 5 mins. Nothing works.

Iā€™am Using ZHA, with Sonoff ZDBDongle-E (the newer verion and not P). I can see all the actions when I configure an automation, just the events are not fireing. Only rotate and shake.

Does anyone has a tip?

Edit: I just saw that slide is working too but battery is unknown