Fix: domänenbewusste Service-Auswahl statt generischem homeassistant.turn_on/off
cover.turn_on/turn_off, valve.turn_on/turn_off und lock.turn_on/turn_off/toggle existieren schlicht nicht - die generischen homeassistant.* Services haben dafuer nichts ausgeloest. Jetzt wird je nach Entitaets-Domain der native Service aufgerufen (cover.open_cover/close_cover, valve.open_valve/close_valve, lock.lock/unlock, inkl. State-basiertem Toggle fuer Schloesser).
This commit is contained in:
parent
9220ff9d3e
commit
c8847ebc23
1 changed files with 178 additions and 48 deletions
|
|
@ -6,12 +6,16 @@ blueprint:
|
|||
Einschalten, Ausschalten) zu. Kurzer und langer Tastendruck (PRESS_SHORT /
|
||||
PRESS_LONG) lösen dieselbe Aktion aus.
|
||||
|
||||
Passt für normale Schalter/Lampen genauso wie für ein Garagentor als
|
||||
cover-Entität: "Umschalten" öffnet bzw. schließt das Tor dann automatisch
|
||||
passend zum aktuellen Zustand – ganz ohne Sonderlogik. Auch Mähroboter
|
||||
(Domain lawn_mower, z. B. Worx Landroid über die Landroid-Cloud-
|
||||
Integration) werden unterstützt, dafür gibt es die eigenen Aktionen
|
||||
"Mähen starten", "Pause" und "Zur Ladestation" statt Ein/Aus/Umschalten.
|
||||
Erkennt automatisch die Domain der Zielentität und ruft den passenden
|
||||
nativen Service auf – "Einschalten"/"Ausschalten" bedeutet bei einem
|
||||
Schalter/Licht turn_on/turn_off, bei einem Cover (z. B. Garagentor)
|
||||
open_cover/close_cover, bei einem Ventil open_valve/close_valve und bei
|
||||
einem Schloss lock/unlock. "Umschalten" funktioniert für all diese
|
||||
Domains inklusive Schloss (dort anhand des aktuellen Zustands
|
||||
gesperrt/entsperrt). Auch Mähroboter (Domain lawn_mower, z. B. Worx
|
||||
Landroid über die Landroid-Cloud-Integration) werden unterstützt, dafür
|
||||
gibt es die eigenen Aktionen "Mähen starten", "Pause" und
|
||||
"Zur Ladestation" statt Ein/Aus/Umschalten.
|
||||
Ungenutzte Tasten einfach leer lassen, dann passiert bei ihnen nichts.
|
||||
|
||||
Für jedes physische Taster-Gerät wird eine eigene Automatisierungs-Instanz
|
||||
|
|
@ -51,11 +55,13 @@ blueprint:
|
|||
button_1_action:
|
||||
name: Taste 1 – Aktion
|
||||
description: >
|
||||
Umschalten passt für normale Schalter/Lampen und für ein Garagentor
|
||||
(cover-Entität, öffnet/schließt automatisch je nach Zustand).
|
||||
Ein-/Ausschalten eignet sich z. B. für Wippen-Tastenpaare.
|
||||
Für Mähroboter (lawn_mower) stattdessen "Mähen starten", "Pause"
|
||||
oder "Zur Ladestation" verwenden.
|
||||
Umschalten/Ein/Aus passen sich automatisch der Domain der
|
||||
Zielentität an: Schalter/Licht/Lüfter/Sirene = ein/aus, Cover
|
||||
(z. B. Garagentor) = öffnen/schließen, Ventil = öffnen/schließen,
|
||||
Schloss = (ent)sperren. Praktisch für Wippen-Tastenpaare, z. B. eine
|
||||
Taste "Einschalten" (öffnet das Tor) und eine zweite "Ausschalten"
|
||||
(schließt es). Für Mähroboter (lawn_mower) stattdessen "Mähen
|
||||
starten", "Pause" oder "Zur Ladestation" verwenden.
|
||||
default: toggle
|
||||
selector:
|
||||
select:
|
||||
|
|
@ -94,11 +100,13 @@ blueprint:
|
|||
button_2_action:
|
||||
name: Taste 2 – Aktion
|
||||
description: >
|
||||
Umschalten passt für normale Schalter/Lampen und für ein Garagentor
|
||||
(cover-Entität, öffnet/schließt automatisch je nach Zustand).
|
||||
Ein-/Ausschalten eignet sich z. B. für Wippen-Tastenpaare.
|
||||
Für Mähroboter (lawn_mower) stattdessen "Mähen starten", "Pause"
|
||||
oder "Zur Ladestation" verwenden.
|
||||
Umschalten/Ein/Aus passen sich automatisch der Domain der
|
||||
Zielentität an: Schalter/Licht/Lüfter/Sirene = ein/aus, Cover
|
||||
(z. B. Garagentor) = öffnen/schließen, Ventil = öffnen/schließen,
|
||||
Schloss = (ent)sperren. Praktisch für Wippen-Tastenpaare, z. B. eine
|
||||
Taste "Einschalten" (öffnet das Tor) und eine zweite "Ausschalten"
|
||||
(schließt es). Für Mähroboter (lawn_mower) stattdessen "Mähen
|
||||
starten", "Pause" oder "Zur Ladestation" verwenden.
|
||||
default: toggle
|
||||
selector:
|
||||
select:
|
||||
|
|
@ -137,11 +145,13 @@ blueprint:
|
|||
button_3_action:
|
||||
name: Taste 3 – Aktion
|
||||
description: >
|
||||
Umschalten passt für normale Schalter/Lampen und für ein Garagentor
|
||||
(cover-Entität, öffnet/schließt automatisch je nach Zustand).
|
||||
Ein-/Ausschalten eignet sich z. B. für Wippen-Tastenpaare.
|
||||
Für Mähroboter (lawn_mower) stattdessen "Mähen starten", "Pause"
|
||||
oder "Zur Ladestation" verwenden.
|
||||
Umschalten/Ein/Aus passen sich automatisch der Domain der
|
||||
Zielentität an: Schalter/Licht/Lüfter/Sirene = ein/aus, Cover
|
||||
(z. B. Garagentor) = öffnen/schließen, Ventil = öffnen/schließen,
|
||||
Schloss = (ent)sperren. Praktisch für Wippen-Tastenpaare, z. B. eine
|
||||
Taste "Einschalten" (öffnet das Tor) und eine zweite "Ausschalten"
|
||||
(schließt es). Für Mähroboter (lawn_mower) stattdessen "Mähen
|
||||
starten", "Pause" oder "Zur Ladestation" verwenden.
|
||||
default: toggle
|
||||
selector:
|
||||
select:
|
||||
|
|
@ -180,11 +190,13 @@ blueprint:
|
|||
button_4_action:
|
||||
name: Taste 4 – Aktion
|
||||
description: >
|
||||
Umschalten passt für normale Schalter/Lampen und für ein Garagentor
|
||||
(cover-Entität, öffnet/schließt automatisch je nach Zustand).
|
||||
Ein-/Ausschalten eignet sich z. B. für Wippen-Tastenpaare.
|
||||
Für Mähroboter (lawn_mower) stattdessen "Mähen starten", "Pause"
|
||||
oder "Zur Ladestation" verwenden.
|
||||
Umschalten/Ein/Aus passen sich automatisch der Domain der
|
||||
Zielentität an: Schalter/Licht/Lüfter/Sirene = ein/aus, Cover
|
||||
(z. B. Garagentor) = öffnen/schließen, Ventil = öffnen/schließen,
|
||||
Schloss = (ent)sperren. Praktisch für Wippen-Tastenpaare, z. B. eine
|
||||
Taste "Einschalten" (öffnet das Tor) und eine zweite "Ausschalten"
|
||||
(schließt es). Für Mähroboter (lawn_mower) stattdessen "Mähen
|
||||
starten", "Pause" oder "Zur Ladestation" verwenden.
|
||||
default: toggle
|
||||
selector:
|
||||
select:
|
||||
|
|
@ -223,11 +235,13 @@ blueprint:
|
|||
button_5_action:
|
||||
name: Taste 5 – Aktion
|
||||
description: >
|
||||
Umschalten passt für normale Schalter/Lampen und für ein Garagentor
|
||||
(cover-Entität, öffnet/schließt automatisch je nach Zustand).
|
||||
Ein-/Ausschalten eignet sich z. B. für Wippen-Tastenpaare.
|
||||
Für Mähroboter (lawn_mower) stattdessen "Mähen starten", "Pause"
|
||||
oder "Zur Ladestation" verwenden.
|
||||
Umschalten/Ein/Aus passen sich automatisch der Domain der
|
||||
Zielentität an: Schalter/Licht/Lüfter/Sirene = ein/aus, Cover
|
||||
(z. B. Garagentor) = öffnen/schließen, Ventil = öffnen/schließen,
|
||||
Schloss = (ent)sperren. Praktisch für Wippen-Tastenpaare, z. B. eine
|
||||
Taste "Einschalten" (öffnet das Tor) und eine zweite "Ausschalten"
|
||||
(schließt es). Für Mähroboter (lawn_mower) stattdessen "Mähen
|
||||
starten", "Pause" oder "Zur Ladestation" verwenden.
|
||||
default: toggle
|
||||
selector:
|
||||
select:
|
||||
|
|
@ -266,11 +280,13 @@ blueprint:
|
|||
button_6_action:
|
||||
name: Taste 6 – Aktion
|
||||
description: >
|
||||
Umschalten passt für normale Schalter/Lampen und für ein Garagentor
|
||||
(cover-Entität, öffnet/schließt automatisch je nach Zustand).
|
||||
Ein-/Ausschalten eignet sich z. B. für Wippen-Tastenpaare.
|
||||
Für Mähroboter (lawn_mower) stattdessen "Mähen starten", "Pause"
|
||||
oder "Zur Ladestation" verwenden.
|
||||
Umschalten/Ein/Aus passen sich automatisch der Domain der
|
||||
Zielentität an: Schalter/Licht/Lüfter/Sirene = ein/aus, Cover
|
||||
(z. B. Garagentor) = öffnen/schließen, Ventil = öffnen/schließen,
|
||||
Schloss = (ent)sperren. Praktisch für Wippen-Tastenpaare, z. B. eine
|
||||
Taste "Einschalten" (öffnet das Tor) und eine zweite "Ausschalten"
|
||||
(schließt es). Für Mähroboter (lawn_mower) stattdessen "Mähen
|
||||
starten", "Pause" oder "Zur Ladestation" verwenden.
|
||||
default: toggle
|
||||
selector:
|
||||
select:
|
||||
|
|
@ -316,8 +332,27 @@ action:
|
|||
- condition: template
|
||||
value_template: "{{ channel | int == 1 and button_1_entity not in [none, ''] }}"
|
||||
sequence:
|
||||
- action: >-
|
||||
{{ ('lawn_mower.' if button_1_action in ['start_mowing','pause','dock'] else 'homeassistant.') ~ button_1_action }}
|
||||
- action: |-
|
||||
{%- set domain = button_1_entity.split('.')[0] -%}
|
||||
{%- if button_1_action == 'turn_on' and domain == 'cover' -%}
|
||||
cover.open_cover
|
||||
{%- elif button_1_action == 'turn_off' and domain == 'cover' -%}
|
||||
cover.close_cover
|
||||
{%- elif button_1_action == 'turn_on' and domain == 'valve' -%}
|
||||
valve.open_valve
|
||||
{%- elif button_1_action == 'turn_off' and domain == 'valve' -%}
|
||||
valve.close_valve
|
||||
{%- elif button_1_action == 'turn_on' and domain == 'lock' -%}
|
||||
lock.lock
|
||||
{%- elif button_1_action == 'turn_off' and domain == 'lock' -%}
|
||||
lock.unlock
|
||||
{%- elif button_1_action == 'toggle' and domain == 'lock' -%}
|
||||
lock.{{ 'unlock' if is_state(button_1_entity, 'locked') else 'lock' }}
|
||||
{%- elif button_1_action in ['start_mowing', 'pause', 'dock'] -%}
|
||||
lawn_mower.{{ button_1_action }}
|
||||
{%- else -%}
|
||||
homeassistant.{{ button_1_action }}
|
||||
{%- endif -%}
|
||||
target:
|
||||
entity_id: "{{ button_1_entity }}"
|
||||
|
||||
|
|
@ -325,8 +360,27 @@ action:
|
|||
- condition: template
|
||||
value_template: "{{ channel | int == 2 and button_2_entity not in [none, ''] }}"
|
||||
sequence:
|
||||
- action: >-
|
||||
{{ ('lawn_mower.' if button_2_action in ['start_mowing','pause','dock'] else 'homeassistant.') ~ button_2_action }}
|
||||
- action: |-
|
||||
{%- set domain = button_2_entity.split('.')[0] -%}
|
||||
{%- if button_2_action == 'turn_on' and domain == 'cover' -%}
|
||||
cover.open_cover
|
||||
{%- elif button_2_action == 'turn_off' and domain == 'cover' -%}
|
||||
cover.close_cover
|
||||
{%- elif button_2_action == 'turn_on' and domain == 'valve' -%}
|
||||
valve.open_valve
|
||||
{%- elif button_2_action == 'turn_off' and domain == 'valve' -%}
|
||||
valve.close_valve
|
||||
{%- elif button_2_action == 'turn_on' and domain == 'lock' -%}
|
||||
lock.lock
|
||||
{%- elif button_2_action == 'turn_off' and domain == 'lock' -%}
|
||||
lock.unlock
|
||||
{%- elif button_2_action == 'toggle' and domain == 'lock' -%}
|
||||
lock.{{ 'unlock' if is_state(button_2_entity, 'locked') else 'lock' }}
|
||||
{%- elif button_2_action in ['start_mowing', 'pause', 'dock'] -%}
|
||||
lawn_mower.{{ button_2_action }}
|
||||
{%- else -%}
|
||||
homeassistant.{{ button_2_action }}
|
||||
{%- endif -%}
|
||||
target:
|
||||
entity_id: "{{ button_2_entity }}"
|
||||
|
||||
|
|
@ -334,8 +388,27 @@ action:
|
|||
- condition: template
|
||||
value_template: "{{ channel | int == 3 and button_3_entity not in [none, ''] }}"
|
||||
sequence:
|
||||
- action: >-
|
||||
{{ ('lawn_mower.' if button_3_action in ['start_mowing','pause','dock'] else 'homeassistant.') ~ button_3_action }}
|
||||
- action: |-
|
||||
{%- set domain = button_3_entity.split('.')[0] -%}
|
||||
{%- if button_3_action == 'turn_on' and domain == 'cover' -%}
|
||||
cover.open_cover
|
||||
{%- elif button_3_action == 'turn_off' and domain == 'cover' -%}
|
||||
cover.close_cover
|
||||
{%- elif button_3_action == 'turn_on' and domain == 'valve' -%}
|
||||
valve.open_valve
|
||||
{%- elif button_3_action == 'turn_off' and domain == 'valve' -%}
|
||||
valve.close_valve
|
||||
{%- elif button_3_action == 'turn_on' and domain == 'lock' -%}
|
||||
lock.lock
|
||||
{%- elif button_3_action == 'turn_off' and domain == 'lock' -%}
|
||||
lock.unlock
|
||||
{%- elif button_3_action == 'toggle' and domain == 'lock' -%}
|
||||
lock.{{ 'unlock' if is_state(button_3_entity, 'locked') else 'lock' }}
|
||||
{%- elif button_3_action in ['start_mowing', 'pause', 'dock'] -%}
|
||||
lawn_mower.{{ button_3_action }}
|
||||
{%- else -%}
|
||||
homeassistant.{{ button_3_action }}
|
||||
{%- endif -%}
|
||||
target:
|
||||
entity_id: "{{ button_3_entity }}"
|
||||
|
||||
|
|
@ -343,8 +416,27 @@ action:
|
|||
- condition: template
|
||||
value_template: "{{ channel | int == 4 and button_4_entity not in [none, ''] }}"
|
||||
sequence:
|
||||
- action: >-
|
||||
{{ ('lawn_mower.' if button_4_action in ['start_mowing','pause','dock'] else 'homeassistant.') ~ button_4_action }}
|
||||
- action: |-
|
||||
{%- set domain = button_4_entity.split('.')[0] -%}
|
||||
{%- if button_4_action == 'turn_on' and domain == 'cover' -%}
|
||||
cover.open_cover
|
||||
{%- elif button_4_action == 'turn_off' and domain == 'cover' -%}
|
||||
cover.close_cover
|
||||
{%- elif button_4_action == 'turn_on' and domain == 'valve' -%}
|
||||
valve.open_valve
|
||||
{%- elif button_4_action == 'turn_off' and domain == 'valve' -%}
|
||||
valve.close_valve
|
||||
{%- elif button_4_action == 'turn_on' and domain == 'lock' -%}
|
||||
lock.lock
|
||||
{%- elif button_4_action == 'turn_off' and domain == 'lock' -%}
|
||||
lock.unlock
|
||||
{%- elif button_4_action == 'toggle' and domain == 'lock' -%}
|
||||
lock.{{ 'unlock' if is_state(button_4_entity, 'locked') else 'lock' }}
|
||||
{%- elif button_4_action in ['start_mowing', 'pause', 'dock'] -%}
|
||||
lawn_mower.{{ button_4_action }}
|
||||
{%- else -%}
|
||||
homeassistant.{{ button_4_action }}
|
||||
{%- endif -%}
|
||||
target:
|
||||
entity_id: "{{ button_4_entity }}"
|
||||
|
||||
|
|
@ -352,8 +444,27 @@ action:
|
|||
- condition: template
|
||||
value_template: "{{ channel | int == 5 and button_5_entity not in [none, ''] }}"
|
||||
sequence:
|
||||
- action: >-
|
||||
{{ ('lawn_mower.' if button_5_action in ['start_mowing','pause','dock'] else 'homeassistant.') ~ button_5_action }}
|
||||
- action: |-
|
||||
{%- set domain = button_5_entity.split('.')[0] -%}
|
||||
{%- if button_5_action == 'turn_on' and domain == 'cover' -%}
|
||||
cover.open_cover
|
||||
{%- elif button_5_action == 'turn_off' and domain == 'cover' -%}
|
||||
cover.close_cover
|
||||
{%- elif button_5_action == 'turn_on' and domain == 'valve' -%}
|
||||
valve.open_valve
|
||||
{%- elif button_5_action == 'turn_off' and domain == 'valve' -%}
|
||||
valve.close_valve
|
||||
{%- elif button_5_action == 'turn_on' and domain == 'lock' -%}
|
||||
lock.lock
|
||||
{%- elif button_5_action == 'turn_off' and domain == 'lock' -%}
|
||||
lock.unlock
|
||||
{%- elif button_5_action == 'toggle' and domain == 'lock' -%}
|
||||
lock.{{ 'unlock' if is_state(button_5_entity, 'locked') else 'lock' }}
|
||||
{%- elif button_5_action in ['start_mowing', 'pause', 'dock'] -%}
|
||||
lawn_mower.{{ button_5_action }}
|
||||
{%- else -%}
|
||||
homeassistant.{{ button_5_action }}
|
||||
{%- endif -%}
|
||||
target:
|
||||
entity_id: "{{ button_5_entity }}"
|
||||
|
||||
|
|
@ -361,8 +472,27 @@ action:
|
|||
- condition: template
|
||||
value_template: "{{ channel | int == 6 and button_6_entity not in [none, ''] }}"
|
||||
sequence:
|
||||
- action: >-
|
||||
{{ ('lawn_mower.' if button_6_action in ['start_mowing','pause','dock'] else 'homeassistant.') ~ button_6_action }}
|
||||
- action: |-
|
||||
{%- set domain = button_6_entity.split('.')[0] -%}
|
||||
{%- if button_6_action == 'turn_on' and domain == 'cover' -%}
|
||||
cover.open_cover
|
||||
{%- elif button_6_action == 'turn_off' and domain == 'cover' -%}
|
||||
cover.close_cover
|
||||
{%- elif button_6_action == 'turn_on' and domain == 'valve' -%}
|
||||
valve.open_valve
|
||||
{%- elif button_6_action == 'turn_off' and domain == 'valve' -%}
|
||||
valve.close_valve
|
||||
{%- elif button_6_action == 'turn_on' and domain == 'lock' -%}
|
||||
lock.lock
|
||||
{%- elif button_6_action == 'turn_off' and domain == 'lock' -%}
|
||||
lock.unlock
|
||||
{%- elif button_6_action == 'toggle' and domain == 'lock' -%}
|
||||
lock.{{ 'unlock' if is_state(button_6_entity, 'locked') else 'lock' }}
|
||||
{%- elif button_6_action in ['start_mowing', 'pause', 'dock'] -%}
|
||||
lawn_mower.{{ button_6_action }}
|
||||
{%- else -%}
|
||||
homeassistant.{{ button_6_action }}
|
||||
{%- endif -%}
|
||||
target:
|
||||
entity_id: "{{ button_6_entity }}"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue