Fix service missing key in Blink (#105387)

* fix update service
refactor service yaml

* Remove leftover target
This commit is contained in:
mkmer 2023-12-09 13:18:59 -05:00 committed by GitHub
parent 35b733fa2c
commit c96a588934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 19 deletions

View File

@ -25,6 +25,11 @@ from .const import (
) )
from .coordinator import BlinkUpdateCoordinator 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( SERVICE_SAVE_VIDEO_SCHEMA = vol.Schema(
{ {
vol.Required(ATTR_DEVICE_ID): vol.All(cv.ensure_list, [cv.string]), vol.Required(ATTR_DEVICE_ID): vol.All(cv.ensure_list, [cv.string]),
@ -152,7 +157,7 @@ def setup_services(hass: HomeAssistant) -> None:
# Register all the above services # Register all the above services
service_mapping = [ service_mapping = [
(blink_refresh, SERVICE_REFRESH, None), (blink_refresh, SERVICE_REFRESH, SERVICE_UPDATE_SCHEMA),
( (
async_handle_save_video_service, async_handle_save_video_service,
SERVICE_SAVE_VIDEO, SERVICE_SAVE_VIDEO,

View File

@ -1,18 +1,28 @@
# Describes the format for available Blink services # Describes the format for available Blink services
blink_update: blink_update:
fields:
device_id:
required: true
selector:
device:
integration: blink
trigger_camera: trigger_camera:
target: fields:
entity: device_id:
integration: blink required: true
domain: camera selector:
device:
integration: blink
save_video: save_video:
target:
entity:
integration: blink
domain: camera
fields: fields:
device_id:
required: true
selector:
device:
integration: blink
name: name:
required: true required: true
example: "Living Room" example: "Living Room"
@ -25,11 +35,12 @@ save_video:
text: text:
save_recent_clips: save_recent_clips:
target:
entity:
integration: blink
domain: camera
fields: fields:
device_id:
required: true
selector:
device:
integration: blink
name: name:
required: true required: true
example: "Living Room" example: "Living Room"
@ -42,11 +53,12 @@ save_recent_clips:
text: text:
send_pin: send_pin:
target:
entity:
integration: blink
domain: camera
fields: fields:
device_id:
required: true
selector:
device:
integration: blink
pin: pin:
example: "abc123" example: "abc123"
selector: selector:

View File

@ -57,11 +57,23 @@
"services": { "services": {
"blink_update": { "blink_update": {
"name": "Update", "name": "Update",
"description": "Forces a refresh." "description": "Forces a refresh.",
"fields": {
"device_id": {
"name": "Device ID",
"description": "The Blink device id."
}
}
}, },
"trigger_camera": { "trigger_camera": {
"name": "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": { "save_video": {
"name": "Save video", "name": "Save video",
@ -74,6 +86,10 @@
"filename": { "filename": {
"name": "File name", "name": "File name",
"description": "Filename to writable path (directory may need to be included in allowlist_external_dirs in config)." "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": { "file_path": {
"name": "Output directory", "name": "Output directory",
"description": "Directory name of writable path (directory may need to be included in allowlist_external_dirs in config)." "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": { "pin": {
"name": "Pin", "name": "Pin",
"description": "PIN received from blink. Leave empty if you only received a verification email." "description": "PIN received from blink. Leave empty if you only received a verification email."
},
"device_id": {
"name": "Device ID",
"description": "The Blink device id."
} }
} }
} }