Cover-Template wird nicht angezeigt

Hallo zusammen,

ich habe folgende Ausgangssituation:
Ich steuere eine Projektorleinwand mit einem Shutter-Aktor von Homematic und möchte ein Template anlegen, in der mir “offen” als “hochgefahren” und geschlossen als "heruntergefahren angezeigt wird. zudem soll 100% zu 0% und 0% zu 100% werden. Auch das Icon wird je nach Status geändert.

Ich habe hier ein Template in der Configuration.yaml angelegt und sowohl die Konfiguration neu geladen und auch HA komplet neu gestartet, aber das Template taucht nicht auf. Einen Fehler in der Datei kann ich nicht ausmachen…

Vielleicht sehe ich den Wald vor lauter Bäumen einfach nicht!?

cover:
  - platform: template
    covers:
        leinwand_invert:
            friendly_name: "Leinwand"
            value_template: |
                {{ 100 - state_attr("cover.hmip_hap_leinwand", "current_position") }}
            state: >
                {% if is_state('cover.hmip_hap_leinwand', 'open') %}
                hochgefahren
                {% elif is_state('cover.hmip_hap_leinwand', 'closed') %}
                heruntergefahren
                {% else %}
                unbekannt
                {% endif %}
            open_cover:
                service: cover.close_cover
                data: {}
                target:
                    entity_id: cover.hmip_hap_leinwand
            close_cover:
                service: cover.open_cover
                data: {}
                target:
                    entity_id: cover.hmip_hap_leinwand
            stop_cover:
                service: cover.stop_cover
                data: {}
                target:
                    entity_id: cover.hmip_hap_leinwand
            icon_template: >-
                {% if is_state('cover.hmip_hap_leinwand', 'open') %}
                    mdi:projector-screen-variant-off
                {% else %}
                    mdi:projector-screen-variant
                {% endif %}

Im Template Editor sieht meines Erachtens auch alles gut aus:

Hat jemand eine Idee? Ich weiß nicht mehr weiter…

Gruß
Dennis

So habe ich das Template wenigstens schon mal so weit, dass es auftaucht aber es reagiert nicht auf die Zustände es zeigt permanent “unknown” an und die Tasten sind funktionslos

cover:
  - platform: template
    covers:
        leinwand_invert:
            friendly_name: "Leinwand"
            value_template: |
                {{ 100 - state_attr("cover.hmip_hap_leinwand", "current_position") }}
            position_template: |
                {% if is_state('cover.hmip_hap_leinwand', 'open') %}
                hochgefahren
                {% elif is_state('cover.hmip_hap_leinwand', 'closed') %}
                heruntergefahren
                {% else %}
                unbekannt
                {% endif %}
            open_cover:
                action: cover.close_cover
                data: {}
                target:
                    entity_id: cover.hmip_hap_leinwand
            close_cover:
                action: cover.open_cover
                data: {}
                target:
                    entity_id: cover.hmip_hap_leinwand
            stop_cover:
                action: cover.stop_cover
                data: {}
                target:
                    entity_id: cover.hmip_hap_leinwand
            icon_template: >-
                {% if is_state('cover.hmip_hap_leinwand', 'open') %}
                    mdi:projector-screen-variant-off
                {% else %}
                    mdi:projector-screen-variant
                {% endif %}

Wenn du nur das alleine in den Template-Editor reinkopierst

{% if is_state('cover.hmip_hap_leinwand', 'open') %}
hochgefahren
{% elif is_state('cover.hmip_hap_leinwand', 'closed') %}
heruntergefahren
{% else %}
unbekannt
{% endif %}

oder

{{ 100 - state_attr("cover.hmip_hap_leinwand", "current_position") }}

ist dann das Ergebnis korrekt?

Wenn nicht, dann zeigt mal bitte Staus und Attribute von cover.hmip_hap_leinwand

Hi Alex,

ja, der beide Ereignisse werden mir hier korrekt angezeigt

Gruß
Dennis

nimm mal testweise das position_template raus, oder tausch das mit dem value_template aus

aus der Doku:
position_template (optional)

Defines a template to get the position of the cover. Legal values are numbers between 0 (closed) and 100 (open). If the template produces a None value the current position will be set to unknown.

Das muss andersrum sein.

value_template template (optional)
Defines a template to get the state of the cover. Valid output values from the template are open, opening, closing and closed which are directly mapped to the corresponding states. In addition, true is valid as a synonym to open and false as a synonym to closed. If both a value_template and a position_templateare specified, only opening and closing are set from the value_template. If the template produces a None value the state will be set to unknown.

position_template template (optional)
Defines a template to get the position of the cover. Legal values are numbers between 0 (closed) and 100(open). If the template produces a None value the current position will be set to unknown.

1 „Gefällt mir“

das hat es tatsächlich gebracht, jedoch steht im Template trotzdem open/closed und nicht hoch-/runtergefahren.

Ich kann nur noch mal darauf verweisen:

Das habe ich auch soweit verstanden. Ich dachte man kann den Status der Entität so anpassen, dass mir eben statt “closed” also Status “heruntergefahren” angezeigt wird.

im Template Editor wird mir es ja auch entsprechend angezeigt wie es sein soll:

Ich hatte das seinerzeit schon durchexerziert (wollte halb, 50 % etc.), das nimmt er aber nicht.