Boolean auslesen

Bolschi

Member
Ich versuche graden den Wert eines Boolean auszulesen.
Code:
action: call-service
  service: |
    [[[
      if (states['input_boolean.triggerkamera'].state = on) return 'input_boolean.turn_off';
      if (states['input_boolean.triggerkamera'].state = off) return 'input_boolean.turn_on';
      ;
    ]]]
Der Boolean hat entweder den Zustand on oder den Zustand off. Ich vermute mal wieder,dass mein Syntax falsch ist.
Könnte ihr mir einen Tipp geben?
Danke
Marco
 
Ich habe mir einen Helfer erstellt (Umschalter). Keine Ahnung wie ich abfragen kann ob der Boolean wahr oder false ist :)
 
achso :) Ich habe mir eine Automatisierung erstellt welche ausgelöste wird sobald der input_boolean.triggerkamera auf on steht.
 
Dazu habe ich dir ja schon geantwortet.
Da ist die Buttoncard ja richtig.
Machst du die Automatisierung über die GUI?
Dann ist das doch viel einfacher.
 
YAML:
{{ iif ((states('input_boolean.triggerkamera') == 'on'),
'input_boolean.turn_off' , 'input_boolean.turn_on' ) }}

Oder

YAML:
{% if states('input_boolean.triggerkamera') == 'on' %}
input_boolean.turn_off
{% elif states('input_boolean.triggerkamera') == 'off' %}
input_boolean.turn_on
{% endif %}
 
irgendwie stelle ich mich zu blöde an:
Geht nicht...:(
YAML:
type: custom:button-card
entity: alarm_control_panel.aarlo_arlo_basis
icon_color: amber
color_type: card
tap_action:
  action: call-service
  service: |
    [[[
      {% if states('input_boolean.triggerkamera') == 'on' %}
      input_boolean.turn_off
      {% elif states('input_boolean.triggerkamera') == 'off' %}
      input_boolean.turn_on
      {% endif %}
      
    ]]]
  service_data:
    entity_id: input_boolean.triggerkamera
secondary_info: last-changed
styles:
  card:
    - height: 116px
    - width: 110px
    - font-size: 13px
  icon:
    - width: 66px
 
YAML:
type: custom:button-card
entity: alarm_control_panel.aarlo_arlo_basis
icon_color: amber
color_type: card
tap_action:
  action: call-service
  service: >-
      {% if states('input_boolean.triggerkamera') == 'on' %}
      input_boolean.turn_off
      {% elif states('input_boolean.triggerkamera') == 'off' %}
      input_boolean.turn_on
      {% endif %}
  service_data:
    entity_id: input_boolean.triggerkamera
secondary_info: last-changed
styles:
  card:
    - height: 116px
    - width: 110px
    - font-size: 13px
  icon:
    - width: 66px
 

Zurzeit aktive Besucher

Keine Mitglieder online.

Letzte Anleitungen

Statistik des Forums

Themen
5.021
Beiträge
50.325
Mitglieder
4.712
Neuestes Mitglied
ChristianH
Zurück
Oben