Helfer / Blaupause für zwei zu kombinierende Sensoren

Vielen lieben Dank an @Bacardi und @Osorkon, Ihr habt meinen Wunsch Wirklichkeit werden lassen. Hätte ich mir die letzte Nacht sparen können, wenn ich gleich gefragt hätte :grinning:

Macro für Fenstergriff (HmIP-SRH) & Fensterkontakt (HmIP-SWDO-I):

#window.jinja
{% macro window_entity(window_handle, contact_sensor) %}
{% if states(window_handle) == "closed" and states(contact_sensor) == "off" %}
Geschlossen
{% elif states(window_handle) == "tilted" and states(contact_sensor) == "off" %}
Angelehnt
{% elif states(window_handle) == "open" and states(contact_sensor) == "off" %}
Angelehnt
{% elif states(window_handle) == "closed" and states(contact_sensor) == "on" %}
Sabotage
{% elif states(window_handle) == "tilted" and states(contact_sensor) == "on" %}
Gekippt
{% elif states(window_handle) == "open" and states(contact_sensor) == "on" %}
Offen
{% else %}
Unbekannt
{% endif %}
{% endmacro %}

Template für Fenstergriff (HmIP-SRH) & Fensterkontakt (HmIP-SWDO-I):

{% from 'window.jinja' import window_entity %}
{{ window_entity('sensor.treppenabsatz_fenstergriff', 'binary_sensor.treppenabsatz_fenster') }}

Ich habe noch eine Abwandlung erstellt, um unsere Haustür inkl. Türschloss abzubilden.

Macro für Türkontakt (HmIP-SWDO-PL) + Türschloss (HmIP-SCI):

#door.jinja
{% macro door_entity(contact_sensor1, contact_sensor2) %}
{% if states(contact_sensor1) == "off" and states(contact_sensor2) == "off" %}
Verschlossen
{% elif states(contact_sensor1) == "off" and states(contact_sensor2) == "on" %}
Geschlossen
{% elif states(contact_sensor1) == "on" and states(contact_sensor2) == "off" %}
Sabotage
{% elif states(contact_sensor1) == "on" and states(contact_sensor2) == "on" %}
Offen
{% else %}
Unbekannt
{% endif %}
{% endmacro %}

Template für Türkontakt (HmIP-SWDO-PL) + Türschloss (HmIP-SCI):

{% from 'door.jinja' import door_entity %}
{{ door_entity('binary_sensor.haustur', 'binary_sensor.haustur_verschluss') }}