From 61db53f0b6761fcbafac19a1c345c9ea6e87720f Mon Sep 17 00:00:00 2001 From: Snuffy2 Date: Wed, 15 Jan 2025 19:50:12 -0500 Subject: [PATCH] Fix Configure of existing Places Sensor (#317) --- .pre-commit-config.yaml | 9 +++++++++ custom_components/places/config_flow.py | 10 +++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 717d635..e9fa21d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,6 +19,7 @@ repos: rev: v2.2.4 hooks: - id: codespell + args: [--skip,"*.json"] additional_dependencies: - tomli - repo: https://github.com/astral-sh/ruff-pre-commit @@ -29,3 +30,11 @@ repos: args: [--fix] # Run the formatter. - id: ruff-format +ci: + autofix_commit_msg: | + [pre-commit.ci] auto fixes from pre-commit hooks + autofix_prs: true + autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' + autoupdate_schedule: weekly + skip: [] + submodules: false diff --git a/custom_components/places/config_flow.py b/custom_components/places/config_flow.py index f5698e1..0af1ef8 100644 --- a/custom_components/places/config_flow.py +++ b/custom_components/places/config_flow.py @@ -269,16 +269,12 @@ def async_get_options_flow( config_entry: ConfigEntry, ) -> PlacesOptionsFlowHandler: """Options callback for Places.""" - return PlacesOptionsFlowHandler(config_entry) + return PlacesOptionsFlowHandler() class PlacesOptionsFlowHandler(OptionsFlow): """Config flow options for Places. Does not actually store these into Options but updates the Config instead.""" - def __init__(self, entry: ConfigEntry) -> None: - """Initialize Places options flow.""" - self.config_entry = entry - async def async_step_init( self, user_input: MutableMapping[str, Any] | None = None ) -> ConfigFlowResult: @@ -295,10 +291,10 @@ async def async_step_init( user_input.pop(m) # _LOGGER.debug(f"[Options Update] updated config: {user_input}") - self.hass.async_update_entry( + self.hass.config_entries.async_update_entry( self.config_entry, data=user_input, options=self.config_entry.options ) - await self.hass.async_reload(self.config_entry.entry_id) + await self.hass.config_entries.async_reload(self.config_entry.entry_id) return self.async_create_entry(title="", data={}) # Include the current entity in the list as well. Although it may still fail in validation checking.