Skip to content

Commit

Permalink
Merge pull request #72 from RustyDust/sru_work
Browse files Browse the repository at this point in the history
Hotfix: Reconfigure flow for existing installations
  • Loading branch information
RustyDust authored Dec 27, 2024
2 parents 43ae4b0 + e1392f0 commit f720162
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Validate

on:
push:
pull_request:
schedule:
- cron: "0 1 * * *"
workflow_dispatch:

jobs:
validate-hacs:
runs-on: "ubuntu-latest"
steps:
- name: HACS validation
uses: "hacs/action@main"
with:
category: "integration"
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
3 changes: 2 additions & 1 deletion custom_components/sonnenbatterie/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dependencies": [],
"documentation": "https://github.com/weltmeyer/ha_sonnenbatterie",
"iot_class": "local_polling",
"issue_tracker": "https://github.com/weltmeyer/ha_sonnenbatterie/issues",
"requirements": ["requests","sonnenbatterie>=0.3.0"],
"version": "2024.12.01"
"version": "2024.12.02"
}

0 comments on commit f720162

Please sign in to comment.