Skip to content

Commit

Permalink
Fix reconfiguration for existing installations (oops)
Browse files Browse the repository at this point in the history
Signed-off-by: stefan <[email protected]>
  • Loading branch information
RustyDust committed Dec 27, 2024
1 parent e150342 commit e7b247a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions custom_components/sonnenbatterie/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,30 +76,31 @@ async def async_step_reconfigure(self, user_input):
{
vol.Required(
CONF_IP_ADDRESS,
default = entry.data[CONF_IP_ADDRESS] or None
default = entry.data.get(CONF_IP_ADDRESS) or None
): str,
vol.Required(
CONF_USERNAME,
default = entry.data[CONF_USERNAME] or "User"
default = entry.data.get(CONF_USERNAME) or "User"
): vol.In(["User", "Installer"]),
vol.Required(
CONF_PASSWORD,
default = entry.data[CONF_PASSWORD] or ""
default = entry.data.get(CONF_PASSWORD) or ""
): str,
vol.Required(
CONF_SCAN_INTERVAL,
default=entry.data[CONF_SCAN_INTERVAL] or DEFAULT_SCAN_INTERVAL
default=entry.data.get(CONF_SCAN_INTERVAL) or DEFAULT_SCAN_INTERVAL
): cv.positive_int,
vol.Optional(
ATTR_SONNEN_DEBUG,
default=entry.data[ATTR_SONNEN_DEBUG] or DEFAULT_SONNEN_DEBUG)
default=entry.data.get(ATTR_SONNEN_DEBUG) or DEFAULT_SONNEN_DEBUG)
: cv.boolean,
}
)

if user_input is not None:
await self.async_set_unique_id(entry.data[CONF_SERIAL_NUMBER])
self._abort_if_unique_id_configured()
if entry.data.get(CONF_SERIAL_NUMBER):
await self.async_set_unique_id(entry.data[CONF_SERIAL_NUMBER])
self._abort_if_unique_id_configured()
# noinspection PyBroadException
try:
my_serial = await self.hass.async_add_executor_job(
Expand Down
2 changes: 1 addition & 1 deletion custom_components/sonnenbatterie/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"issue_tracker": "https://github.com/weltmeyer/ha_sonnenbatterie/issues",
"iot_class": "local_polling",
"requirements": ["requests","sonnenbatterie>=0.3.0"],
"version": "2024.12.01"
"version": "2024.12.02"
}

0 comments on commit e7b247a

Please sign in to comment.