mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Flip around Tailwind locked out binary sensor (#106457)
This commit is contained in:
parent
d33ad57dd3
commit
d6d8e914bc
@ -7,6 +7,7 @@ from dataclasses import dataclass
|
|||||||
from gotailwind import TailwindDoor
|
from gotailwind import TailwindDoor
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
BinarySensorEntityDescription,
|
BinarySensorEntityDescription,
|
||||||
)
|
)
|
||||||
@ -30,10 +31,11 @@ class TailwindDoorBinarySensorEntityDescription(BinarySensorEntityDescription):
|
|||||||
DESCRIPTIONS: tuple[TailwindDoorBinarySensorEntityDescription, ...] = (
|
DESCRIPTIONS: tuple[TailwindDoorBinarySensorEntityDescription, ...] = (
|
||||||
TailwindDoorBinarySensorEntityDescription(
|
TailwindDoorBinarySensorEntityDescription(
|
||||||
key="locked_out",
|
key="locked_out",
|
||||||
translation_key="operational_status",
|
translation_key="operational_problem",
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
|
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||||
icon="mdi:garage-alert",
|
icon="mdi:garage-alert",
|
||||||
is_on_fn=lambda door: not door.locked_out,
|
is_on_fn=lambda door: door.locked_out,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -47,11 +47,11 @@
|
|||||||
},
|
},
|
||||||
"entity": {
|
"entity": {
|
||||||
"binary_sensor": {
|
"binary_sensor": {
|
||||||
"operational_status": {
|
"operational_problem": {
|
||||||
"name": "Operational status",
|
"name": "Operational problem",
|
||||||
"state": {
|
"state": {
|
||||||
"off": "Locked out",
|
"off": "Operational",
|
||||||
"on": "Operational"
|
"on": "Locked out"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
# serializer version: 1
|
# serializer version: 1
|
||||||
# name: test_number_entities
|
# name: test_number_entities[binary_sensor.door_1_operational_problem]
|
||||||
StateSnapshot({
|
StateSnapshot({
|
||||||
'attributes': ReadOnlyDict({
|
'attributes': ReadOnlyDict({
|
||||||
'friendly_name': 'Door 1 Operational status',
|
'device_class': 'problem',
|
||||||
|
'friendly_name': 'Door 1 Operational problem',
|
||||||
'icon': 'mdi:garage-alert',
|
'icon': 'mdi:garage-alert',
|
||||||
}),
|
}),
|
||||||
'context': <ANY>,
|
'context': <ANY>,
|
||||||
'entity_id': 'binary_sensor.door_1_operational_status',
|
'entity_id': 'binary_sensor.door_1_operational_problem',
|
||||||
'last_changed': <ANY>,
|
'last_changed': <ANY>,
|
||||||
'last_updated': <ANY>,
|
'last_updated': <ANY>,
|
||||||
'state': 'on',
|
'state': 'off',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
# name: test_number_entities.1
|
# name: test_number_entities[binary_sensor.door_1_operational_problem].1
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
}),
|
}),
|
||||||
@ -24,7 +25,7 @@
|
|||||||
'disabled_by': None,
|
'disabled_by': None,
|
||||||
'domain': 'binary_sensor',
|
'domain': 'binary_sensor',
|
||||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
'entity_id': 'binary_sensor.door_1_operational_status',
|
'entity_id': 'binary_sensor.door_1_operational_problem',
|
||||||
'has_entity_name': True,
|
'has_entity_name': True,
|
||||||
'hidden_by': None,
|
'hidden_by': None,
|
||||||
'icon': None,
|
'icon': None,
|
||||||
@ -32,162 +33,18 @@
|
|||||||
'name': None,
|
'name': None,
|
||||||
'options': dict({
|
'options': dict({
|
||||||
}),
|
}),
|
||||||
'original_device_class': None,
|
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
|
||||||
'original_icon': 'mdi:garage-alert',
|
'original_icon': 'mdi:garage-alert',
|
||||||
'original_name': 'Operational status',
|
'original_name': 'Operational problem',
|
||||||
'platform': 'tailwind',
|
'platform': 'tailwind',
|
||||||
'previous_unique_id': None,
|
'previous_unique_id': None,
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': 'operational_status',
|
'translation_key': 'operational_problem',
|
||||||
'unique_id': '_3c_e9_e_6d_21_84_-door1-locked_out',
|
'unique_id': '_3c_e9_e_6d_21_84_-door1-locked_out',
|
||||||
'unit_of_measurement': None,
|
'unit_of_measurement': None,
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
# name: test_number_entities.2
|
# name: test_number_entities[binary_sensor.door_1_operational_problem].2
|
||||||
DeviceRegistryEntrySnapshot({
|
|
||||||
'area_id': None,
|
|
||||||
'config_entries': <ANY>,
|
|
||||||
'configuration_url': None,
|
|
||||||
'connections': set({
|
|
||||||
}),
|
|
||||||
'disabled_by': None,
|
|
||||||
'entry_type': None,
|
|
||||||
'hw_version': None,
|
|
||||||
'id': <ANY>,
|
|
||||||
'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': <ANY>,
|
|
||||||
'entity_id': 'binary_sensor.door_2_operational_status',
|
|
||||||
'last_changed': <ANY>,
|
|
||||||
'last_updated': <ANY>,
|
|
||||||
'state': 'on',
|
|
||||||
})
|
|
||||||
# ---
|
|
||||||
# name: test_number_entities.4
|
|
||||||
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': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
|
||||||
'entity_id': 'binary_sensor.door_2_operational_status',
|
|
||||||
'has_entity_name': True,
|
|
||||||
'hidden_by': None,
|
|
||||||
'icon': None,
|
|
||||||
'id': <ANY>,
|
|
||||||
'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': <ANY>,
|
|
||||||
'configuration_url': None,
|
|
||||||
'connections': set({
|
|
||||||
}),
|
|
||||||
'disabled_by': None,
|
|
||||||
'entry_type': None,
|
|
||||||
'hw_version': None,
|
|
||||||
'id': <ANY>,
|
|
||||||
'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': <ANY>,
|
|
||||||
'entity_id': 'binary_sensor.door_1_operational_status',
|
|
||||||
'last_changed': <ANY>,
|
|
||||||
'last_updated': <ANY>,
|
|
||||||
'state': 'on',
|
|
||||||
})
|
|
||||||
# ---
|
|
||||||
# name: test_number_entities[binary_sensor.door_1_operational_status].1
|
|
||||||
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': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
|
||||||
'entity_id': 'binary_sensor.door_1_operational_status',
|
|
||||||
'has_entity_name': True,
|
|
||||||
'hidden_by': None,
|
|
||||||
'icon': None,
|
|
||||||
'id': <ANY>,
|
|
||||||
'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
|
|
||||||
DeviceRegistryEntrySnapshot({
|
DeviceRegistryEntrySnapshot({
|
||||||
'area_id': None,
|
'area_id': None,
|
||||||
'config_entries': <ANY>,
|
'config_entries': <ANY>,
|
||||||
@ -215,20 +72,21 @@
|
|||||||
'via_device_id': <ANY>,
|
'via_device_id': <ANY>,
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
# name: test_number_entities[binary_sensor.door_2_operational_status]
|
# name: test_number_entities[binary_sensor.door_2_operational_problem]
|
||||||
StateSnapshot({
|
StateSnapshot({
|
||||||
'attributes': ReadOnlyDict({
|
'attributes': ReadOnlyDict({
|
||||||
'friendly_name': 'Door 2 Operational status',
|
'device_class': 'problem',
|
||||||
|
'friendly_name': 'Door 2 Operational problem',
|
||||||
'icon': 'mdi:garage-alert',
|
'icon': 'mdi:garage-alert',
|
||||||
}),
|
}),
|
||||||
'context': <ANY>,
|
'context': <ANY>,
|
||||||
'entity_id': 'binary_sensor.door_2_operational_status',
|
'entity_id': 'binary_sensor.door_2_operational_problem',
|
||||||
'last_changed': <ANY>,
|
'last_changed': <ANY>,
|
||||||
'last_updated': <ANY>,
|
'last_updated': <ANY>,
|
||||||
'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({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
}),
|
}),
|
||||||
@ -240,7 +98,7 @@
|
|||||||
'disabled_by': None,
|
'disabled_by': None,
|
||||||
'domain': 'binary_sensor',
|
'domain': 'binary_sensor',
|
||||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
'entity_id': 'binary_sensor.door_2_operational_status',
|
'entity_id': 'binary_sensor.door_2_operational_problem',
|
||||||
'has_entity_name': True,
|
'has_entity_name': True,
|
||||||
'hidden_by': None,
|
'hidden_by': None,
|
||||||
'icon': None,
|
'icon': None,
|
||||||
@ -248,18 +106,18 @@
|
|||||||
'name': None,
|
'name': None,
|
||||||
'options': dict({
|
'options': dict({
|
||||||
}),
|
}),
|
||||||
'original_device_class': None,
|
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
|
||||||
'original_icon': 'mdi:garage-alert',
|
'original_icon': 'mdi:garage-alert',
|
||||||
'original_name': 'Operational status',
|
'original_name': 'Operational problem',
|
||||||
'platform': 'tailwind',
|
'platform': 'tailwind',
|
||||||
'previous_unique_id': None,
|
'previous_unique_id': None,
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': 'operational_status',
|
'translation_key': 'operational_problem',
|
||||||
'unique_id': '_3c_e9_e_6d_21_84_-door2-locked_out',
|
'unique_id': '_3c_e9_e_6d_21_84_-door2-locked_out',
|
||||||
'unit_of_measurement': None,
|
'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({
|
DeviceRegistryEntrySnapshot({
|
||||||
'area_id': None,
|
'area_id': None,
|
||||||
'config_entries': <ANY>,
|
'config_entries': <ANY>,
|
||||||
|
@ -12,8 +12,8 @@ pytestmark = pytest.mark.usefixtures("init_integration")
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"entity_id",
|
"entity_id",
|
||||||
[
|
[
|
||||||
"binary_sensor.door_1_operational_status",
|
"binary_sensor.door_1_operational_problem",
|
||||||
"binary_sensor.door_2_operational_status",
|
"binary_sensor.door_2_operational_problem",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_number_entities(
|
async def test_number_entities(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user