mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Add uncalibrated sensor for tedee (#122594)
* add uncalibrated sensor * change off icon
This commit is contained in:
parent
e6d0bc7d5d
commit
f1b933ae0c
@ -47,6 +47,14 @@ ENTITIES: tuple[TedeeBinarySensorEntityDescription, ...] = (
|
|||||||
is_on_fn=lambda lock: lock.is_enabled_pullspring,
|
is_on_fn=lambda lock: lock.is_enabled_pullspring,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
|
TedeeBinarySensorEntityDescription(
|
||||||
|
key="uncalibrated",
|
||||||
|
translation_key="uncalibrated",
|
||||||
|
is_on_fn=lambda lock: lock.state == TedeeLockState.UNCALIBRATED,
|
||||||
|
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||||
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
{
|
{
|
||||||
"entity": {
|
"entity": {
|
||||||
|
"binary_sensor": {
|
||||||
|
"uncalibrated": {
|
||||||
|
"state": {
|
||||||
|
"on": "mdi:sync-alert",
|
||||||
|
"off": "mdi:sync"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"sensor": {
|
"sensor": {
|
||||||
"pullspring_duration": {
|
"pullspring_duration": {
|
||||||
"default": "mdi:timer-lock-open"
|
"default": "mdi:timer-lock-open"
|
||||||
|
@ -53,6 +53,9 @@
|
|||||||
},
|
},
|
||||||
"semi_locked": {
|
"semi_locked": {
|
||||||
"name": "Semi locked"
|
"name": "Semi locked"
|
||||||
|
},
|
||||||
|
"uncalibrated": {
|
||||||
|
"name": "Lock uncalibrated"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sensor": {
|
"sensor": {
|
||||||
|
@ -32,6 +32,39 @@
|
|||||||
'unit_of_measurement': None,
|
'unit_of_measurement': None,
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_binary_sensors[entry-lock_uncalibrated]
|
||||||
|
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.lock_1a2b_lock_uncalibrated',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Lock uncalibrated',
|
||||||
|
'platform': 'tedee',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'uncalibrated',
|
||||||
|
'unique_id': '12345-uncalibrated',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_binary_sensors[entry-pullspring_enabled]
|
# name: test_binary_sensors[entry-pullspring_enabled]
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
@ -112,6 +145,20 @@
|
|||||||
'state': 'off',
|
'state': 'off',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_binary_sensors[state-lock_uncalibrated]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'problem',
|
||||||
|
'friendly_name': 'Lock-1A2B Lock uncalibrated',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'binary_sensor.lock_1a2b_lock_uncalibrated',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'off',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_binary_sensors[state-pullspring_enabled]
|
# name: test_binary_sensors[state-pullspring_enabled]
|
||||||
StateSnapshot({
|
StateSnapshot({
|
||||||
'attributes': ReadOnlyDict({
|
'attributes': ReadOnlyDict({
|
||||||
|
@ -15,20 +15,17 @@ from tests.common import async_fire_time_changed
|
|||||||
|
|
||||||
pytestmark = pytest.mark.usefixtures("init_integration")
|
pytestmark = pytest.mark.usefixtures("init_integration")
|
||||||
|
|
||||||
BINARY_SENSORS = (
|
BINARY_SENSORS = ("charging", "semi_locked", "pullspring_enabled", "lock_uncalibrated")
|
||||||
"charging",
|
|
||||||
"semi_locked",
|
|
||||||
"pullspring_enabled",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||||
async def test_binary_sensors(
|
async def test_binary_sensors(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
mock_tedee: MagicMock,
|
mock_tedee: MagicMock,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
snapshot: SnapshotAssertion,
|
snapshot: SnapshotAssertion,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test tedee battery charging sensor."""
|
"""Test tedee binary sensor."""
|
||||||
for key in BINARY_SENSORS:
|
for key in BINARY_SENSORS:
|
||||||
state = hass.states.get(f"binary_sensor.lock_1a2b_{key}")
|
state = hass.states.get(f"binary_sensor.lock_1a2b_{key}")
|
||||||
assert state
|
assert state
|
||||||
@ -39,6 +36,7 @@ async def test_binary_sensors(
|
|||||||
assert entry == snapshot(name=f"entry-{key}")
|
assert entry == snapshot(name=f"entry-{key}")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||||
async def test_new_binary_sensors(
|
async def test_new_binary_sensors(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
mock_tedee: MagicMock,
|
mock_tedee: MagicMock,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user