From 3e9b3e6c49a37d2497a9564f9bedc6f5a413ec2a Mon Sep 17 00:00:00 2001 From: k4in <26797756+K4in-5037@users.noreply.github.com> Date: Tue, 16 Jul 2024 20:28:40 -0600 Subject: [PATCH] improve flip90 action Add a condition to check for action_from_side data and use that value in last_side variable. Move slide face 3 action to the correct action group. --- ...QTT-Xiaomi_Cube_Controller_MQTT_Triggered.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Automations/Zigbee2MQTT-Xiaomi_Cube_Controller_MQTT_Triggered.yaml b/Automations/Zigbee2MQTT-Xiaomi_Cube_Controller_MQTT_Triggered.yaml index f4d4a14..de50aa6 100644 --- a/Automations/Zigbee2MQTT-Xiaomi_Cube_Controller_MQTT_Triggered.yaml +++ b/Automations/Zigbee2MQTT-Xiaomi_Cube_Controller_MQTT_Triggered.yaml @@ -294,11 +294,6 @@ blueprint: default: [] selector: action: {} - slide_face_3: - name: Group 1 actions 🍎 Slide the cube with face 3 up - default: [] - selector: - action: {} side_3_group_1_actions: name: Side 3 Group 1 actions 🍎 @@ -308,6 +303,11 @@ blueprint: These are Group 1 actions that happen with Face 3 of the cube up to start. input: + slide_face_3: + name: Group 1 actions 🍎 Slide the cube with face 3 up + default: [] + selector: + action: {} doubletap_face_3: name: Group 1 actions 🍎 Double tap the cube with face 3 up default: [] @@ -907,8 +907,11 @@ variables: # Get the last_side for use in logic below. 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. #} - {% if not num_ha_val in ["undefined", "unknown", "unavailable", "none", "null", ""] %} + {% elif not num_ha_val in ["undefined", "unknown", "unavailable", "none", "null", ""] %} {{ num_ha_val }} {% else %} 0