diff --git a/homeassistant/components/homematicip_cloud/binary_sensor.py b/homeassistant/components/homematicip_cloud/binary_sensor.py index 52a4583be46..00147e1b7ec 100644 --- a/homeassistant/components/homematicip_cloud/binary_sensor.py +++ b/homeassistant/components/homematicip_cloud/binary_sensor.py @@ -50,6 +50,7 @@ ATTR_ACCELERATION_SENSOR_MODE = "acceleration_sensor_mode" ATTR_ACCELERATION_SENSOR_NEUTRAL_POSITION = "acceleration_sensor_neutral_position" ATTR_ACCELERATION_SENSOR_SENSITIVITY = "acceleration_sensor_sensitivity" ATTR_ACCELERATION_SENSOR_TRIGGER_ANGLE = "acceleration_sensor_trigger_angle" +ATTR_INTRUSION_ALARM = "intrusion_alarm" ATTR_MOISTURE_DETECTED = "moisture_detected" ATTR_MOTION_DETECTED = "motion_detected" ATTR_POWER_MAINS_FAILURE = "power_mains_failure" @@ -229,7 +230,8 @@ class HomematicipSmokeDetector(HomematicipGenericDevice, BinarySensorDevice): """Return true if smoke is detected.""" if self._device.smokeDetectorAlarmType: return ( - self._device.smokeDetectorAlarmType != SmokeDetectorAlarmType.IDLE_OFF + self._device.smokeDetectorAlarmType + == SmokeDetectorAlarmType.PRIMARY_ALARM ) return False @@ -421,9 +423,11 @@ class HomematicipSecuritySensorGroup( state_attr = super().device_state_attributes smoke_detector_at = getattr(self._device, "smokeDetectorAlarmType", None) - if smoke_detector_at and smoke_detector_at != SmokeDetectorAlarmType.IDLE_OFF: - state_attr[ATTR_SMOKE_DETECTOR_ALARM] = str(smoke_detector_at) - + if smoke_detector_at: + if smoke_detector_at == SmokeDetectorAlarmType.PRIMARY_ALARM: + state_attr[ATTR_SMOKE_DETECTOR_ALARM] = str(smoke_detector_at) + if smoke_detector_at == SmokeDetectorAlarmType.INTRUSION_ALARM: + state_attr[ATTR_INTRUSION_ALARM] = str(smoke_detector_at) return state_attr @property diff --git a/tests/components/homematicip_cloud/test_binary_sensor.py b/tests/components/homematicip_cloud/test_binary_sensor.py index a66dd6d49ea..43b88976043 100644 --- a/tests/components/homematicip_cloud/test_binary_sensor.py +++ b/tests/components/homematicip_cloud/test_binary_sensor.py @@ -429,3 +429,12 @@ async def test_hmip_security_sensor_group(hass, default_mock_hap_factory): assert ha_state.attributes[ATTR_GROUP_MEMBER_UNREACHABLE] assert ha_state.attributes[ATTR_SABOTAGE] assert ha_state.attributes[ATTR_WINDOW_STATE] == WindowState.OPEN + + await async_manipulate_test_data( + hass, + hmip_device, + "smokeDetectorAlarmType", + SmokeDetectorAlarmType.INTRUSION_ALARM, + ) + ha_state = hass.states.get(entity_id) + assert ha_state.state == STATE_ON