-
-
Notifications
You must be signed in to change notification settings - Fork 22
Community Templates for Home Assistant
by default, smoke-detectors and similar security devices are binary sensors that only have an "on" and "off" state. The HmIP-SWSD is different, because it can provide different states - and therefore it will not be created as a binary sensor - and cannot use state_colors that have been added with HomeAssistant 2022.12.
The below Templates trying to solve that, by creating two binary_sensors. One for the Smoke-Detector - and one for an additional option, since the HmIP-SWSD can also be used as an alarm device for intrusion detection systems.
The "Alarm Type" that is used as sensor value will be moved to an Sensor-Attribute. But you can also use the sensor.......alarm_state directly to show the Alarm Type in your Dashboard
Please note, that the provided entity names needs to be replaced and should match your installation
#Smoke Detector Alarm
- binary_sensor:
- name: "Rauchwarnmelder Arbeitszimmer"
unique_id: "rauchwarnmelder_arbeitszimmer"
icon: >
{% if states('sensor.rauchwarnmelder_arbeitszimmer_smoke_detector_alarm_status') in ['idle_off', 'intrusion_alarm'] %}
mdi:smoke-detector-variant
{% elif states('sensor.rauchwarnmelder_arbeitszimmer_smoke_detector_alarm_status') in ['primary_alarm','secondary_alarm'] %}
mdi:smoke-detector-variant-alert
{% endif %}
device_class: smoke
state: >
{% if states('sensor.rauchwarnmelder_arbeitszimmer_smoke_detector_alarm_status') in ['idle_off', 'intrusion_alarm'] %}
off
{% elif states('sensor.rauchwarnmelder_arbeitszimmer_smoke_detector_alarm_status') in ['primary_alarm', 'secondary_alarm'] %}
on
{% endif %}
availability: >
{{ states('sensor.rauchwarnmelder_arbeitszimmer_smoke_detector_alarm_status') not in ['unknown', 'unavailable', 'None'] }}
attributes:
Device State: >
{% if is_state('sensor.rauchwarnmelder_arbeitszimmer_smoke_detector_alarm_status', 'idle_off') %}
Untätig
{% elif is_state('sensor.rauchwarnmelder_arbeitszimmer_smoke_detector_alarm_status', 'primary_alarm') %}
Primärer Alarm - Rauch erkannt!
{% elif is_state('sensor.rauchwarnmelder_arbeitszimmer_smoke_detector_alarm_status', 'secondary_alarm') %}
Sekundärer Alarm - durch anderen Rauchmelder ausgelöst
{% endif %}
# Intrusion Alarm Device
- binary_sensor:
- name: "Einbruchsalarm Arbeitszimmer"
unique_id: "intrusion_alarm_arbeitszimmer"
icon: >
{% if states('sensor.rauchwarnmelder_arbeitszimmer_smoke_detector_alarm_status') in ['idle_off', 'secondary_alarm', 'primary_alarm'] %}
mdi:shield
{% elif is_state('sensor.rauchwarnmelder_arbeitszimmer_smoke_detector_alarm_status', 'intrusion_alarm') %}
mdi:shield-alert
{% endif %}
device_class: tamper
state: >
{% if states('sensor.rauchwarnmelder_arbeitszimmer_smoke_detector_alarm_status') in ['idle_off', 'secondary_alarm', 'primary_alarm'] %}
off
{% elif is_state('sensor.rauchwarnmelder_arbeitszimmer_smoke_detector_alarm_status', 'intrusion_alarm') %}
on
{% endif %}
availability: >
{{ states('sensor.rauchwarnmelder_arbeitszimmer_smoke_detector_alarm_status') not in ['unknown', 'unavailable', 'None'] }}
attributes:
Device State: >
{% if is_state('sensor.rauchwarnmelder_arbeitszimmer_smoke_detector_alarm_status', 'idle_off') %}
Untätig
{% elif is_state('sensor.rauchwarnmelder_arbeitszimmer_smoke_detector_alarm_status', 'intrusion_alarm') %}
Einbruch erkannt!
{% endif %}
And here the new state colors can be seen:
-
default, device is idle:
-
Active primary alarm (device has detected smoke)
-
Active secondary alarm (another device has detected smoke and triggered the alarm on this device)
-
Active intrusion alarm (device is connected into the security options from homematic)