Skip to content

Commit

Permalink
Fixing register services deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
briis committed Sep 23, 2024
1 parent f03d4fa commit f3d3a00
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
3 changes: 2 additions & 1 deletion custom_components/securityspy/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)

17 changes: 3 additions & 14 deletions custom_components/securityspy/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,29 +61,18 @@
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",
"sensor",
"switch",
"button",
]

0 comments on commit f3d3a00

Please sign in to comment.