diff --git a/homeassistant/components/totalconnect/binary_sensor.py b/homeassistant/components/totalconnect/binary_sensor.py index 62f84b3b69ab02a6c916adb08dc50d28a5f6c216..3126efff88af1a4af1d8012e6fb731d0bf851553 100644 --- a/homeassistant/components/totalconnect/binary_sensor.py +++ b/homeassistant/components/totalconnect/binary_sensor.py @@ -101,6 +101,21 @@ LOCATION_BINARY_SENSORS: tuple[TotalConnectAlarmBinarySensorEntityDescription, . entity_category=EntityCategory.DIAGNOSTIC, is_on_fn=lambda location: location.is_ac_loss(), ), + TotalConnectAlarmBinarySensorEntityDescription( + key="smoke", + device_class=BinarySensorDeviceClass.SMOKE, + is_on_fn=lambda location: location.arming_state.is_triggered_fire(), + ), + TotalConnectAlarmBinarySensorEntityDescription( + key="carbon_monoxide", + device_class=BinarySensorDeviceClass.CO, + is_on_fn=lambda location: location.arming_state.is_triggered_gas(), + ), + TotalConnectAlarmBinarySensorEntityDescription( + key="police", + translation_key="police", + is_on_fn=lambda location: location.arming_state.is_triggered_police(), + ), ) diff --git a/homeassistant/components/totalconnect/icons.json b/homeassistant/components/totalconnect/icons.json index 356ce0a929bb522a6e0aeeeea9ee6430fd00a426..cb62a79c7bba8f7cf79aecac5ebee8b74d17929c 100644 --- a/homeassistant/components/totalconnect/icons.json +++ b/homeassistant/components/totalconnect/icons.json @@ -1,4 +1,14 @@ { + "entity": { + "binary_sensor": { + "police": { + "default": "mdi:police-badge-outline", + "state": { + "on": "mdi:police-badge" + } + } + } + }, "services": { "arm_away_instant": "mdi:shield-lock", "arm_home_instant": "mdi:shield-home" diff --git a/homeassistant/components/totalconnect/strings.json b/homeassistant/components/totalconnect/strings.json index e2e5ed7c490853e503834ec59a184a48397b21ba..faa136137db6d3751f5417a87479733e5e60fd4d 100644 --- a/homeassistant/components/totalconnect/strings.json +++ b/homeassistant/components/totalconnect/strings.json @@ -56,6 +56,15 @@ "name": "Partition {partition_id}" } }, + "binary_sensor": { + "police": { + "name": "Police emergency", + "state": { + "off": "No emergency", + "on": "Police emergency" + } + } + }, "button": { "clear_bypass": { "name": "Clear bypass" diff --git a/tests/components/totalconnect/snapshots/test_binary_sensor.ambr b/tests/components/totalconnect/snapshots/test_binary_sensor.ambr index 54089c6f192152fec1439e35f7fd4d1409e32432..81cfecbc530df7b435af50a09ca8ac05c5db1519 100644 --- a/tests/components/totalconnect/snapshots/test_binary_sensor.ambr +++ b/tests/components/totalconnect/snapshots/test_binary_sensor.ambr @@ -847,6 +847,101 @@ 'state': 'off', }) # --- +# name: test_entity_registry[binary_sensor.test_carbon_monoxide-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': <ANY>, + 'device_class': None, + 'device_id': <ANY>, + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': None, + 'entity_id': 'binary_sensor.test_carbon_monoxide', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': <ANY>, + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': <BinarySensorDeviceClass.CO: 'carbon_monoxide'>, + 'original_icon': None, + 'original_name': 'Carbon monoxide', + 'platform': 'totalconnect', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '123456_carbon_monoxide', + 'unit_of_measurement': None, + }) +# --- +# name: test_entity_registry[binary_sensor.test_carbon_monoxide-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'carbon_monoxide', + 'friendly_name': 'test Carbon monoxide', + 'location_id': '123456', + }), + 'context': <ANY>, + 'entity_id': 'binary_sensor.test_carbon_monoxide', + 'last_changed': <ANY>, + 'last_reported': <ANY>, + 'last_updated': <ANY>, + 'state': 'off', + }) +# --- +# name: test_entity_registry[binary_sensor.test_police_emergency-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': <ANY>, + 'device_class': None, + 'device_id': <ANY>, + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': None, + 'entity_id': 'binary_sensor.test_police_emergency', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': <ANY>, + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Police emergency', + 'platform': 'totalconnect', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'police', + 'unique_id': '123456_police', + 'unit_of_measurement': None, + }) +# --- +# name: test_entity_registry[binary_sensor.test_police_emergency-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'test Police emergency', + 'location_id': '123456', + }), + 'context': <ANY>, + 'entity_id': 'binary_sensor.test_police_emergency', + 'last_changed': <ANY>, + 'last_reported': <ANY>, + 'last_updated': <ANY>, + 'state': 'off', + }) +# --- # name: test_entity_registry[binary_sensor.test_power-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ @@ -895,6 +990,54 @@ 'state': 'off', }) # --- +# name: test_entity_registry[binary_sensor.test_smoke-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': <ANY>, + 'device_class': None, + 'device_id': <ANY>, + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': None, + 'entity_id': 'binary_sensor.test_smoke', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': <ANY>, + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': <BinarySensorDeviceClass.SMOKE: 'smoke'>, + 'original_icon': None, + 'original_name': 'Smoke', + 'platform': 'totalconnect', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '123456_smoke', + 'unit_of_measurement': None, + }) +# --- +# name: test_entity_registry[binary_sensor.test_smoke-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'smoke', + 'friendly_name': 'test Smoke', + 'location_id': '123456', + }), + 'context': <ANY>, + 'entity_id': 'binary_sensor.test_smoke', + 'last_changed': <ANY>, + 'last_reported': <ANY>, + 'last_updated': <ANY>, + 'state': 'off', + }) +# --- # name: test_entity_registry[binary_sensor.test_tamper-entry] EntityRegistryEntrySnapshot({ 'aliases': set({