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.
Same here. No errors visible. But the automation didn’t work. I renamed my device in z2m as cube01 instead of switch.cube01 (i.e. removed the full stop / period) and it worked. Thank you!
Dimming blueprint - you should change the sensitivity description. It looks like it should take whole numbers. But if you use the default 40 for sensitivity, it becaomse 40x not 40%. So you need to input via YAML as 0.4 to get something reasonable!
Oops…
Pulled the wrong variable down…
Should be fixed now…
It;s meant to have the whole percentage in the top to make it easier for people to understand.
Good catch, sorry for the bobo.
I have a dumb question. I am trying to use the cube as dimmer. Clockwise will brighten the light no problem, however it does not dim counter clockwise. Am I missing something?
The examples I provide work for me. Check your code closely, there might be a typo in the CCW action or something.
It could even be in my code, I don’t always test 100% after updates. That one got a few updates recently.
Reading from the instructions, should it not just read the angle as negative and dim? Im sorry if I am incorrect, your blueprint looks like amazing work. Its just so big and complicated for new users. Not a complaint, just an observation from a new user of your blueprint.
EDIT: So I am an idiot. I wasnt using a minus sign ( - ) for my angle
I know there is a lot there but I try to break it down to smaller pieces to keep it from being overwelming. I added a lot of documentation and that keeps evolving. As questions are asked, I make sure the question is also clearly answered in the docs. That is a selfish thing because I really want to avoid answering the same question multiple times.
You have done excellent work, please don’t take my comments in a negative way. Its a massive blueprint that is just a little overwhelming. Anyway thanks for the reply, keep up the good work
Hi, thank you for the fantastic blueprint.
Unfortunately cant start to use it in a proper way.
Have error: Error: TemplateError: Must provide a device or entity ID
I checked names in Z2M and HA - some. Here is some data:
Automation:
id: '1685741194708'
alias: Aqara Magic Cube Zigbee2MQTT MQTT Triggered - 2023-03-01
description: ''
use_blueprint:
path: SirGoodenough/Zigbee2MQTT-Xiaomi_Cube_Controller_MQTT_Triggered.yaml
input:
topic: zigbee2mqtt/Aqara Cube
flipped90_any:
- service: switch.toggle
data: {}
target:
entity_id: switch.smart_plug_01
If there is anything else I can provide to clarify what I’m doing wrong, please let me know. I really appreciate any help you can provide.
and to fix it…
This is clearly covered in the Exchange post (post 1 above), in the Instruction file in my GitHib, and in the description YAML when you load the Blueprint.
Yes, I saw it.
I changed the name from Aqara Cube 01
to Aqara Cube
with checked Update in HA
control.
Also MQTT topic was updated from zigbee2mqtt/Aqara Cube 01
to zigbee2mqtt/Aqara Cube
.
I also created another Automation from the blueprint.
That’s why I’m so confused.
Updated: just found Never use spaces in a topic
.
Updated 2:
Just tried. Still same error.
Am I missing something?
How did you change the name? Did you use the second link I added above?
Yes, I used your second link.
I open Z2M Web UI, open Aqara Cube
device, pressed blue “Rename device” btn, changed the name, and switched the slider “Update Home Assistant entity ID” to the selected position (made it blue).
Can make small video recording if it could be helpful.
So now there is an underscore in there, another non alphanumeric character…
In order to make things easier for you and determine the friendly_name from the topic, it strips everything that is not [^A-Za-z0-9] from that section of the topic to take it’s best guess at the friendly name that HA is using. That includes the spaces you were using and the non alpha underscore. It’s one of the tricks I used to make this work. I’m not sure how to state this clearer in the instructions.
QUOTE: ( This blueprint has been known to freak out when there are spaces in the MQTT Topic. Make sure there are no spaces and there are all ASCII characters in the topic, (/
is ok) )
# Generate the Friendly_name from the Topic.
friendly_name: '{{ topic_var.split(''/'')[1] | regex_replace("[^A-Za-z0-9]", "") }}'
I have been considering doing some testing to change the code and let the underscores thru, to see if everything will still work, but that hasn’t happened. It has been easier to tell people to just use numbers and letters as most people have figured this out so far.
If you or someone wants to play with the regex filter and test this out to leave other things in, be my guest. I know spaces are a no-go but leaving underscores or converting spaces to underscores are all things that could be tested if someone wants to put in the work. This is available for a pull request if you have improvements.
Super! Now it works.
Thank you for your help.
I think you can mention in FAQ that the name should be in 1 word with only letters or numbers.
Because now it’s a bit misleading - on the screenshot we see Jens LED Bed
that contains whitespace (and the slider is off).
About regex - probably I will play around, but later. Atm I’m in the process of moving my HA from standalone HASSIO to Docker HA running on Proxmox ubuntu VM.
Thank you one more time.
I did some edits to the instructions and the BP Description. Dropped a minor version to distribute.
- 2022-03-01-A: Beef-up the note not to use spaces and non alpha in MQTT topics.
I opened a feature request to add a volume control BP ti use with magic cubes.
It would be helpful if anyone that has done this who wants to share their code 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 test version ready.
For anyone interested, please give it a try and let me know how it works…
hi
i try to set up the dimmer scrip.
but the dimming / rotating function is not working what so ever.
Is there a tutorial or video which one can follow to set it up?
Found one:
https://www.youtube.com/watch?v=bTOwLdBba5Y&t=288s (recommend using subtitles)
with kind regards