diff --git a/homeassistant/components/tailscale/binary_sensor.py b/homeassistant/components/tailscale/binary_sensor.py index 35c73cd0223..7803a7eb472 100644 --- a/homeassistant/components/tailscale/binary_sensor.py +++ b/homeassistant/components/tailscale/binary_sensor.py @@ -36,6 +36,12 @@ BINARY_SENSORS: tuple[TailscaleBinarySensorEntityDescription, ...] = ( entity_category=EntityCategory.DIAGNOSTIC, is_on_fn=lambda device: device.update_available, ), + TailscaleBinarySensorEntityDescription( + key="key_expiry_disabled", + translation_key="key_expiry_disabled", + entity_category=EntityCategory.DIAGNOSTIC, + is_on_fn=lambda device: device.key_expiry_disabled, + ), TailscaleBinarySensorEntityDescription( key="client_supports_hair_pinning", translation_key="client_supports_hair_pinning", diff --git a/homeassistant/components/tailscale/strings.json b/homeassistant/components/tailscale/strings.json index b110e53ee64..8d7fcc0c87b 100644 --- a/homeassistant/components/tailscale/strings.json +++ b/homeassistant/components/tailscale/strings.json @@ -29,6 +29,9 @@ "client": { "name": "Client" }, + "key_expiry_disabled": { + "name": "Key expiry disabled" + }, "client_supports_hair_pinning": { "name": "Supports hairpinning" }, diff --git a/tests/components/tailscale/test_binary_sensor.py b/tests/components/tailscale/test_binary_sensor.py index 1d1cda84723..b59d3872655 100644 --- a/tests/components/tailscale/test_binary_sensor.py +++ b/tests/components/tailscale/test_binary_sensor.py @@ -31,6 +31,20 @@ async def test_tailscale_binary_sensors( assert state.attributes.get(ATTR_FRIENDLY_NAME) == "frencks-iphone Client" assert state.attributes.get(ATTR_DEVICE_CLASS) == BinarySensorDeviceClass.UPDATE + state = hass.states.get("binary_sensor.frencks_iphone_key_expiry_disabled") + entry = entity_registry.async_get( + "binary_sensor.frencks_iphone_key_expiry_disabled" + ) + assert entry + assert state + assert entry.unique_id == "123456_key_expiry_disabled" + assert entry.entity_category == EntityCategory.DIAGNOSTIC + assert state.state == STATE_OFF + assert ( + state.attributes.get(ATTR_FRIENDLY_NAME) == "frencks-iphone Key expiry disabled" + ) + assert ATTR_DEVICE_CLASS not in state.attributes + state = hass.states.get("binary_sensor.frencks_iphone_supports_hairpinning") entry = entity_registry.async_get( "binary_sensor.frencks_iphone_supports_hairpinning"