Fix: channel-Vergleich robust mit | int statt String-Vergleich

HA parst Template-Ergebnisse, die wie Zahlen aussehen, automatisch
zurück in den nativen Typ. channel == '3' (String-Vergleich) war
dadurch immer False, selbst bei korrekt konfigurierten Tasten.
This commit is contained in:
martin 2026-07-27 15:17:46 +00:00
parent df43edc5c4
commit 5120617777

View file

@ -233,7 +233,7 @@ blueprint:
label: Ausschalten label: Ausschalten
variables: variables:
channel: "{{ trigger.event.data.channel | string }}" channel: "{{ trigger.event.data.channel }}"
button_1_entity: !input button_1_entity button_1_entity: !input button_1_entity
button_1_action: !input button_1_action button_1_action: !input button_1_action
button_2_entity: !input button_2_entity button_2_entity: !input button_2_entity
@ -257,7 +257,7 @@ action:
- choose: - choose:
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ channel == '1' and button_1_entity not in [none, ''] }}" value_template: "{{ channel | int == 1 and button_1_entity not in [none, ''] }}"
sequence: sequence:
- action: "homeassistant.{{ button_1_action }}" - action: "homeassistant.{{ button_1_action }}"
target: target:
@ -265,7 +265,7 @@ action:
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ channel == '2' and button_2_entity not in [none, ''] }}" value_template: "{{ channel | int == 2 and button_2_entity not in [none, ''] }}"
sequence: sequence:
- action: "homeassistant.{{ button_2_action }}" - action: "homeassistant.{{ button_2_action }}"
target: target:
@ -273,7 +273,7 @@ action:
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ channel == '3' and button_3_entity not in [none, ''] }}" value_template: "{{ channel | int == 3 and button_3_entity not in [none, ''] }}"
sequence: sequence:
- action: "homeassistant.{{ button_3_action }}" - action: "homeassistant.{{ button_3_action }}"
target: target:
@ -281,7 +281,7 @@ action:
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ channel == '4' and button_4_entity not in [none, ''] }}" value_template: "{{ channel | int == 4 and button_4_entity not in [none, ''] }}"
sequence: sequence:
- action: "homeassistant.{{ button_4_action }}" - action: "homeassistant.{{ button_4_action }}"
target: target:
@ -289,7 +289,7 @@ action:
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ channel == '5' and button_5_entity not in [none, ''] }}" value_template: "{{ channel | int == 5 and button_5_entity not in [none, ''] }}"
sequence: sequence:
- action: "homeassistant.{{ button_5_action }}" - action: "homeassistant.{{ button_5_action }}"
target: target:
@ -297,7 +297,7 @@ action:
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ channel == '6' and button_6_entity not in [none, ''] }}" value_template: "{{ channel | int == 6 and button_6_entity not in [none, ''] }}"
sequence: sequence:
- action: "homeassistant.{{ button_6_action }}" - action: "homeassistant.{{ button_6_action }}"
target: target: