From f3d3a007889050198acbb4aaf38d28f4e8e88776 Mon Sep 17 00:00:00 2001 From: Bjarne Riis Date: Mon, 23 Sep 2024 07:46:22 +0000 Subject: [PATCH] Fixing register services deprecation warnings --- custom_components/securityspy/camera.py | 3 ++- custom_components/securityspy/const.py | 17 +++-------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/custom_components/securityspy/camera.py b/custom_components/securityspy/camera.py index 845f8fc..f45582c 100644 --- a/custom_components/securityspy/camera.py +++ b/custom_components/securityspy/camera.py @@ -54,7 +54,7 @@ async def async_setup_entry( async_add_entities(cameras) - platform = entity_platform.current_platform.get() + platform = entity_platform.async_get_current_platform() _LOGGER.debug("Creating Service: Set Arm Mode") platform.async_register_entity_service( @@ -194,3 +194,4 @@ def _write_file(to_file, content): with open(to_file, "wb") as _file: _file.write(content) _LOGGER.debug("File written to %s", to_file) + diff --git a/custom_components/securityspy/const.py b/custom_components/securityspy/const.py index 925f4b7..d03f812 100644 --- a/custom_components/securityspy/const.py +++ b/custom_components/securityspy/const.py @@ -61,25 +61,13 @@ SERVICE_DOWNLOAD_LATEST_MOTION_RECORDING = "download_latest_motion_recording" SERVICE_ENABLE_SCHEDULE_PRESET = "enable_schedule_preset" SERVICE_SET_ARM_MODE = "set_arm_mode" -DOWNLOAD_LATEST_MOTION_RECORDING_SCHEMA = vol.Schema( - { - vol.Required(ATTR_ENTITY_ID): cv.entity_ids, - vol.Required(CONF_FILENAME): cv.string, - } -) +DOWNLOAD_LATEST_MOTION_RECORDING_SCHEMA = { vol.Required(ATTR_ENTITY_ID): cv.entity_ids, vol.Required(CONF_FILENAME): cv.string,} ENABLE_SCHEDULE_PRESET_SCHEMA = vol.Schema( { vol.Required(ATTR_PRESET_ID): cv.string, } ) -SET_ARM_MODE_SCHEMA = vol.Schema( - { - vol.Required(ATTR_ENTITY_ID): cv.entity_ids, - vol.Required(CONF_MODE): vol.In(VALID_MODES), - vol.Required(CONF_ENABLED): cv.boolean, - } -) - +SET_ARM_MODE_SCHEMA = { vol.Required(ATTR_ENTITY_ID): cv.entity_ids, vol.Required(CONF_MODE): vol.In(VALID_MODES), vol.Required(CONF_ENABLED): cv.boolean,} SECURITYSPY_PLATFORMS = [ "camera", "binary_sensor", @@ -87,3 +75,4 @@ "switch", "button", ] +