Skip to content

Commit 8a21662

Browse files
0xAHAclaude
andcommitted
Bump version to v1.1.10 — guard the options-flow reload (#361)
Reported by Richardmarkink: changing a setting saved the change, then failed the form with a bare "Unknown error", leaving the user to retry a save that had already applied. The options flow reloads the integration after saving. That reload was unguarded, and async_reload() raises OperationNotAllowed when the entry is in a non-recoverable state such as FAILED_UNLOAD — which is what happens when a poll is wedged on an unresponsive gateway and holds the connection past the unload timeout. The exception propagated straight to the UI. The reload is a convenience, not part of saving: async_update_entry() has already persisted the settings before it runs. It is now wrapped, and a failure logs a warning stating the settings are saved and will apply after a manual reload or restart. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 25e5844 commit 8a21662

4 files changed

Lines changed: 42 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Growatt Modbus Integration for Home Assistant ☀️
44

55
![HACS Badge](https://img.shields.io/badge/HACS-Custom-orange.svg)
6-
![Version](https://img.shields.io/badge/Version-1.1.9-blue.svg)
6+
![Version](https://img.shields.io/badge/Version-1.1.10-blue.svg)
77
[![GitHub Issues](https://img.shields.io/github/issues/0xAHA/Growatt_ModbusTCP.svg)](https://github.com/0xAHA/Growatt_ModbusTCP/issues)
88
[![GitHub Stars](https://img.shields.io/github/stars/0xAHA/Growatt_ModbusTCP.svg?style=social)](https://github.com/0xAHA/Growatt_ModbusTCP)
99

RELEASENOTES.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@
44

55
---
66

7+
## v1.1.10
8+
9+
Issues: #361
10+
11+
- **Fix: "Unknown error" when saving options, on an entry that failed to reload:**
12+
Reported by @Richardmarkink. Changing a setting saved the change, then failed the form
13+
with a bare `Unknown error` — leaving the user to retry a save that had already applied.
14+
15+
The options flow reloads the integration after saving. That reload was unguarded, and
16+
`async_reload()` raises `OperationNotAllowed` when the entry is in a non-recoverable state
17+
such as `FAILED_UNLOAD` — which happens when a poll is wedged on an unresponsive gateway
18+
and holds the connection past the unload timeout. The exception propagated to the UI.
19+
20+
The reload is a convenience, not part of saving: settings are already persisted before it
21+
runs. It is now wrapped, and a failure logs a warning explaining that the settings are
22+
saved and will apply after a manual reload or restart.
23+
24+
---
25+
726
## v1.1.9
827

928
Issues: #361

custom_components/growatt_modbus/config_flow.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -878,9 +878,27 @@ async def async_step_init(
878878
options=new_options,
879879
)
880880

881-
# Reload the integration to apply changes
882-
await self.hass.config_entries.async_reload(self.config_entry.entry_id)
883-
881+
# Reload the integration to apply changes.
882+
#
883+
# The settings are already persisted by async_update_entry() above, so this
884+
# reload is a convenience — not part of saving. It must not be allowed to fail
885+
# the form: async_reload() raises OperationNotAllowed when the entry is in a
886+
# non-recoverable state such as FAILED_UNLOAD (e.g. a poll wedged on an
887+
# unresponsive gateway held the connection open past the unload timeout).
888+
# Unguarded, that propagated to the UI as a bare "Unknown error" while the
889+
# change had in fact been saved — leaving the user to retry a save that had
890+
# already applied, on an entry that was now stuck (Issue #361).
891+
try:
892+
await self.hass.config_entries.async_reload(self.config_entry.entry_id)
893+
except Exception as err:
894+
_LOGGER.warning(
895+
"Settings saved, but reloading the integration failed (%s). "
896+
"The new settings will take effect after a manual reload or an HA "
897+
"restart. If this persists the inverter is likely unreachable — check "
898+
"the connection before retrying.",
899+
err,
900+
)
901+
884902
return self.async_create_entry(title="", data=new_options)
885903

886904
# Build options schema with current values

custom_components/growatt_modbus/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
"pymodbus>=3.0.0",
1313
"pyserial>=3.4"
1414
],
15-
"version": "1.1.9"
15+
"version": "1.1.10"
1616
}

0 commit comments

Comments
 (0)