From 7b840a2f68bf537e0907fa5ea8afd850cd5dd7f6 Mon Sep 17 00:00:00 2001 From: Mike Kasper Date: Sat, 9 Dec 2023 14:36:04 +0000 Subject: [PATCH 1/2] fix update service refactor service yaml --- homeassistant/components/blink/services.py | 7 ++++- homeassistant/components/blink/services.yaml | 32 +++++++++++++++++--- homeassistant/components/blink/strings.json | 28 +++++++++++++++-- 3 files changed, 60 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/blink/services.py b/homeassistant/components/blink/services.py index 12ac0d3b859d..dae2f0ad951c 100644 --- a/homeassistant/components/blink/services.py +++ b/homeassistant/components/blink/services.py @@ -25,6 +25,11 @@ ) from .coordinator import BlinkUpdateCoordinator +SERVICE_UPDATE_SCHEMA = vol.Schema( + { + vol.Required(ATTR_DEVICE_ID): vol.All(cv.ensure_list, [cv.string]), + } +) SERVICE_SAVE_VIDEO_SCHEMA = vol.Schema( { vol.Required(ATTR_DEVICE_ID): vol.All(cv.ensure_list, [cv.string]), @@ -152,7 +157,7 @@ async def blink_refresh(call: ServiceCall): # Register all the above services service_mapping = [ - (blink_refresh, SERVICE_REFRESH, None), + (blink_refresh, SERVICE_REFRESH, SERVICE_UPDATE_SCHEMA), ( async_handle_save_video_service, SERVICE_SAVE_VIDEO, diff --git a/homeassistant/components/blink/services.yaml b/homeassistant/components/blink/services.yaml index 95f4d33f91f7..aaecde64353c 100644 --- a/homeassistant/components/blink/services.yaml +++ b/homeassistant/components/blink/services.yaml @@ -1,14 +1,28 @@ # Describes the format for available Blink services blink_update: + fields: + device_id: + required: true + selector: + device: + integration: blink + trigger_camera: - target: - entity: - integration: blink - domain: camera + fields: + device_id: + required: true + selector: + device: + integration: blink save_video: fields: + device_id: + required: true + selector: + device: + integration: blink name: required: true example: "Living Room" @@ -22,6 +36,11 @@ save_video: save_recent_clips: fields: + device_id: + required: true + selector: + device: + integration: blink name: required: true example: "Living Room" @@ -35,6 +54,11 @@ save_recent_clips: send_pin: fields: + device_id: + required: true + selector: + device: + integration: blink pin: example: "abc123" selector: diff --git a/homeassistant/components/blink/strings.json b/homeassistant/components/blink/strings.json index f47f72acb9cf..fc0450dc8ea2 100644 --- a/homeassistant/components/blink/strings.json +++ b/homeassistant/components/blink/strings.json @@ -57,11 +57,23 @@ "services": { "blink_update": { "name": "Update", - "description": "Forces a refresh." + "description": "Forces a refresh.", + "fields": { + "device_id": { + "name": "Device ID", + "description": "The Blink device id." + } + } }, "trigger_camera": { "name": "Trigger camera", - "description": "Requests camera to take new image." + "description": "Requests camera to take new image.", + "fields": { + "device_id": { + "name": "Device ID", + "description": "The Blink device id." + } + } }, "save_video": { "name": "Save video", @@ -74,6 +86,10 @@ "filename": { "name": "File name", "description": "Filename to writable path (directory may need to be included in allowlist_external_dirs in config)." + }, + "device_id": { + "name": "Device ID", + "description": "The Blink device id." } } }, @@ -88,6 +104,10 @@ "file_path": { "name": "Output directory", "description": "Directory name of writable path (directory may need to be included in allowlist_external_dirs in config)." + }, + "device_id": { + "name": "Device ID", + "description": "The Blink device id." } } }, @@ -98,6 +118,10 @@ "pin": { "name": "Pin", "description": "PIN received from blink. Leave empty if you only received a verification email." + }, + "device_id": { + "name": "Device ID", + "description": "The Blink device id." } } } From 62e58768c00715494290894c6ca93ba1e9df7d3e Mon Sep 17 00:00:00 2001 From: Mike Kasper Date: Sat, 9 Dec 2023 16:17:40 +0000 Subject: [PATCH 2/2] Remove leftover target --- homeassistant/components/blink/services.yaml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/homeassistant/components/blink/services.yaml b/homeassistant/components/blink/services.yaml index 6df284a59067..aaecde64353c 100644 --- a/homeassistant/components/blink/services.yaml +++ b/homeassistant/components/blink/services.yaml @@ -17,10 +17,6 @@ trigger_camera: integration: blink save_video: - target: - entity: - integration: blink - domain: camera fields: device_id: required: true @@ -39,10 +35,6 @@ save_video: text: save_recent_clips: - target: - entity: - integration: blink - domain: camera fields: device_id: required: true @@ -61,10 +53,6 @@ save_recent_clips: text: send_pin: - target: - entity: - integration: blink - domain: camera fields: device_id: required: true