Yes, this blueprint is recently updated and I’m running this version. You can import by url or copy/paste the template.
I have subscribed to the zigbee2mqtt topic and I can get the actions of the cube when I slide it or rotate it etc. However I dont get the extra information like which side is facing up? I only get the original basic actions of the cube.
I’ve subscribed (node-red) on the same topic and below is an example from a received message including side-information.
"{"level":"info","message":"MQTT publish: topic 'zigbee2mqtt/0x00XXXX000XXXXX', payload '{\"action\":\"flip90\",\"action_from_side\":4,\"action_side\":0,\"action_to_side\":0,\"angle\":77.56,\"battery\":86,\"from_side\":4,\"linkquality\":84,\"side\":0,\"to_side\":0,\"voltage\":2975}'"}"
Thanks @luckypoppy I tried and get the same payload as you.
Do you know how to extract the action and side as a simple str in python?
So I had a question about using this blueprint. What should the entity be that I look at? I see multiple sensor.magic_cube_action, sensor.magic_cube_action_angle, sensor.magic_cube_action_from_side, sensor.magic_cube_action_side, sensor.magic_cube_action_to_side, sensor.magic_cube_linkquality. I thought, it would one entity like sensor.magic_cube…
I am using the “sensor.magic_cube_action_side” and that is working fine.
Ok, I’ll give that a try.
I had some issues with this blueprint and used it as inspiration to make a better version: Home-Assistant-Blueprints/zigbee2mqtt_aqara_magic_cube.yaml at 9a63ee03f1d0cf10448fb89a28528ac4105461ac · golles/Home-Assistant-Blueprints · GitHub
Thank you so much for this updated blueprint! I had it working with my cubes a week or two ago with zigbee2mqtt in a separate docker container. But they stopped working and I can’t tell why. The cubes talk to z2m, z2m sends mqtt to hass’s mosquitto, mosquitto shows that the mqtt events are received, the entities in hass show their states, but the automation won’t fire. I don’t get where the disconnect is.
I’m not quite sure how to troubleshoot it since the automation won’t fire at all, so a trace doesn’t exist to debug.
Didn’t work for me.
Checked the automation trace and it stops on the condition.
I have the same issue . Things where working for quite a wile. But now the automation stopped working.
I might be related to some recent updates of either homeassistant core, homeassistant host or Zigbee2mqtt .
Home assistant is running on a raspberrypi4 and a CC2531 USB stick is used for Zigbee.
MQTT server runs externally.
The MQTT integration in homeassistant does not show any entities in the Aqara device MQTT info.
It seems like the MQTT addresses exposed by Zigbee2MQTT did change and therefore the auto MQTT discovery in homeassistant no longer works.
Looking at the published MQTT messages (using MQTT Explorer), the only aqara related (retained) topic I see in /homeassistant
is: /homeassistant/device_automation/<my_aqara_id>/action_shake/config
. Containing the following message:
{
"automation_type": "trigger",
"device": {
"identifiers": [
"zigbee2mqtt_<my_aqara_id>"
],
"manufacturer": "Xiaomi",
"model": "Mi/Aqara smart home cube (MFKZQ01LM)",
"name": "Aqara",
"sw_version": "Zigbee2MQTT 1.21.2"
},
"payload": "shake",
"subtype": "shake",
"topic": "zigbee2mqtt/Aqara/action",
"type": "action"
}
Solved my problem. Not sure how
After adding some new zigbee lights, I was not able to add more lights. Google gave me the tip to unplug the zigbee USB stick and plug it in again.
After this action, I was able to add the remaining lights.
The next day I found out that my aqara was working again
Inspcting the /homeassistant/device_automation/<my_aqara_id>
topic now also shows the topics action_wakeup
, action_slide
, action_flip180
and some others.
I’ve just received my cube but can’t get either of the blueprints in this post to work. The trace gives an error of
Error: UndefinedError: ‘dict object’ has no attribute ‘to_state’
The entities which have been created in HomeAssistant are:
sensor.cube_action
sensor.cube_action_angle
sensor.cube_action_from_side
sensor.cube_action_side
sensor.cube_action_to_side
sensor.cube_battery
If I look at the mqtt package it looks something like this:
{“action”:“rotate_right”,“action_angle”:68.02,“action_from_side”:null,“action_side”:null,“action_to_side”:null,“battery”:74,“linkquality”:108,“side”:2,“voltage”:2955}
I can successfully create a simple automation doing something like watching for a shake or a drop but I’d prefer to use a blueprint which might increase the options.
I’m guessing things have changed in HomeAssistant and maybe zigbee2mqtt recently which has upset the formatting of things. Any help would be much appreciated.
OK - more information - the following entities aren’t updating at all:
sensor.cube_action_angle
sensor.cube_action_from_side
sensor.cube_action_side
sensor.cube_action_to_side
although the MQTT messages are updating. Looks like something is up with how Homeassistant is interpreting the MQTT messages.
I tried to use this blueprint but it fails to work. I’m using Homey as my zigbee hub, this send the data through via mqtt, have mqtt broker & hub running on homey and added mqtt on HA.
The cube from Homey is visible in HA as mqtt device, I see the changes in the cube device but the blueprint does not work.
Do I need to change anything in the blueprint code to get it to work with this setup? is this only for zigbe2mqtt and Conbee II stick or should this also work with my Homey as MQTT broker?
I could not get this to work either. The “action” sensor doesn’t have an action attribute, nor a side attribute. I eventually just switched to using an MQTT trigger, rather than an entity trigger.
trigger:
- platform: mqtt
topic: !input 'remote_mqtt_topic'
condition:
- condition: template
value_template: >-
{{ trigger.payload_json.action in ('rotate_right', 'rotate_left', 'flip90', 'flip180', 'slide', 'tap', 'shake', 'fall') }}
action:
- variables:
event: '{{ trigger.payload_json.action }}'
sub_event: '{{ trigger.payload_json.side }}'
event_angle: '{{ trigger.payload_json.action_angle }}'
Hello,
The blueprint works well. I spent some time on an automation where the brightness will increase by action angle.
here is the automation action:
service: light.turn_on
target:
entity_id: light.led_stripe
data_template:
brightness_step_pct: "{{ trigger.to_state.attributes.action_angle * 0.4 }}"
I hope it helps someone.
I’m seeing the following trigger, which doesn’t match what this blueprint expects:
trigger:
id: '0'
idx: '0'
platform: state
entity_id: sensor.0x00158d0005d9d322_action
from_state:
entity_id: sensor.0x00158d0005d9d322_action
state: None
attributes:
icon: mdi:gesture-double-tap
friendly_name: cube-k action
last_changed: '2022-01-07T04:40:57.421837+00:00'
last_updated: '2022-01-07T04:40:57.421837+00:00'
context:
id: ba971f749101817d6781218323d7c368
parent_id: null
user_id: null
to_state:
entity_id: sensor.0x00158d0005d9d322_action
state: slide
attributes:
icon: mdi:gesture-double-tap
friendly_name: cube-k action
last_changed: '2022-01-07T04:40:57.422376+00:00'
last_updated: '2022-01-07T04:40:57.422376+00:00'
context:
id: cd2c98be8ca4a3f9b43d36ac0e28bad9
parent_id: null
user_id: null
for: null
attribute: null
description: state of sensor.0x00158d0005d9d322_action
In particular, this blueprint is looking at trigger.from_state.attributes.action
, but the data is showing up as just trigger.from_state.state
. Did something change at some point? I tried with both legacy=true
and legacy=false
in zigbee2mqtt.
One quick question. How can I identify which face of de cube is up? Is not possible to use the last face which is up as 0 face? Like the original cube does with Xiaomi app.
Thanks!
I have the same issue, did you find a resolution?
I just go my cube and connected to zigbee2mqtt.
MQTT Explorer shows correct at first then publishs again and then shows null on everything…
{"action":"flip90","action_angle":null,"action_from_side":3,"action_side":5,"action_to_side":5,"battery":38,"linkquality":57,"side":5,"voltage":2875}
{"action":"","action_angle":null,"action_from_side":null,"action_side":null,"action_to_side":null,"battery":38,"linkquality":57,"side":5,"voltage":2875}