updating configuration

This commit is contained in:
Your Name
2026-03-10 07:08:59 +00:00
commit 9498a076ee
238 changed files with 18119 additions and 0 deletions
@@ -0,0 +1,919 @@
blueprint:
name: Aqara Magic Cube Zigbee2MQTT MQTT Triggered - 2023-10-20
author: SirGoodenough
description: "This Blueprint uses a Zigbee2MQTT built sensor to sort out the 38(+54)
unique commands available from the Xiaomi Magic Cube Remote. (Some unique commands
are available thru templating only. See the related document.)\nThe split out
of functions gives you the ability to assign local scripts or functions to do
the things you want the remote to do.\nFunctions that are left empty will simply
do nothing.\n\n### \U0001F34E There is a set of 36 event functions that will trigger
on specific actions on specific sides that are listed as **Group 1 actions \U0001F34E**.\n\n###
\U0001F34A There is a set of 6 event functions that will trigger on specific actions
on *ANY* side that are listed as **Group 2 sctions \U0001F34A**.\n\n### \U0001F350
There is a set of 30 event functions that will trigger on cube flips to & froma
specific sides that are listed as **Group 3 sctions \U0001F350**.\n\n### \U0001F369
There are 2 actions (shake and drop) that only occur once and are OK to be combined
with any other group.\n\nPlease be aware that ALL actions except the 2 listed
above, \U0001F369 will trigger an action in **ALL 3 groups at the same time**
every time. Therefore I suggest if you just have a couple of things you want this
remote to do that you choose the *ANY / Group 2 / \U0001F34A* events.\nIf you
want more than a few events, you should select actions in **Group 1 / \U0001F34E
OR Group 3 / \U0001F350**.\nWith careful selection you can use mixed groups, but
you run the risk of a single cube action triggering more than 1 Home Assistant
action and making a mess of things \U0001F371.\n\n#### NOTICE: This cube *can*
be triggered 124 ways, but only 38(+54) of them are unique (with templating).\n#####
This blueprint has been known to freak out when there are spaces or odd characters
in the MQTT Topic. Make sure there are no spaces, ONLY a single word, and ONLY
A thru Z, a thru z, and 0 thru 9 in the topic. (``` / ``` is ok between device
and topic) If there are, you will need to change the name of the cube to remove
those characters.\n### IF YOU SEE --> TemplateError: Must provide a device or
entity ID\nIf you get an error like that, The friendly_name in Z2M likely does
not match the friendly_name on HA. To fix go into the Z2M ```Open web UI``` and
set the friendly_name there. Setting this in just HA or in Z2M without ticking
the update HA box will cause this. See the blueprint documentation page for details.\n\nThere
is sample code to make the template sensor in the help file on GitHib named [Zigbee2MQTT
- Xiaomi Cube Controller MQTT Triggered.md](https://github.com/SirGoodenough/HA_Blueprints/blob/master/Automations/Zigbee2MQTT%20-%20Xiaomi%20Cube%20Controller%20MQTT%20Triggered.md)
& in the [community page related to this](https://community.home-assistant.io/t/zigbee2mqtt-xiaomi-cube-controller/393203).\n\nWithin
this blueprint there is an event handler that will latch the last command that
the blueprint finds and sends that to the event buss. From there a simple Template
sensor can grab it and show you the last action sent. Thie will help when setting
up new functions and to troubleshoot strange behaviours.\n\n> This was forked
from https://community.home-assistant.io/t/z2m-xiaomi-cube-controller/263006 1.2
project authored by luckypoppy and the friends he pulled together to create the
base. I sincerely thank Him (Them) for their work. I felt there needed to be more
documentation for rookie users to properly set this up. I had quite a few questions
and when I saw a few questions in that chat from people struggling, I wanted to
help. I also had a better idea for troubleshooting info.\n\U0001F4E9 There is
not an official version control system for Blueprints. However I have found something
that comes pretty close. It is not perfect, but for **MOST** Blueprints, it does
just fine. I encourage you to check this script out and use it to easily check
if I have updated this blueprint. \U0001F517 [koter84 Blueprint Update Script](https://github.com/koter84/HomeAssistant_Blueprints_Update/)\n\n[Community
link for this blueprint](https://community.home-assistant.io/t/zigbee2mqtt-xiaomi-cube-controller/393203)\n"
source_url: https://raw.githubusercontent.com/SirGoodenough/HA_Blueprints/master/Automations/Zigbee2MQTT-Xiaomi_Cube_Controller_MQTT_Triggered.yaml
domain: automation
homeassistant:
min_version: 2023.8.0
input:
topic:
name: Topic
description: "The main MQTT Topic for your cube. \nDetails on finding the correct
topic can be found here: \n[Find my Cube Topic](https://github.com/SirGoodenough/HA_Blueprints/blob/master/Automations/Zigbee2MQTT%20-%20Xiaomi%20Cube%20Controller%20MQTT%20Triggered.md#-to-make-the-blueprint-work-it-will-need)\n"
default: zigbee2mqtt/?
selector:
text:
multiline: false
additional_conditions:
name: Additional conditions
description: "Extra conditions you may want to add to this automation \n(Example:
Home occupied, TV on, etc)\n"
default: []
selector:
condition: {}
slide_face_0:
name: "Group 1 actions \U0001F34E Slide the cube with face 0 up"
description: Face 0 is the one with the 'Aqara' LOGO
default: []
selector:
action: {}
doubletap_face_0:
name: "Group 1 actions \U0001F34E Double tap the cube with face 0 up"
description: Face 0 is the one with the 'Aqara' LOGO
default: []
selector:
action: {}
flipped90_face_0:
name: "Group 1 actions \U0001F34E Flip the cube 90 degrees to face 0"
description: Face 0 is the one with the 'Aqara' LOGO
default: []
selector:
action: {}
flipped180_face_0:
name: "Group 1 actions \U0001F34E Flip the cube 180 degrees to face 0"
description: '**NOTE:** This action is trick to master, and should be used sparingly...
Face 0 is the one with the ''Aqara'' LOGO'
default: []
selector:
action: {}
flip_from_any_to_face_0:
name: "Group 1 actions \U0001F34E Flip the cube from any to face 0"
description: Face 0 is the one with the 'Aqara' LOGO
default: []
selector:
action: {}
rotate_cw_face_0:
name: "Group 1 actions \U0001F34E Rotate cube clockwise with face 0 up"
description: Face 0 is the one with the 'Aqara' LOGO
default: []
selector:
action: {}
rotate_ccw_face_0:
name: "Group 1 actions \U0001F34E Rotate cube counter clockwise with face 0
up"
description: Face 0 is the one with the 'Aqara' LOGO
default: []
selector:
action: {}
slide_face_1:
name: "Group 1 actions \U0001F34E Slide the cube with face 1 up"
default: []
selector:
action: {}
doubletap_face_1:
name: "Group 1 actions \U0001F34E Double tap the cube with face 1 up"
default: []
selector:
action: {}
flipped90_face_1:
name: "Group 1 actions \U0001F34E Flip the cube 90 degrees to face 1"
default: []
selector:
action: {}
flipped180_face_1:
name: "Group 1 actions \U0001F34E Flip the cube 180 degrees to face 1"
description: '**NOTE:** This action is trick to master, and should be used sparingly...'
default: []
selector:
action: {}
flip_from_any_to_face_1:
name: "Group 1 actions \U0001F34E Flip the cube from any to face 1"
description: Face 1 is the one with the 'Aqara' LOGO
default: []
selector:
action: {}
rotate_cw_face_1:
name: "Group 1 actions \U0001F34E Rotate cube clockwise with face 1 up"
default: []
selector:
action: {}
rotate_ccw_face_1:
name: "Group 1 actions \U0001F34E Rotate cube counter clockwise with face 1
up"
default: []
selector:
action: {}
slide_face_2:
name: "Group 1 actions \U0001F34E Slide the cube with face 2 up"
default: []
selector:
action: {}
doubletap_face_2:
name: "Group 1 actions \U0001F34E Double tap the cube with face 2 up"
default: []
selector:
action: {}
flipped90_face_2:
name: "Group 1 actions \U0001F34E Flip the cube 90 degrees to face 2"
default: []
selector:
action: {}
flipped180_face_2:
name: "Group 1 actions \U0001F34E Flip the cube 180 degrees to face 2"
description: '**NOTE:** This action is trick to master, and should be used sparingly...'
default: []
selector:
action: {}
flip_from_any_to_face_2:
name: "Group 1 actions \U0001F34E Flip the cube from any to face 2"
description: Face 2 is the one with the 'Aqara' LOGO
default: []
selector:
action: {}
rotate_cw_face_2:
name: "Group 1 actions \U0001F34E Rotate cube clockwise with face 2 up"
default: []
selector:
action: {}
rotate_ccw_face_2:
name: "Group 1 actions \U0001F34E Rotate cube counter clockwise with face 2
up"
default: []
selector:
action: {}
slide_face_3:
name: "Group 1 actions \U0001F34E Slide the cube with face 3 up"
default: []
selector:
action: {}
doubletap_face_3:
name: "Group 1 actions \U0001F34E Double tap the cube with face 3 up"
default: []
selector:
action: {}
flipped90_face_3:
name: "Group 1 actions \U0001F34E Flip the cube 90 degrees to face 3"
default: []
selector:
action: {}
flipped180_face_3:
name: "Group 1 actions \U0001F34E Flip the cube 180 degrees to face 3"
description: '**NOTE:** This action is trick to master, and should be used sparingly...'
default: []
selector:
action: {}
flip_from_any_to_face_3:
name: "Group 1 actions \U0001F34E Flip the cube from any to face 3"
description: Face 3 is the one with the 'Aqara' LOGO
default: []
selector:
action: {}
rotate_cw_face_3:
name: "Group 1 actions \U0001F34E Rotate cube clockwise with face 3 up"
default: []
selector:
action: {}
rotate_ccw_face_3:
name: "Group 1 actions \U0001F34E Rotate cube counter clockwise with face 3
up"
default: []
selector:
action: {}
slide_face_4:
name: "Group 1 actions \U0001F34E Slide the cube with face 4 up"
default: []
selector:
action: {}
doubletap_face_4:
name: "Group 1 actions \U0001F34E Double tap the cube with face 4 up"
default: []
selector:
action: {}
flipped90_face_4:
name: "Group 1 actions \U0001F34E Flip the cube 90 degrees to face 4"
default: []
selector:
action: {}
flipped180_face_4:
name: "Group 1 actions \U0001F34E Flip the cube 180 degrees to face 4"
description: '**NOTE:** This action is trick to master, and should be used sparingly...'
default: []
selector:
action: {}
flip_from_any_to_face_4:
name: "Group 1 actions \U0001F34E Flip the cube from any to face 4"
description: Face 4 is the one with the 'Aqara' LOGO
default: []
selector:
action: {}
rotate_cw_face_4:
name: "Group 1 actions \U0001F34E Rotate cube clockwise with face 4 up"
default: []
selector:
action: {}
rotate_ccw_face_4:
name: "Group 1 actions \U0001F34E Rotate cube counter clockwise with face 4
up"
default: []
selector:
action: {}
slide_face_5:
name: "Group 1 actions \U0001F34E Slide the cube with face 5 up"
default: []
selector:
action: {}
doubletap_face_5:
name: "Group 1 actions \U0001F34E Double tap the cube with face 5 up"
default: []
selector:
action: {}
flipped90_face_5:
name: "Group 1 actions \U0001F34E Flip the cube 90 degrees to face 5"
default: []
selector:
action: {}
flipped180_face_5:
name: "Group 1 actions \U0001F34E Flip the cube 180 degrees to face 5"
description: '**NOTE:** This action is trick to master, and should be used sparingly...'
default: []
selector:
action: {}
flip_from_any_to_face_5:
name: "Group 1 actions \U0001F34E Flip the cube from any to face 5"
description: Face 5 is the one with the 'Aqara' LOGO
default: []
selector:
action: {}
rotate_cw_face_5:
name: "Group 1 actions \U0001F34E Rotate cube clockwise with face 5 up"
default: []
selector:
action: {}
rotate_ccw_face_5:
name: "Group 1 actions \U0001F34E Rotate cube counter clockwise with face 5
up"
default: []
selector:
action: {}
shake:
name: "Shake the cube \U0001F369"
description: 'This trigger only occurs once in the set-up.
It can be combined in any group.'
default: []
selector:
action: {}
fall:
name: "Drop the cube \U0001F369"
description: 'This trigger only occurs once in the set-up.
It can be combined in any group.'
default: []
selector:
action: {}
slide_any:
name: "Group 2 actions \U0001F34A Slide the cube with any side"
description: "Side doesn't matter on this one.\n**!!Warning!!** The automations
for the specific side will also trigger. \U0001F34E\U0001F350\nI suggest using
only one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
doubletap_any:
name: "Group 2 actions \U0001F34A Double tap the cube with any side"
description: "Side doesn't matter on this one.\n**!!Warning!!** The automations
for the specific side will also trigger. \U0001F34E\U0001F350\nI suggest using
only one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
flipped90_any:
name: "Group 2 actions \U0001F34A Flip the cube 90 degrees to any side"
description: "Side doesn't matter on this one.\n**!!Warning!!** The automations
for the specific side will also trigger. \U0001F34E\U0001F350\nI suggest using
only one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
flipped180_any:
name: "Group 2 actions \U0001F34A Flip the cube 180 degrees any side"
description: "NOTE: This action is trick to master, and should be used sparingly...
Side doesn't matter on this one.\n**!!Warning!!** The automations for the
specific side will also trigger. \U0001F34E\U0001F350\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
rotate_cw_any:
name: "Group 2 actions \U0001F34A Rotate cube clockwise with any side"
description: "Side doesn't matter on this one.\n**!!Warning!!** The automations
for the specific side will also trigger. \U0001F34E\U0001F350\nI suggest using
only one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
rotate_ccw_any:
name: "Group 2 actions \U0001F34A Rotate cube counter clockwise with any side"
description: "Side doesn't matter on this one.\n**!!Warning!!** The automations
for the specific side will also trigger. \U0001F34E\U0001F350\nI suggest using
only one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
0_from_1:
name: "Group 3 actions \U0001F350 Flip the cube to side 0 from side 1"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 0
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
0_from_2:
name: "Group 3 actions \U0001F350 Flip the cube to side 0 from side 2"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 0
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
0_from_3:
name: "Group 3 actions \U0001F350 Flip the cube to side 0 from side 3"
description: "**!!Warning!!** The flip 180 automations \U0001F34E for side 0
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
0_from_4:
name: "Group 3 actions \U0001F350 Flip the cube to side 0 from side 4"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 0
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
0_from_5:
name: "Group 3 actions \U0001F350 Flip the cube to side 0 from side 5"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 0
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
1_from_0:
name: "Group 3 actions \U0001F350 Flip the cube to side 1 from side 0"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 1
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
1_from_2:
name: "Group 3 actions \U0001F350 Flip the cube to side 1 from side 2"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 1
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
1_from_3:
name: "Group 3 actions \U0001F350 Flip the cube to side 1 from side 3"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 1
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
1_from_4:
name: "Group 3 actions \U0001F350 Flip the cube to side 1 from side 4"
description: "**!!Warning!!** The flip 180 automations \U0001F34E for side 1
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
1_from_5:
name: "Group 3 actions \U0001F350 Flip the cube to side 1 from side 5"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 1
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
2_from_0:
name: "Group 3 actions \U0001F350 Flip the cube to side 2 from side 0"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 2
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
2_from_1:
name: "Group 3 actions \U0001F350 Flip the cube to side 2 from side 1"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 2
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
2_from_3:
name: "Group 3 actions \U0001F350 Flip the cube to side 2 from side 3"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 2
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
2_from_4:
name: "Group 3 actions \U0001F350 Flip the cube to side 2 from side 4"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 2
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
2_from_5:
name: "Group 3 actions \U0001F350 Flip the cube to side 2 from side 5"
description: "**!!Warning!!** The flip 180 automations \U0001F34E for side 2
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
3_from_0:
name: "Group 3 actions \U0001F350 Flip the cube to side 3 from side 0"
description: "**!!Warning!!** The flip 180 automations \U0001F34E for side 3
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
3_from_1:
name: "Group 3 actions \U0001F350 Flip the cube to side 3 from side 1"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 3
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
3_from_2:
name: "Group 3 actions \U0001F350 Flip the cube to side 3 from side 2"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 3
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
3_from_4:
name: "Group 3 actions \U0001F350 Flip the cube to side 3 from side 4"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 3
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
3_from_5:
name: "Group 3 actions \U0001F350 Flip the cube to side 3 from side 5"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 3
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
4_from_0:
name: "Group 3 actions \U0001F350 Flip the cube to side 4 from side 0"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 4
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
4_from_1:
name: "Group 3 actions \U0001F350 Flip the cube to side 4 from side 1"
description: "**!!Warning!!** The flip 180 automations \U0001F34E for side 4
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
4_from_2:
name: "Group 3 actions \U0001F350 Flip the cube to side 4 from side 2"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 4
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
4_from_3:
name: "Group 3 actions \U0001F350 Flip the cube to side 4 from side 3"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 4
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
4_from_5:
name: "Group 3 actions \U0001F350 Flip the cube to side 4 from side 5"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 4
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
5_from_0:
name: "Group 3 actions \U0001F350 Flip the cube to side 5 from side 0"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 5
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
5_from_1:
name: "Group 3 actions \U0001F350 Flip the cube to side 5 from side 1"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 5
and the ANY \U0001F34A automations will also trigger. \U0001F34E\U0001F350\nI
suggest using only one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
5_from_2:
name: "Group 3 actions \U0001F350 Flip the cube to side 5 from side 2"
description: "**!!Warning!!** The flip 180 automations \U0001F34E for side 5
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
5_from_3:
name: "Group 3 actions \U0001F350 Flip the cube to side 5 from side 3"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 5
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
5_from_4:
name: "Group 3 actions \U0001F350 Flip the cube to side 5 from side 4"
description: "**!!Warning!!** The flip 90 automations \U0001F34E for side 5
and the ANY \U0001F34A automations will also trigger.\nI suggest using only
one of the three groups of triggers, not multiple groups..."
default: []
selector:
action: {}
trigger:
- platform: mqtt
topic: !input topic
variables:
action: '{{ trigger.payload_json.action }}'
angle: '{{ trigger.payload_json.action_angle | float(0.0) }}'
side: '{{ trigger.payload_json.side }}'
op_mode: '{{ trigger.payload_json.operation_mode }}'
topic_var: !input topic
friendly_name: '{{ topic_var.split(''/'')[1] | regex_replace("[^A-Za-z0-9_/./-]",
"") }}'
device_id: '{{ device_id( friendly_name ) }}'
ieee_id_long: '{{(( device_attr( device_id, ''identifiers'') |list)[0][1]) }}'
ieee_id: '{{ieee_id_long.split(''_'')[1] }}'
num_name: last side
num_ha_name: '{{ ''number.'' + friendly_name + ''_last_side'' }}'
num_ha_val: '{{ states(num_ha_name) | default(0) | int(0) }}'
last_side: ' {# The first time it will not be there, so make sure its 0 instead
of undefined. #} {% if not num_ha_val in (''none'', ''null'', ''unavailable'',
'''') %} {{ num_ha_val }} {% else %} 0 {% endif %}'
mdl: Number Helper for Z2M Cube Integration
mf: SirGoodenough
sa: house
sw: '2023-10-20'
hw: https://github.com/SirGoodenough/HA_Blueprints/blob/master/Automations/Zigbee2MQTT
- Xiaomi Cube Controller.yaml
cu: https://community.home-assistant.io/t/zigbee2mqtt-xiaomi-cube-controller/393203
config_topic_2: '{{ ''homeassistant/number/'' + ieee_id + ''/last_side/config''
}}'
topic_2: '{{ ''homeassistant/number/'' + ieee_id + ''/last_side'' }}'
condition:
- condition: template
value_template: '{{ trigger.payload_json is defined and trigger.payload_json.action
is defined and trigger.payload_json.action in (''rotate_right'', ''rotate_left'',
''flip90'', ''flip180'', ''slide'', ''tap'', ''shake'', ''fall'') }}'
- alias: User pick
condition: !input additional_conditions
action:
- alias: Make number helper to store last side
service: mqtt.publish
data:
topic: '{{ config_topic_2 }}'
retain: true
payload: "{ \"name\": \"{{ num_name }}\",\n \"avty_t\": \"homeassistant/status\",\n
\ \"uniq_id\": \"{{ friendly_name + '-' + device_id }}\",\n \"cmd_t\": \"{{
topic_2 }}\",\n \"sta_t\": \"{{ topic_2 }}\",\n \"min\": \"0\",\n \"max\":
\"6\",\n \"step\": \"1\",\n \"mode\": \"box\",\n \"ret\": true,\n \"dev\":
{\n \"name\": \"{{ friendly_name }}\",\n \"mdl\": \"{{ mdl }}\",\n \"mf\":
\"{{ mf }}\",\n \"sa\": \"{{ sa }}\",\n \"sw\": \"{{ sw }}\",\n \"hw\":
\"{{ hw }}\",\n \"cu\": \"{{ cu }}\",\n \"ids\": [\n \"{{ ieee_id
+ '-' + num_name }}\"\n ]\n }\n}\n"
- alias: Fire Last Action event. This is for optional troubleshooting data.
event: cube_last_action
event_data:
action: '{{ action }}'
side: '{{ side }}'
last_side: '{{ last_side }}'
friendly_name: '{{ friendly_name }}'
device_id: '{{ device_id }}'
ieee_id: '{{ ieee_id }}'
angle: '{{ angle }}'
- alias: Store the current_side as the last_side for the next trigger
service: number.set_value
target:
entity_id: '{{ num_ha_name }}'
data:
value: '{{ side }}'
- alias: "Group 2 \U0001F34A and No Group \U0001F369 These are action events for ANY
Side"
choose:
- conditions: '{{ action == "slide" }}'
sequence: !input slide_any
- conditions: '{{ action == "tap" }}'
sequence: !input doubletap_any
- conditions: '{{ action == "rotate_right" }}'
sequence: !input rotate_cw_any
- conditions: '{{ action == "rotate_left" }}'
sequence: !input rotate_ccw_any
- conditions: '{{ action == "shake" }}'
sequence: !input shake
- conditions: '{{ action == "fall" }}'
sequence: !input fall
- conditions: '{{ action == "flip90" }}'
sequence:
- parallel:
- !input flipped90_any
- alias: These are flip to specific side from any side events
choose:
- conditions: '{{ side == 0 }}'
sequence: !input flip_from_any_to_face_0
- conditions: '{{ side == 1 }}'
sequence: !input flip_from_any_to_face_1
- conditions: '{{ side == 2 }}'
sequence: !input flip_from_any_to_face_2
- conditions: '{{ side == 3 }}'
sequence: !input flip_from_any_to_face_3
- conditions: '{{ side == 4 }}'
sequence: !input flip_from_any_to_face_4
- conditions: '{{ side == 5 }}'
sequence: !input flip_from_any_to_face_5
- conditions: '{{ action == "flip180" }}'
sequence:
- parallel:
- !input flipped180_any
- alias: These are flip to specific side from any side events
choose:
- conditions: '{{ side == 0 }}'
sequence: !input flip_from_any_to_face_0
- conditions: '{{ side == 1 }}'
sequence: !input flip_from_any_to_face_1
- conditions: '{{ side == 2 }}'
sequence: !input flip_from_any_to_face_2
- conditions: '{{ side == 3 }}'
sequence: !input flip_from_any_to_face_3
- conditions: '{{ side == 4 }}'
sequence: !input flip_from_any_to_face_4
- conditions: '{{ side == 5 }}'
sequence: !input flip_from_any_to_face_5
- alias: "Group 1 \U0001F34E These are action events based on the action broken down
by side"
choose:
- conditions: '{{ action == "slide" }}'
sequence:
- alias: These are slide events
choose:
- conditions: '{{ side == 0 }}'
sequence: !input slide_face_0
- conditions: '{{ side == 1 }}'
sequence: !input slide_face_1
- conditions: '{{ side == 2 }}'
sequence: !input slide_face_2
- conditions: '{{ side == 3 }}'
sequence: !input slide_face_3
- conditions: '{{ side == 4 }}'
sequence: !input slide_face_4
- conditions: '{{ side == 5 }}'
sequence: !input slide_face_5
- conditions: '{{ action == "tap" }}'
sequence:
- alias: These are doubletap events
choose:
- conditions: '{{ side == 0 }}'
sequence: !input doubletap_face_0
- conditions: '{{ side == 1 }}'
sequence: !input doubletap_face_1
- conditions: '{{ side == 2 }}'
sequence: !input doubletap_face_2
- conditions: '{{ side == 3 }}'
sequence: !input doubletap_face_3
- conditions: '{{ side == 4 }}'
sequence: !input doubletap_face_4
- conditions: '{{ side == 5 }}'
sequence: !input doubletap_face_5
- conditions: '{{ action == "flip90" }}'
sequence:
- alias: These are flipped90 events
choose:
- conditions: '{{ side == 0 }}'
sequence: !input flipped90_face_0
- conditions: '{{ side == 1 }}'
sequence: !input flipped90_face_1
- conditions: '{{ side == 2 }}'
sequence: !input flipped90_face_2
- conditions: '{{ side == 3 }}'
sequence: !input flipped90_face_3
- conditions: '{{ side == 4 }}'
sequence: !input flipped90_face_4
- conditions: '{{ side == 5 }}'
sequence: !input flipped90_face_5
- conditions: '{{ action == "flip180" }}'
sequence:
- alias: These are flipped180 events
choose:
- conditions: '{{ side == 0 }}'
sequence: !input flipped180_face_0
- conditions: '{{ side == 1 }}'
sequence: !input flipped180_face_1
- conditions: '{{ side == 2 }}'
sequence: !input flipped180_face_2
- conditions: '{{ side == 3 }}'
sequence: !input flipped180_face_3
- conditions: '{{ side == 4 }}'
sequence: !input flipped180_face_4
- conditions: '{{ side == 5 }}'
sequence: !input flipped180_face_5
- conditions: '{{ action == "rotate_right" }}'
sequence:
- alias: These are rotate CW events
choose:
- conditions: '{{ side == 0 }}'
sequence: !input rotate_cw_face_0
- conditions: '{{ side == 1 }}'
sequence: !input rotate_cw_face_1
- conditions: '{{ side == 2 }}'
sequence: !input rotate_cw_face_2
- conditions: '{{ side == 3 }}'
sequence: !input rotate_cw_face_3
- conditions: '{{ side == 4 }}'
sequence: !input rotate_cw_face_4
- conditions: '{{ side == 5 }}'
sequence: !input rotate_cw_face_5
- conditions: '{{ action == "rotate_left" }}'
sequence:
- alias: These are rotate CCW events
choose:
- conditions: '{{ side == 0 }}'
sequence: !input rotate_ccw_face_0
- conditions: '{{ side == 1 }}'
sequence: !input rotate_ccw_face_1
- conditions: '{{ side == 2 }}'
sequence: !input rotate_ccw_face_2
- conditions: '{{ side == 3 }}'
sequence: !input rotate_ccw_face_3
- conditions: '{{ side == 4 }}'
sequence: !input rotate_ccw_face_4
- conditions: '{{ side == 5 }}'
sequence: !input rotate_ccw_face_5
- alias: "Group 3 \U0001F350 Side to side jump events"
choose:
- conditions: '{{ side == 0 }}'
sequence:
- alias: To side 0 from any events
choose:
- conditions: '{{ last_side == 1 }}'
sequence: !input 0_from_1
- conditions: '{{ last_side == 2 }}'
sequence: !input 0_from_2
- conditions: '{{ last_side == 3 }}'
sequence: !input 0_from_3
- conditions: '{{ last_side == 4 }}'
sequence: !input 0_from_4
- conditions: '{{ last_side == 5 }}'
sequence: !input 0_from_5
- conditions: '{{ side == 1 }}'
sequence:
- alias: To side 1 from any events
choose:
- conditions: '{{ last_side == 0 }}'
sequence: !input 1_from_0
- conditions: '{{ last_side == 2 }}'
sequence: !input 1_from_2
- conditions: '{{ last_side == 3 }}'
sequence: !input 1_from_3
- conditions: '{{ last_side == 4 }}'
sequence: !input 1_from_4
- conditions: '{{ last_side == 5 }}'
sequence: !input 1_from_5
- conditions: '{{ side == 2 }}'
sequence:
- alias: To side 2 from any events
choose:
- conditions: '{{ last_side == 0 }}'
sequence: !input 2_from_0
- conditions: '{{ last_side == 1 }}'
sequence: !input 2_from_1
- conditions: '{{ last_side == 3 }}'
sequence: !input 2_from_3
- conditions: '{{ last_side == 4 }}'
sequence: !input 2_from_4
- conditions: '{{ last_side == 5 }}'
sequence: !input 2_from_5
- conditions: '{{ side == 3 }}'
sequence:
- alias: To side 3 from any events
choose:
- conditions: '{{ last_side == 0 }}'
sequence: !input 3_from_0
- conditions: '{{ last_side == 1 }}'
sequence: !input 3_from_1
- conditions: '{{ last_side == 2 }}'
sequence: !input 3_from_2
- conditions: '{{ last_side == 4 }}'
sequence: !input 3_from_4
- conditions: '{{ last_side == 5 }}'
sequence: !input 3_from_5
- conditions: '{{ side == 4 }}'
sequence:
- alias: To side 4 from any events
choose:
- conditions: '{{ last_side == 0 }}'
sequence: !input 4_from_0
- conditions: '{{ last_side == 1 }}'
sequence: !input 4_from_1
- conditions: '{{ last_side == 2 }}'
sequence: !input 4_from_2
- conditions: '{{ last_side == 3 }}'
sequence: !input 4_from_3
- conditions: '{{ last_side == 5 }}'
sequence: !input 4_from_5
- conditions: '{{ side == 5 }}'
sequence:
- alias: To side 5 from any events
choose:
- conditions: '{{ last_side == 0 }}'
sequence: !input 5_from_0
- conditions: '{{ last_side == 1 }}'
sequence: !input 5_from_1
- conditions: '{{ last_side == 2 }}'
sequence: !input 5_from_2
- conditions: '{{ last_side == 3 }}'
sequence: !input 5_from_3
- conditions: '{{ last_side == 4 }}'
sequence: !input 5_from_4
- alias: Delay ⏱ for debounce so toggle functions work. Also blueprint is in single
mode.
delay: 00:00:01
mode: single
max_exceeded: silent
@@ -0,0 +1,68 @@
blueprint:
name: Громкость станции по умолчанию
description: Громкость станции по умолчанию
domain: automation
input:
yandex_station:
name: Яндекс станция
selector:
entity:
domain:
- media_player
multiple: false
number_volume:
name: Громкость по умолчанию (от 1 до 10)
selector:
number:
min: 1.0
max: 10.0
step: 1.0
mode: slider
default: 4
source_url: https://gist.githubusercontent.com/kai-zer-ru/b790de73330ac58068e12b61e7c1cd0a/raw/78113275ea0a08c43fb5cca947341991ccb503b2/yandex_station_default_volume.yaml
mode: restart
max_exceeded: silent
variables:
yandex_station: !input yandex_station
number_volume: !input number_volume
number_volume_percent: '{{ number_volume | int / 10 }}'
trigger:
- platform: state
entity_id: !input yandex_station
to: paused
for:
hours: 0
minutes: 5
seconds: 0
- platform: state
entity_id: !input yandex_station
to: standby
for:
hours: 0
minutes: 5
seconds: 0
- platform: state
entity_id: !input yandex_station
to: 'off'
for:
hours: 0
minutes: 5
seconds: 0
conditions:
- condition: not
conditions:
- condition: state
entity_id: !input yandex_station
state: playing
action:
- if:
- condition: template
value_template: '{{ state_attr(yandex_station, "volume_level")|round(1) != number_volume_percent
}}'
then:
- action: media_player.volume_set
metadata: {}
data:
volume_level: '{{ number_volume_percent }}'
target:
entity_id: !input yandex_station
@@ -0,0 +1,103 @@
blueprint:
name: Unavailable entity detection & notification
description: Regularly test all entities' status to check for unavailability.
domain: automation
source_url: https://github.com/gmlupatelli/blueprints_repo/blob/master/unavailable_entities_notification/unavailable_entities_notification.yaml
input:
time:
name: Time to test on
description: Test is run at configured time
default: '10:00:00'
selector:
time: {}
monday_enabled:
name: Monday
description: Run test on Monday
default: true
selector:
boolean: {}
tuesday_enabled:
name: Tuesday
description: Run test on Tuesday
default: true
selector:
boolean: {}
wednesday_enabled:
name: Wednesday
description: Run test on Wednesday
default: true
selector:
boolean: {}
thursday_enabled:
name: Thursday
description: Run test on Thursday
default: true
selector:
boolean: {}
friday_enabled:
name: Friday
description: Run test on Friday
default: true
selector:
boolean: {}
saturday_enabled:
name: Saturday
description: Run test on Saturday
default: true
selector:
boolean: {}
sunday_enabled:
name: Sunday
description: Run test on Sunday
default: true
selector:
boolean: {}
exclude:
name: Excluded Entities
description: Entities (e.g. smartphone) to exclude from detection. Only entities
and devices are supported, areas must be expanded!
default: {}
selector:
target: {}
actions:
name: Actions
description: Notifications or similar to be run. {{entities}} is replaced with
the names of unavailable entities.
selector:
action: {}
variables:
monday_enabled: !input monday_enabled
tuesday_enabled: !input tuesday_enabled
wednesday_enabled: !input wednesday_enabled
thursday_enabled: !input thursday_enabled
friday_enabled: !input friday_enabled
saturday_enabled: !input saturday_enabled
sunday_enabled: !input sunday_enabled
current_day: '{{ now().weekday() | int }}'
exclude: !input exclude
entities: "{% set result = namespace(includedEntities=[], excludedEntities = [])
%}\n{% if exclude.entity_id is defined %} \n {% set result.excludedEntities
= result.excludedEntities + exclude.entity_id %}\n{% endif %}\n{% if exclude.device_id
is defined %}\n {% for device_id in exclude.device_id %}\n {% set result.excludedEntities
= result.excludedEntities + device_entities(device_id) %}\n {% endfor %}\n{%
endif %}\n{% for state in states | selectattr('state', 'eq', 'unavailable') %}\n
\ {% if state.state == 'unavailable' and not state.entity_id in result.excludedEntities
%}\n {% set result.includedEntities = result.includedEntities + [state.name]
%}\n {% endif %}\n{% endfor %}\n{{\"⤵ \\n- \"}}{{result.includedEntities|join('\\n-
')}}"
trigger:
- platform: time
at: !input time
condition:
- condition: template
value_template: "{{ \n (current_day == 0 and monday_enabled) or \n (current_day
== 1 and tuesday_enabled) or \n (current_day == 2 and wednesday_enabled) or\n
\ (current_day == 3 and thursday_enabled) or \n (current_day == 4 and friday_enabled)
or\n (current_day == 5 and saturday_enabled) or\n (current_day == 6 and sunday_enabled)\n}}"
- condition: template
value_template: '{{ entities != "⤵ \n-"}}'
action:
- choose: []
default: !input actions
mode: single
max_exceeded: silent
@@ -0,0 +1,54 @@
blueprint:
name: Motion-activated Light
description: Turn on a light when motion is detected.
domain: automation
source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
light_target:
name: Light
selector:
target:
entity:
domain: light
no_motion_wait:
name: Wait time
description: Time to leave the light on after last motion is detected.
default: 120
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
# If motion is detected within the delay,
# we restart the script.
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input motion_entity
from: "off"
to: "on"
action:
- alias: "Turn on the light"
service: light.turn_on
target: !input light_target
- alias: "Wait until there is no motion from device"
wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
- alias: "Wait the number of seconds that has been set"
delay: !input no_motion_wait
- alias: "Turn off the light"
service: light.turn_off
target: !input light_target
@@ -0,0 +1,46 @@
blueprint:
name: Zone Notification
description: Send a notification to a device when a person leaves a specific zone.
domain: automation
source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/notify_leaving_zone.yaml
input:
person_entity:
name: Person
selector:
entity:
domain: person
zone_entity:
name: Zone
selector:
entity:
domain: zone
notify_device:
name: Device to notify
description: Device needs to run the official Home Assistant app to receive notifications.
selector:
device:
integration: mobile_app
trigger:
platform: state
entity_id: !input person_entity
variables:
zone_entity: !input zone_entity
# This is the state of the person when it's in this zone.
zone_state: "{{ states[zone_entity].name }}"
person_entity: !input person_entity
person_name: "{{ states[person_entity].name }}"
condition:
condition: template
# The first case handles leaving the Home zone which has a special state when zoning called 'home'.
# The second case handles leaving all other zones.
value_template: "{{ zone_entity == 'zone.home' and trigger.from_state.state == 'home' and trigger.to_state.state != 'home' or trigger.from_state.state == zone_state and trigger.to_state.state != zone_state }}"
action:
- alias: "Notify that a person has left the zone"
domain: mobile_app
type: notify
device_id: !input notify_device
message: "{{ person_name }} has left {{ zone_state }}"