Homematic IP smoke detector (hip-swsd) setup binary alarm state sensor for integration in alarm panel

HI,

I try to generate a template for a binary security alarm sensor for the homematic IP smoke detector (hip-swsd) integrated over HACS homematic (IP) local integration.

For some reason the HACS integration does not generate an alarm (binary_Sesnor) for each smoke detector in home assistant. There is only one hidden sensor that shows the smoke detector states like
primary_alarm
secondary_alarm
intrusion_alarm
idle
unknown
unavailable

My challenge is now that I need a binary sensor for each smoke detector to integrate the smoke detectors into alarms security alarm panel integration of home assistant. I tested several ways to template a binary sensor but did not find a way.

The condition is that if smoke detector alarm Status is “primary_alarm” than set binary_sensor to smoke alarm detected/open, on all other states the binary sensor should be clear/closed.

Is there a way I can do this with a binary sensor template that always updates the binary sensor on state changes of the smoke detector?

Thanks for your help.

I setup a helper from the type template as binary_sensor and device_class: Smoke.

As state template I configured this:

{{ is_state(‘sensor.smoke_roof_alarm_status’, ‘primary_alarm’) }}

Does anyone else has had the challenge to integration the hmip-swsd smoke detector as binary sensors into security alarm panel?

Have a look at this template.