Dashboard mit 2 Ampeln für Störungsanzeige einer Abwasseranlage

Hallo,

ich versuche mich schon seit Tagen der Darstellung einer Ampel auf dem Home Assistant Dashboard, aber ich bekommen es nicht hin.

Ich habe hier eine Shelly i4 Gen3. Diese soll an einer privaten technischen Abwasser-Anlage die Zustände “Störung Allgemein” mit “OK” (grün) bzw. “Alarm” (rot) und “Störung Hochwasser” mit “OK” (grün) und “Alarm” (rot) mit 2 Ampeln darstellen. Die Anlage hat dazu 2 potentialfreie Wechselkontakte jeweils für “OK” und “Alarm”. Diese Wechselkontakte simuliere ich mit einem Doppel-Wechselschalter, da die Anlage noch nicht installiert ist.

Dazu habe ich 2 Helfer als Template-Binärsensoren angelegt, die jeweils 2 Eingänge der Shelly i4 abfragen und auswerten. Hier exemplarisch der eine Helfer (der Andere ist gleich, nur die Eingänge sind anders)

Helfer 1: Status Hebeanlage allgemein

{% if is_state('binary_sensor.carport_einfahrt_i4cpha_eingang_0', 'on')
and is_state('binary_sensor.carport_einfahrt_i4cpha_eingang_1', 'off') %}
true
{% elif is_state('binary_sensor.carport_einfahrt_i4cpha_eingang_0', 'off')
and is_state('binary_sensor.carport_einfahrt_i4cpha_eingang_1', 'on') %}
false
{% endif %}

Dazu das Dashboard mit der “Multiple Entity Row Card” + “Card-mod”:

type: entities
entities:
  - entity: binary_sensor.carport_einfahrt_i4cpha_status_hebeanlage_allgemein
    type: custom:multiple-entity-row
    name: Status Hebeanlage allgemein
    secondary_info: false
    show_state: false
    entities:
      - icon: mdi:circle
      - icon: mdi:circle
    card_mod:
      style:
        hui-generic-entity-row $: ''
        .: |
          div.entity:nth-child(1) state-badge {
            color: {% if states('binary_sensor.carport_einfahrt_i4cpha_status_hebeanlage_allgemein') = ein %} red {% else %} grey {% endif %}
          }
          div.entity:nth-child(2) state-badge {
            color: {% if states('binary_sensor.carport_einfahrt_i4cpha_status_hebeanlage_allgemein') = aus %} green {% else %} grey {% endif %}
          }

Das Ergebnis ist, dass bei “Eingang 0 = 1” und “Eingang 1 = 0” beide Punkte gelb angezeigt werden, und wenn ich den Status ändere (“Eingang 0 = 0” und “Eingang 1 = 1”) dann sind beide Punkte grau. Was ist falsch? Die Helfer wechseln wie gewünscht den Status.

Inspirieren lassen habe ich mich von diesem Beitrag:
Traffic light card - Configuration / Frontend - Home Assistant Community

Oder habt Ihr einen alternativen Vorschlag, wie ich das gewünschte Ergebnis erreichen kann?

Gruß

StefanV3

Binärsensor Ein, aus?

Hier benutzt Du auch on/off

Danke für den Hinweis. Ich habe es geändert (ein bzw. aus zu on bzw. off), aber es funktioniert trotzdem nicht…

Mit Hochkommata?
Ich kann am Handy wenig probieren, erst Montag wieder. Aber bis dahin wird Dir jemand anderes geantwortet haben.
Gehen andere card_mods noch? Ich frage wegen neuem HA Updates

Hallo,

die Hochkommata habe ich rausgenommen. Das hat dafür gesorgt, dass sich die Stati umgekehrt haben, abe rnicht mehr. Ob es tatsächlich am card-mod liegen könnte weiß ich nicht. Aber ich habe auch den Beitrag hier gesehen, wo gefragt wird, ob er mit 2026.8 stirbt…

Kann sein, dass es daran liegt.

Gibt es andere Ideen, wie ich das umsetzen könnte?

Gruß

StefanV3

Hallo nochmal,

ich habe nochmal die KI bemüht und habe es jetzt mittels Markdown-Karte sekbst lösen können. Nun ist auch die Darstellung korrekt.

Hier der Code für die Markdown-Karte:

type: markdown
content: >
  {% set s1 = states('binary_sensor.carport_einfahrt_i4cpha_eingang_0') %}  {%
  set s2 = states('binary_sensor.carport_einfahrt_i4cpha_eingang_1') %}  {% set
  s3 = states('binary_sensor.carport_einfahrt_i4cpha_eingang_2') %}  {% set s4 =
  states('binary_sensor.carport_einfahrt_i4cpha_eingang_3') %}

  Status allgemein  {% if s1 == 'off' and s2 == 'on' %}
    <font color="red"><ha-icon icon="mdi:circle"></ha-icon></font> Alarm
    <font color="grey"><ha-icon icon="mdi:circle"></ha-icon></font> Warnung: Unplausibler Zustand
    <font color="grey"><ha-icon icon="mdi:circle"></ha-icon></font> OK
  {% elif s1 == 'on' and s2 == 'off' %}
    <font color="grey"><ha-icon icon="mdi:circle"></ha-icon></font> Alarm
    <font color="grey"><ha-icon icon="mdi:circle"></ha-icon></font> Warnung: Unplausibler Zustand
    <font color="green"><ha-icon icon="mdi:circle"></ha-icon></font> OK
  {% else %}
    <font color="grey"><ha-icon icon="mdi:circle"></ha-icon></font> Alarm
    <font color="yellow"><ha-icon icon="mdi:circle"></ha-icon></font> Warnung: Unplausibler Zustand
    <font color="grey"><ha-icon icon="mdi:circle"></ha-icon></font> OK
  {% endif%}

  Status Hochwasser  {% if s3 == 'off' and s4 == 'on' %}
    <font color="red"><ha-icon icon="mdi:circle"></ha-icon></font> Alarm
    <font color="grey"><ha-icon icon="mdi:circle"></ha-icon></font> Warnung: Unplausibler Zustand
    <font color="grey"><ha-icon icon="mdi:circle"></ha-icon></font> OK
  {% elif s3 == 'on' and s4 == 'off' %}
    <font color="grey"><ha-icon icon="mdi:circle"></ha-icon></font> Alarm
    <font color="grey"><ha-icon icon="mdi:circle"></ha-icon></font> Warnung: Unplausibler Zustand
    <font color="green"><ha-icon icon="mdi:circle"></ha-icon></font> OK
  {% else %}
    <font color="grey"><ha-icon icon="mdi:circle"></ha-icon></font> Alarm
    <font color="yellow"><ha-icon icon="mdi:circle"></ha-icon></font> Warnung: Unplausibler Zustand
    <font color="grey"><ha-icon icon="mdi:circle"></ha-icon></font> OK
  {% endif%}
title: Status Hebeanlage