From bbe66f5cea9d2f53502afaa93c424ba868e2cac9 Mon Sep 17 00:00:00 2001 From: Artur Pragacz <49985303+arturpragacz@users.noreply.github.com> Date: Mon, 1 Sep 2025 16:57:24 +0200 Subject: [PATCH] Improve unpair schema in homekit (#150235) --- homeassistant/components/homekit/__init__.py | 5 ++--- homeassistant/components/homekit/services.yaml | 10 +++++++--- homeassistant/components/homekit/strings.json | 8 +++++++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index 50b11265cf46..7c132a00a778 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -224,9 +224,8 @@ RESET_ACCESSORY_SERVICE_SCHEMA = vol.Schema( ) -UNPAIR_SERVICE_SCHEMA = vol.All( - vol.Schema(cv.ENTITY_SERVICE_FIELDS), - cv.has_at_least_one_key(ATTR_DEVICE_ID), +UNPAIR_SERVICE_SCHEMA = vol.Schema( + {vol.Required(ATTR_DEVICE_ID): vol.All(cv.ensure_list, [str])} ) diff --git a/homeassistant/components/homekit/services.yaml b/homeassistant/components/homekit/services.yaml index de271db0ad9c..8e9d659af942 100644 --- a/homeassistant/components/homekit/services.yaml +++ b/homeassistant/components/homekit/services.yaml @@ -6,6 +6,10 @@ reset_accessory: entity: {} unpair: - target: - device: - integration: homekit + fields: + device_id: + required: true + selector: + device: + multiple: true + integration: homekit diff --git a/homeassistant/components/homekit/strings.json b/homeassistant/components/homekit/strings.json index e6507c4a912c..ce01773af204 100644 --- a/homeassistant/components/homekit/strings.json +++ b/homeassistant/components/homekit/strings.json @@ -80,7 +80,13 @@ }, "unpair": { "name": "Unpair an accessory or bridge", - "description": "Forcefully removes all pairings from an accessory to allow re-pairing. Use this action if the accessory is no longer responsive, and you want to avoid deleting and re-adding the entry. Room locations, and accessory preferences will be lost." + "description": "Forcefully removes all pairings from an accessory to allow re-pairing. Use this action if the accessory is no longer responsive and you want to avoid deleting and re-adding the entry. Room locations and accessory preferences will be lost.", + "fields": { + "device_id": { + "name": "Device", + "description": "Device to unpair." + } + } } } }