diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 605c280..5e36cdb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,11 +8,7 @@ on: - "**/CHANGELOG.md" - "**/CONTRIBUTING.md" - "**/requirements.txt" - branches: - - "main" pull_request: - branches: - - "main" jobs: ruff: @@ -25,7 +21,7 @@ jobs: - name: "Set up Python" uses: actions/setup-python@v5.1.0 with: - python-version: "3.11" + python-version: "3.14" cache: "pip" - name: "Install requirements" diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 9a08f0d..d093b44 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -11,11 +11,7 @@ on: - "**/CHANGELOG.md" - "**/CONTRIBUTING.md" - "**/requirements.txt" - branches: - - "main" pull_request: - branches: - - "main" jobs: hassfest: # https://developers.home-assistant.io/blog/2020/04/16/hassfest diff --git a/.ruff.toml b/.ruff.toml index 7a8331a..1816988 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -1,7 +1,8 @@ # The contents of this file is based on https://github.com/home-assistant/core/blob/dev/pyproject.toml -target-version = "py310" +target-version = "py313" +[lint] select = [ "B007", # Loop control variable {name} not used within loop body "B014", # Exception handler with duplicate exception @@ -38,11 +39,11 @@ ignore = [ "E731", # do not assign a lambda expression, use a def ] -[flake8-pytest-style] +[lint.flake8-pytest-style] fixture-parentheses = false -[pyupgrade] +[lint.pyupgrade] keep-runtime-typing = true -[mccabe] -max-complexity = 25 \ No newline at end of file +[lint.mccabe] +max-complexity = 25 diff --git a/custom_components/securityspy/__init__.py b/custom_components/securityspy/__init__.py index 7ef07e2..88120b1 100644 --- a/custom_components/securityspy/__init__.py +++ b/custom_components/securityspy/__init__.py @@ -14,7 +14,11 @@ CONF_PASSWORD, ) from homeassistant.core import HomeAssistant, ServiceCall, callback -from homeassistant.exceptions import ConfigEntryNotReady, ServiceValidationError +from homeassistant.exceptions import ( + ConfigEntryAuthFailed, + ConfigEntryNotReady, + ServiceValidationError, +) from homeassistant.helpers.aiohttp_client import async_create_clientsession from homeassistant.helpers.typing import ConfigType import homeassistant.helpers.device_registry as dr @@ -92,8 +96,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: try: server_info = await securityspyserver.get_server_information() except InvalidCredentials as unauthex: - _LOGGER.error("Could not authorize against SecuritySpy. Error: %s.", unauthex) - return False + raise ConfigEntryAuthFailed from unauthex except (RequestError, ServerDisconnectedError) as notreadyerror: raise ConfigEntryNotReady from notreadyerror @@ -111,8 +114,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: if not secspy_data.last_update_success: raise ConfigEntryNotReady - entry.async_on_unload(entry.add_update_listener(_async_options_updated)) - entry.runtime_data = SecuritySpyRuntimeData( secspy_data=secspy_data, nvr=securityspyserver, @@ -173,11 +174,6 @@ async def async_handle_enable_schedule_preset(hass: HomeAssistant, call: Service await runtime_entries[0].nvr.enable_schedule_preset(preset_id) -async def _async_options_updated(hass: HomeAssistant, entry: ConfigEntry): - """Update options.""" - await hass.config_entries.async_reload(entry.entry_id) - - async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload SecuritySpy config entry.""" unload_ok = await hass.config_entries.async_unload_platforms( diff --git a/custom_components/securityspy/config_flow.py b/custom_components/securityspy/config_flow.py index 1c8c2ef..7b82b99 100644 --- a/custom_components/securityspy/config_flow.py +++ b/custom_components/securityspy/config_flow.py @@ -40,7 +40,7 @@ class SecuritySpyFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): @callback def async_get_options_flow(config_entry): """Get the options flow for this handler.""" - return OptionsFlowHandler(config_entry) + return OptionsFlowHandler() async def async_step_user(self, user_input=None): """Handle a flow initiated by the user.""" @@ -118,13 +118,9 @@ async def _show_setup_form(self, errors=None): ) -class OptionsFlowHandler(config_entries.OptionsFlow): +class OptionsFlowHandler(config_entries.OptionsFlowWithReload): """Handle options.""" - def __init__(self, config_entry): - """Initialize options flow.""" - self.config_entry = config_entry - async def async_step_init(self, user_input=None): """Manage the options.""" if user_input is not None: diff --git a/custom_components/securityspy/manifest.json b/custom_components/securityspy/manifest.json index 56f5799..e3d9db3 100644 --- a/custom_components/securityspy/manifest.json +++ b/custom_components/securityspy/manifest.json @@ -2,15 +2,17 @@ "domain": "securityspy", "name": "SecuritySpy for Home Assistant", "codeowners": [ - "@briis" + "@briis", + "@dr-apple" ], "config_flow": true, "dependencies": [], - "documentation": "https://github.com/briis/securityspy", + "documentation": "https://github.com/dr-apple/securityspy", + "integration_type": "hub", "iot_class": "local_push", - "issue_tracker": "https://github.com/briis/securityspy/issues", + "issue_tracker": "https://github.com/dr-apple/securityspy/issues", "requirements": [ "pysecspy==1.3.5" ], - "version": "1.2.0" + "version": "1.2.1" } diff --git a/hacs.json b/hacs.json index fa24c1b..dce7f2e 100644 --- a/hacs.json +++ b/hacs.json @@ -1,4 +1,4 @@ { "name": "SecuritySpy for Home Assistant", - "homeassistant": "2025.12.0" + "homeassistant": "2026.8.0" } diff --git a/requirements.txt b/requirements.txt index 19be0ea..3acd37d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ colorlog==6.8.2 -homeassistant>=2025.12.0 -pip>=23.2.1,<24.3 -ruff==0.11.13 +homeassistant==2026.8.1 +ruff==0.16.2