Hi
I created an blueprint (based on the ones I found here, thanks!) which waits for MQTT mesage from switch and then runs correct service based on the input.
I was wondering if it is possible to have it for multiple and varied number of switches? Like in one room I have 3 switches and in another 2 and in third only 1 switch.
I know that input can be multiplied like this:
input:
switch_topic:
name: MQTT Switch
description: MQTT topic to use
multiple: true
but how I can access each trigger?
For now I have:
trigger:
- platform: mqtt
topic: !input 'switch_topic'
action:
- variables:
command: "{{ trigger.payload_json.action }}"
- choose:
- conditions: "{{ command == 'button_1_single' }}"
sequence: !input button_1_single
My full blueprint:
---
blueprint:
name: Z2M - Aqara Opple 6-Button Switch
description: Aqara Opple 6-button switch (WXCJKG13LM) control
domain: automation
input:
switch_topic:
name: MQTT Switch
description: MQTT topic to use
# ---------------------------- BUTTONS ----------------------------
button_1_single:
name: Top Left Button - Single Click
description: Action to run after single click of top left button
default: []
selector:
action: {}
button_1_double:
name: Top Left Button - Double Click
description: Action to run after double click of top left button
default: []
selector:
action: {}
button_1_triple:
name: Top Left Button - Triple Click
description: Action to run after triple click of top left button
default: []
selector:
action: {}
button_1_hold:
name: Top Left Button - Hold
description: Action to run after hold of top left button
default: []
selector:
action: {}
button_1_release:
name: Top Left Button - Hold & Release
description: Action to run after hold & release of top left button
default: []
selector:
action: {}
button_2_single:
name: Top Right Button - Single Click
description: Action to run after single click of top right button
default: []
selector:
action: {}
button_2_double:
name: Top Right Button - Double Click
description: Action to run after double click of top right button
default: []
selector:
action: {}
button_2_triple:
name: Top Right Button - Triple Click
description: Action to run after triple click of top right button
default: []
selector:
action: {}
button_2_hold:
name: Top Right Button - Hold
description: Action to run after hold of top right button
default: []
selector:
action: {}
button_2_release:
name: Top Right Button - Hold & Release
description: Action to run after hold & release of top right button
default: []
selector:
action: {}
button_3_single:
name: Middle Left Button - Single Click
description: Action to run after single click of middle left button
default: []
selector:
action: {}
button_3_double:
name: Middle Left Button - Double Click
description: Action to run after double click of middle left button
default: []
selector:
action: {}
button_3_triple:
name: Middle Left Button - Triple Click
description: Action to run after triple click of middle left button
default: []
selector:
action: {}
button_3_hold:
name: Middle Left Button - Hold
description: Action to run after hold of middle left button
default: []
selector:
action: {}
button_3_release:
name: Middle Left Button - Hold & Release
description: Action to run after hold & release of middle left button
default: []
selector:
action: {}
button_4_single:
name: Middle Right Button - Single Click
description: Action to run after single click of middle right button
default: []
selector:
action: {}
button_4_double:
name: Middle Right Button - Double Click
description: Action to run after double click of middle right button
default: []
selector:
action: {}
button_4_triple:
name: Middle Right Button - Triple Click
description: Action to run after triple click of middle right button
default: []
selector:
action: {}
button_4_hold:
name: Middle Right Button - Hold
description: Action to run after hold of middle right button
default: []
selector:
action: {}
button_4_release:
name: Middle Right Button - Hold & Release
description: Action to run after hold & release of middle right button
default: []
selector:
action: {}
button_5_single:
name: Bottom Left Button - Single Click
description: Action to run after single click of bottom left button
default: []
selector:
action: {}
button_5_double:
name: Bottom Left Button - Double Click
description: Action to run after double click of bottom left button
default: []
selector:
action: {}
button_5_triple:
name: Bottom Left Button - Triple Click
description: Action to run after triple click of bottom left button
default: []
selector:
action: {}
button_5_hold:
name: Bottom Left Button - Hold
description: Action to run after hold of bottom left button
default: []
selector:
action: {}
button_5_release:
name: Bottom Left Button - Hold & Release
description: Action to run after hold & release of bottom left button
default: []
selector:
action: {}
button_6_single:
name: Bottom Right Button - Single Click
description: Action to run after single click of bottom right button
default: []
selector:
action: {}
button_6_double:
name: Bottom Right Button - Double Click
description: Action to run after double click of bottom right button
default: []
selector:
action: {}
button_6_triple:
name: Bottom Right Button - Triple Click
description: Action to run after triple click of bottom right button
default: []
selector:
action: {}
button_6_hold:
name: Bottom Right Button - Hold
description: Action to run after hold of bottom right button
default: []
selector:
action: {}
button_6_release:
name: Bottom Right Button - Hold & Release
description: Action to run after hold & release of bottom right button
default: []
selector:
action: {}
mode: parallel
max_exceeded: silent
trigger:
- platform: mqtt
topic: !input 'switch_topic'
action:
- variables:
command: "{{ trigger.payload_json.action }}"
- choose:
- conditions: "{{ command == 'button_1_single' }}"
sequence: !input button_1_single
- conditions: "{{ command == 'button_2_single' }}"
sequence: !input button_2_single
- conditions: "{{ command == 'button_3_single' }}"
sequence: !input button_3_single
- conditions: "{{ command == 'button_4_single' }}"
sequence: !input button_4_single
- conditions: "{{ command == 'button_5_single' }}"
sequence: !input button_5_single
- conditions: "{{ command == 'button_6_single' }}"
sequence: !input button_6_single
- conditions: "{{ command == 'button_1_double' }}"
sequence: !input button_1_double
- conditions: "{{ command == 'button_2_double' }}"
sequence: !input button_2_double
- conditions: "{{ command == 'button_3_double' }}"
sequence: !input button_3_double
- conditions: "{{ command == 'button_4_double' }}"
sequence: !input button_4_double
- conditions: "{{ command == 'button_5_double' }}"
sequence: !input button_5_double
- conditions: "{{ command == 'button_6_double' }}"
sequence: !input button_6_double
- conditions: "{{ command == 'button_1_triple' }}"
sequence: !input button_1_triple
- conditions: "{{ command == 'button_2_triple' }}"
sequence: !input button_2_triple
- conditions: "{{ command == 'button_3_triple' }}"
sequence: !input button_3_triple
- conditions: "{{ command == 'button_4_triple' }}"
sequence: !input button_4_triple
- conditions: "{{ command == 'button_5_triple' }}"
sequence: !input button_5_triple
- conditions: "{{ command == 'button_6_triple' }}"
sequence: !input button_6_triple
- conditions: "{{ command == 'button_6_triple' }}"
sequence: !input button_6_triple
- conditions: "{{ command == 'button_1_hold' }}"
sequence: !input button_1_hold
- conditions: "{{ command == 'button_2_hold' }}"
sequence: !input button_2_hold
- conditions: "{{ command == 'button_3_hold' }}"
sequence: !input button_3_hold
- conditions: "{{ command == 'button_4_hold' }}"
sequence: !input button_4_hold
- conditions: "{{ command == 'button_5_hold' }}"
sequence: !input button_5_hold
- conditions: "{{ command == 'button_6_hold' }}"
sequence: !input button_6_hold