First, thank you for this blueprint, Iām just starting with zigbee and Iāve learned a lot from this (also saves a lot of work ). I was having trouble with the number.last_side entity not working, then realized it was turning unavailable after some minutes, in the end it was because for some reason my mqtt broker was sending the LWM for homeassistant/status topic, and HA was recording mqtt client disconnected in the logs, the issue fixed itself after updating HA to the latest version.
Anyway, all that to say I was analyzing the blueprint and noticed that the last_side entity is not using the action_from_side data reported when flip90 action is triggered, this creates a scenario when, if you lift the cube and change sides then flip 90Āŗ from and to specific sides (group 3 actions) will not trigger because there was no action to sync the last side entity.
So I added an extra condition in the last_side variable:
last_side: >
{# Check if there is action_from_side data and use that first.#}
{% if trigger.payload_json.action_from_side is number %}
{{ trigger.payload_json.action_from_side | int(0) }}
{# The first time it will not be there, so make sure its 0 instead of undefined. #}
{% elif not num_ha_val in ["undefined", "unknown", "unavailable", "none", "null", ""] %}
{{ num_ha_val }}
{% else %}
0
{% endif %}
With this the flip90 actions are more reliable.
Also, the slide action for side 3 is in the wrong group.
Logger: homeassistant.helpers.template
Source: helpers/template.py:2742
First occurred: 15:36:08 (13 occurrences)
Last logged: 16:12:46
Template variable warning: list object has no element 1 when rendering '{{ieee_id_long.split('_')[1] }}'
Hi! Itās z2m device. This warning have been in the logs for ages. I just updated the script, deleted old automation and pasted old yaml in the configuration and this still pops up.
OK, if you would please write an issue for it. I need to dig in and make all the YAML changes to current non legacy, so will look at it then.
I donāt see it in my log, so give me info about your device and related so I can track it. It may be a problem with how you have named the device or something, donāt know.
Iāll be contacting you when I work on it.
Z2M version 2.x has dropped. This means if you install that, you will need to make a change to your configuration in order to use Zigbee2MQTT - Xiaomi Cube Controller.
I have not yet made changes to accommodate for the update, and my changes are going to be likely using the Home Assistant experimental event entities.
So to accommodate the change, I will be asking you to change 2 buttons in the Z2M set-up screen in the User Interface (UI) screen.
Home Assistant legacy action sensors So that it will work now until I update this and
Home Assistant experimental event entities for later so it works after I update this.
Also leave Enabled checked as well. It should look similar to that photo when you are done.
Sorry for any inconvenience this is causing you. I wanted the dust to settle a bit so that I could see the final version of the change before I updated my stuff. In the end I think this is a positive change and will make programming these devices a lot easier for everyone.
I can not get it to work - it registers the _action, but the initial check for a change in state yields a āfalseā, and as such it never proceeds beyond this ANDā¦
So, did you read the post directly above?
I have not edited these yet, and when I do it will likely use the event type triggers, so click botn the empty boxes like the post suggests.
Yes I read your post and clicked the both checkmark boxes but still had the same problem as @toppot. After I added the mentioned line about the legacy_entity_attributes, your (marvelous) template started working again. If I put this parameter on false again, the first step in the automation always result in a āfalseā.
I found this parameter Here. I first put all the parameters to ātrueā, so everything was working again and then set the parameter one by one to false again until the automation stopped working
This is the relevant part of my current configuration.yaml
This is good info, thanks. Are you using a docker to host Z2M?
Because on mine, I seemed to only have to change the parameter I showed above in the UI to make mine work. I didnāt change the Add-on Configuration.yaml.
However if this works, it is indeed a good way to go.
Same, but I think when you change the button in the UI, thatās all you need. I didnāt have to change the config and there is no legacy attributes button in the UI that I changed anyway. Yes that condition is a legacy attribute.
After the conversation of yesterday I removed the extra parameters in the zigbee2mqtt, keep the two checkboxes checked and restarted HA and magically the template works, just as you described in your original post. The only thing what differs from my first attempt is the version number of the zigbee2mqqt add-on, this is now 2.0.0-2, but based on the information in the changelog I canāt explain the different behavior. But nevermind it is working