Add key expiry disabled binary sensor to Tailscale (#117667)
This commit is contained in:
parent
22cc7d34d5
commit
efcfbbf189
3 changed files with 23 additions and 0 deletions
|
@ -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",
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
"client": {
|
||||
"name": "Client"
|
||||
},
|
||||
"key_expiry_disabled": {
|
||||
"name": "Key expiry disabled"
|
||||
},
|
||||
"client_supports_hair_pinning": {
|
||||
"name": "Supports hairpinning"
|
||||
},
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue