diff --git a/homeassistant/components/tedee/binary_sensor.py b/homeassistant/components/tedee/binary_sensor.py index 98c70f32450..3a7d1a12f2e 100644 --- a/homeassistant/components/tedee/binary_sensor.py +++ b/homeassistant/components/tedee/binary_sensor.py @@ -47,6 +47,14 @@ ENTITIES: tuple[TedeeBinarySensorEntityDescription, ...] = ( is_on_fn=lambda lock: lock.is_enabled_pullspring, 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, + ), ) diff --git a/homeassistant/components/tedee/icons.json b/homeassistant/components/tedee/icons.json index 3f98462b22f..4fae6e0fcd2 100644 --- a/homeassistant/components/tedee/icons.json +++ b/homeassistant/components/tedee/icons.json @@ -1,5 +1,13 @@ { "entity": { + "binary_sensor": { + "uncalibrated": { + "state": { + "on": "mdi:sync-alert", + "off": "mdi:sync" + } + } + }, "sensor": { "pullspring_duration": { "default": "mdi:timer-lock-open" diff --git a/homeassistant/components/tedee/strings.json b/homeassistant/components/tedee/strings.json index e16cdbdd330..0668d1370b4 100644 --- a/homeassistant/components/tedee/strings.json +++ b/homeassistant/components/tedee/strings.json @@ -53,6 +53,9 @@ }, "semi_locked": { "name": "Semi locked" + }, + "uncalibrated": { + "name": "Lock uncalibrated" } }, "sensor": { diff --git a/tests/components/tedee/snapshots/test_binary_sensor.ambr b/tests/components/tedee/snapshots/test_binary_sensor.ambr index 8c9dca1bd12..385e4ac9bc1 100644 --- a/tests/components/tedee/snapshots/test_binary_sensor.ambr +++ b/tests/components/tedee/snapshots/test_binary_sensor.ambr @@ -32,6 +32,39 @@ 'unit_of_measurement': None, }) # --- +# name: test_binary_sensors[entry-lock_uncalibrated] + 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.lock_1a2b_lock_uncalibrated', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + '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] EntityRegistryEntrySnapshot({ 'aliases': set({ @@ -112,6 +145,20 @@ 'state': 'off', }) # --- +# name: test_binary_sensors[state-lock_uncalibrated] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'problem', + 'friendly_name': 'Lock-1A2B Lock uncalibrated', + }), + 'context': , + 'entity_id': 'binary_sensor.lock_1a2b_lock_uncalibrated', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- # name: test_binary_sensors[state-pullspring_enabled] StateSnapshot({ 'attributes': ReadOnlyDict({ diff --git a/tests/components/tedee/test_binary_sensor.py b/tests/components/tedee/test_binary_sensor.py index ee8c318d2dd..788d31c84d2 100644 --- a/tests/components/tedee/test_binary_sensor.py +++ b/tests/components/tedee/test_binary_sensor.py @@ -15,20 +15,17 @@ from tests.common import async_fire_time_changed pytestmark = pytest.mark.usefixtures("init_integration") -BINARY_SENSORS = ( - "charging", - "semi_locked", - "pullspring_enabled", -) +BINARY_SENSORS = ("charging", "semi_locked", "pullspring_enabled", "lock_uncalibrated") +@pytest.mark.usefixtures("entity_registry_enabled_by_default") async def test_binary_sensors( hass: HomeAssistant, mock_tedee: MagicMock, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion, ) -> None: - """Test tedee battery charging sensor.""" + """Test tedee binary sensor.""" for key in BINARY_SENSORS: state = hass.states.get(f"binary_sensor.lock_1a2b_{key}") assert state @@ -39,6 +36,7 @@ async def test_binary_sensors( assert entry == snapshot(name=f"entry-{key}") +@pytest.mark.usefixtures("entity_registry_enabled_by_default") async def test_new_binary_sensors( hass: HomeAssistant, mock_tedee: MagicMock,