Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions custom_components/marstek_local_api/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ class OptionsFlow(config_entries.OptionsFlow):

def __init__(self, config_entry: ConfigEntry) -> None:
"""Initialise the options flow."""
self.config_entry = config_entry
self._config_entry = config_entry
self._devices: list[dict[str, Any]] = list(config_entry.data.get("devices", []))
self._discovered_devices: list[dict[str, Any]] = []

Expand Down Expand Up @@ -407,7 +407,7 @@ async def async_step_scan_interval(
{
vol.Optional(
"scan_interval",
default=self.config_entry.options.get(
default=self._config_entry.options.get(
"scan_interval", DEFAULT_SCAN_INTERVAL
),
): vol.All(vol.Coerce(int), vol.Range(min=15, max=900)),
Expand Down Expand Up @@ -447,9 +447,9 @@ async def async_step_rename_device(
updated_device["device"] = new_name
updated_devices[device_index] = updated_device

new_data = {**self.config_entry.data, "devices": updated_devices}
new_data = {**self._config_entry.data, "devices": updated_devices}
self.hass.config_entries.async_update_entry(
self.config_entry,
self._config_entry,
data=new_data,
)
self._devices = updated_devices
Expand Down Expand Up @@ -514,9 +514,9 @@ async def async_step_remove_device(
if not updated_devices:
errors["base"] = "cannot_remove_last_device"
else:
new_data = {**self.config_entry.data, "devices": updated_devices}
new_data = {**self._config_entry.data, "devices": updated_devices}
self.hass.config_entries.async_update_entry(
self.config_entry,
self._config_entry,
data=new_data,
)
self._devices = updated_devices
Expand Down Expand Up @@ -589,9 +589,9 @@ async def async_step_add_device(
"firmware": device["firmware"],
}
)
new_data = {**self.config_entry.data, "devices": updated_devices}
new_data = {**self._config_entry.data, "devices": updated_devices}
self.hass.config_entries.async_update_entry(
self.config_entry,
self._config_entry,
data=new_data,
)
self._devices = updated_devices
Expand Down Expand Up @@ -643,9 +643,9 @@ async def async_step_add_device_manual(
"firmware": info.get("firmware"),
}
)
new_data = {**self.config_entry.data, "devices": updated_devices}
new_data = {**self._config_entry.data, "devices": updated_devices}
self.hass.config_entries.async_update_entry(
self.config_entry,
self._config_entry,
data=new_data,
)
self._devices = updated_devices
Expand Down