From a5971ef2ad3ee0c18fbcc850a6fe97cf570c99ff Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 10 Nov 2026 11:57:47 +0100 Subject: [PATCH] Add an action enum to verisure (#191824) --- homeassistant/components/verisure/const.py | 4 ---- homeassistant/components/verisure/services.py | 23 +++++++++++-------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/homeassistant/components/verisure/const.py b/homeassistant/components/verisure/const.py index 2f960a61caf5..6461877f58fa 100644 --- a/homeassistant/components/verisure/const.py +++ b/homeassistant/components/verisure/const.py @@ -27,10 +27,6 @@ RATE_LIMIT_BACKOFF = ( timedelta(hours=1), ) -SERVICE_CAPTURE_SMARTCAM = "capture_smartcam" -SERVICE_DISABLE_AUTOLOCK = "disable_autolock" -SERVICE_ENABLE_AUTOLOCK = "enable_autolock" - # Mapping of device types to a human readable name DEVICE_TYPE_NAME = { "CAMERAPIR2": "Camera detector", diff --git a/homeassistant/components/verisure/services.py b/homeassistant/components/verisure/services.py index 2ca8619fca2e..8ed6f7d1dcee 100644 --- a/homeassistant/components/verisure/services.py +++ b/homeassistant/components/verisure/services.py @@ -1,16 +1,21 @@ """Services for the Verisure integration.""" +from enum import StrEnum + from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import service -from .const import ( - DOMAIN, - SERVICE_CAPTURE_SMARTCAM, - SERVICE_DISABLE_AUTOLOCK, - SERVICE_ENABLE_AUTOLOCK, -) +from .const import DOMAIN + + +class VerisureService(StrEnum): + """Store keys for Verisure services.""" + + CAPTURE_SMARTCAM = "capture_smartcam" + ENABLE_AUTOLOCK = "enable_autolock" + DISABLE_AUTOLOCK = "disable_autolock" @callback @@ -20,7 +25,7 @@ def async_setup_services(hass: HomeAssistant) -> None: service.async_register_platform_entity_service( hass, DOMAIN, - SERVICE_CAPTURE_SMARTCAM, + VerisureService.CAPTURE_SMARTCAM, entity_domain=CAMERA_DOMAIN, schema=None, func="capture_smartcam", @@ -29,7 +34,7 @@ def async_setup_services(hass: HomeAssistant) -> None: service.async_register_platform_entity_service( hass, DOMAIN, - SERVICE_DISABLE_AUTOLOCK, + VerisureService.DISABLE_AUTOLOCK, entity_domain=LOCK_DOMAIN, schema=None, func="disable_autolock", @@ -38,7 +43,7 @@ def async_setup_services(hass: HomeAssistant) -> None: service.async_register_platform_entity_service( hass, DOMAIN, - SERVICE_ENABLE_AUTOLOCK, + VerisureService.ENABLE_AUTOLOCK, entity_domain=LOCK_DOMAIN, schema=None, func="enable_autolock",