diff --git a/homeassistant/components/tailwind/binary_sensor.py b/homeassistant/components/tailwind/binary_sensor.py index 13a987bb998..eaa0cbd1a08 100644 --- a/homeassistant/components/tailwind/binary_sensor.py +++ b/homeassistant/components/tailwind/binary_sensor.py @@ -7,6 +7,7 @@ from dataclasses import dataclass from gotailwind import TailwindDoor from homeassistant.components.binary_sensor import ( + BinarySensorDeviceClass, BinarySensorEntity, BinarySensorEntityDescription, ) @@ -30,10 +31,11 @@ class TailwindDoorBinarySensorEntityDescription(BinarySensorEntityDescription): DESCRIPTIONS: tuple[TailwindDoorBinarySensorEntityDescription, ...] = ( TailwindDoorBinarySensorEntityDescription( key="locked_out", - translation_key="operational_status", + translation_key="operational_problem", entity_category=EntityCategory.DIAGNOSTIC, + device_class=BinarySensorDeviceClass.PROBLEM, icon="mdi:garage-alert", - is_on_fn=lambda door: not door.locked_out, + is_on_fn=lambda door: door.locked_out, ), ) diff --git a/homeassistant/components/tailwind/strings.json b/homeassistant/components/tailwind/strings.json index de5a025cbce..ab472a46739 100644 --- a/homeassistant/components/tailwind/strings.json +++ b/homeassistant/components/tailwind/strings.json @@ -47,11 +47,11 @@ }, "entity": { "binary_sensor": { - "operational_status": { - "name": "Operational status", + "operational_problem": { + "name": "Operational problem", "state": { - "off": "Locked out", - "on": "Operational" + "off": "Operational", + "on": "Locked out" } } }, diff --git a/tests/components/tailwind/snapshots/test_binary_sensor.ambr b/tests/components/tailwind/snapshots/test_binary_sensor.ambr index 68a503e7fc0..aafd15501ee 100644 --- a/tests/components/tailwind/snapshots/test_binary_sensor.ambr +++ b/tests/components/tailwind/snapshots/test_binary_sensor.ambr @@ -1,18 +1,19 @@ # serializer version: 1 -# name: test_number_entities +# name: test_number_entities[binary_sensor.door_1_operational_problem] StateSnapshot({ 'attributes': ReadOnlyDict({ - 'friendly_name': 'Door 1 Operational status', + 'device_class': 'problem', + 'friendly_name': 'Door 1 Operational problem', 'icon': 'mdi:garage-alert', }), 'context': , - 'entity_id': 'binary_sensor.door_1_operational_status', + 'entity_id': 'binary_sensor.door_1_operational_problem', 'last_changed': , 'last_updated': , - 'state': 'on', + 'state': 'off', }) # --- -# name: test_number_entities.1 +# name: test_number_entities[binary_sensor.door_1_operational_problem].1 EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -24,7 +25,7 @@ 'disabled_by': None, 'domain': 'binary_sensor', 'entity_category': , - 'entity_id': 'binary_sensor.door_1_operational_status', + 'entity_id': 'binary_sensor.door_1_operational_problem', 'has_entity_name': True, 'hidden_by': None, 'icon': None, @@ -32,162 +33,18 @@ 'name': None, 'options': dict({ }), - 'original_device_class': None, + 'original_device_class': , 'original_icon': 'mdi:garage-alert', - 'original_name': 'Operational status', + 'original_name': 'Operational problem', 'platform': 'tailwind', 'previous_unique_id': None, 'supported_features': 0, - 'translation_key': 'operational_status', + 'translation_key': 'operational_problem', 'unique_id': '_3c_e9_e_6d_21_84_-door1-locked_out', 'unit_of_measurement': None, }) # --- -# name: test_number_entities.2 - DeviceRegistryEntrySnapshot({ - 'area_id': None, - 'config_entries': , - 'configuration_url': None, - 'connections': set({ - }), - 'disabled_by': None, - 'entry_type': None, - 'hw_version': None, - 'id': , - 'identifiers': set({ - tuple( - 'tailwind', - '_3c_e9_e_6d_21_84_-door1', - ), - }), - 'is_new': False, - 'manufacturer': 'Tailwind', - 'model': 'iQ3', - 'name': 'Door 1', - 'name_by_user': None, - 'serial_number': None, - 'suggested_area': None, - 'sw_version': '10.10', - 'via_device_id': None, - }) -# --- -# name: test_number_entities.3 - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'Door 2 Operational status', - 'icon': 'mdi:garage-alert', - }), - 'context': , - 'entity_id': 'binary_sensor.door_2_operational_status', - 'last_changed': , - 'last_updated': , - 'state': 'on', - }) -# --- -# name: test_number_entities.4 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': None, - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'binary_sensor', - 'entity_category': , - 'entity_id': 'binary_sensor.door_2_operational_status', - 'has_entity_name': True, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': None, - 'original_icon': 'mdi:garage-alert', - 'original_name': 'Operational status', - 'platform': 'tailwind', - 'previous_unique_id': None, - 'supported_features': 0, - 'translation_key': 'operational_status', - 'unique_id': '_3c_e9_e_6d_21_84_-door2-locked_out', - 'unit_of_measurement': None, - }) -# --- -# name: test_number_entities.5 - DeviceRegistryEntrySnapshot({ - 'area_id': None, - 'config_entries': , - 'configuration_url': None, - 'connections': set({ - }), - 'disabled_by': None, - 'entry_type': None, - 'hw_version': None, - 'id': , - 'identifiers': set({ - tuple( - 'tailwind', - '_3c_e9_e_6d_21_84_-door2', - ), - }), - 'is_new': False, - 'manufacturer': 'Tailwind', - 'model': 'iQ3', - 'name': 'Door 2', - 'name_by_user': None, - 'serial_number': None, - 'suggested_area': None, - 'sw_version': '10.10', - 'via_device_id': None, - }) -# --- -# name: test_number_entities[binary_sensor.door_1_operational_status] - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'friendly_name': 'Door 1 Operational status', - 'icon': 'mdi:garage-alert', - }), - 'context': , - 'entity_id': 'binary_sensor.door_1_operational_status', - 'last_changed': , - 'last_updated': , - 'state': 'on', - }) -# --- -# name: test_number_entities[binary_sensor.door_1_operational_status].1 - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': None, - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'binary_sensor', - 'entity_category': , - 'entity_id': 'binary_sensor.door_1_operational_status', - 'has_entity_name': True, - 'hidden_by': None, - 'icon': None, - 'id': , - 'name': None, - 'options': dict({ - }), - 'original_device_class': None, - 'original_icon': 'mdi:garage-alert', - 'original_name': 'Operational status', - 'platform': 'tailwind', - 'previous_unique_id': None, - 'supported_features': 0, - 'translation_key': 'operational_status', - 'unique_id': '_3c_e9_e_6d_21_84_-door1-locked_out', - 'unit_of_measurement': None, - }) -# --- -# name: test_number_entities[binary_sensor.door_1_operational_status].2 +# name: test_number_entities[binary_sensor.door_1_operational_problem].2 DeviceRegistryEntrySnapshot({ 'area_id': None, 'config_entries': , @@ -215,20 +72,21 @@ 'via_device_id': , }) # --- -# name: test_number_entities[binary_sensor.door_2_operational_status] +# name: test_number_entities[binary_sensor.door_2_operational_problem] StateSnapshot({ 'attributes': ReadOnlyDict({ - 'friendly_name': 'Door 2 Operational status', + 'device_class': 'problem', + 'friendly_name': 'Door 2 Operational problem', 'icon': 'mdi:garage-alert', }), 'context': , - 'entity_id': 'binary_sensor.door_2_operational_status', + 'entity_id': 'binary_sensor.door_2_operational_problem', 'last_changed': , 'last_updated': , - 'state': 'on', + 'state': 'off', }) # --- -# name: test_number_entities[binary_sensor.door_2_operational_status].1 +# name: test_number_entities[binary_sensor.door_2_operational_problem].1 EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -240,7 +98,7 @@ 'disabled_by': None, 'domain': 'binary_sensor', 'entity_category': , - 'entity_id': 'binary_sensor.door_2_operational_status', + 'entity_id': 'binary_sensor.door_2_operational_problem', 'has_entity_name': True, 'hidden_by': None, 'icon': None, @@ -248,18 +106,18 @@ 'name': None, 'options': dict({ }), - 'original_device_class': None, + 'original_device_class': , 'original_icon': 'mdi:garage-alert', - 'original_name': 'Operational status', + 'original_name': 'Operational problem', 'platform': 'tailwind', 'previous_unique_id': None, 'supported_features': 0, - 'translation_key': 'operational_status', + 'translation_key': 'operational_problem', 'unique_id': '_3c_e9_e_6d_21_84_-door2-locked_out', 'unit_of_measurement': None, }) # --- -# name: test_number_entities[binary_sensor.door_2_operational_status].2 +# name: test_number_entities[binary_sensor.door_2_operational_problem].2 DeviceRegistryEntrySnapshot({ 'area_id': None, 'config_entries': , diff --git a/tests/components/tailwind/test_binary_sensor.py b/tests/components/tailwind/test_binary_sensor.py index 8715c143628..a2bb574986c 100644 --- a/tests/components/tailwind/test_binary_sensor.py +++ b/tests/components/tailwind/test_binary_sensor.py @@ -12,8 +12,8 @@ pytestmark = pytest.mark.usefixtures("init_integration") @pytest.mark.parametrize( "entity_id", [ - "binary_sensor.door_1_operational_status", - "binary_sensor.door_2_operational_status", + "binary_sensor.door_1_operational_problem", + "binary_sensor.door_2_operational_problem", ], ) async def test_number_entities(