From 18a83cf034bc2aa209167c12059ea358da2fad4c Mon Sep 17 00:00:00 2001 From: stefan Date: Fri, 27 Dec 2024 12:40:41 +0100 Subject: [PATCH 1/4] Update issue tracker in manifest Signed-off-by: stefan --- .github/workflows/validate.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .github/workflows/validate.yaml diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml new file mode 100644 index 0000000..e69de29 From e1503420f0ef9c6090856786e1dcf51041d474c4 Mon Sep 17 00:00:00 2001 From: stefan Date: Fri, 27 Dec 2024 12:41:16 +0100 Subject: [PATCH 2/4] Update GitHub workflows Signed-off-by: stefan --- .github/workflows/validate.yaml | 17 +++++++++++++++++ custom_components/sonnenbatterie/manifest.json | 1 + 2 files changed, 18 insertions(+) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index e69de29..c38f573 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -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" diff --git a/custom_components/sonnenbatterie/manifest.json b/custom_components/sonnenbatterie/manifest.json index b411b8e..38b5291 100644 --- a/custom_components/sonnenbatterie/manifest.json +++ b/custom_components/sonnenbatterie/manifest.json @@ -5,6 +5,7 @@ "config_flow": true, "dependencies": [], "documentation": "https://github.com/weltmeyer/ha_sonnenbatterie", + "issue_tracker": "https://github.com/weltmeyer/ha_sonnenbatterie/issues", "iot_class": "local_polling", "requirements": ["requests","sonnenbatterie>=0.3.0"], "version": "2024.12.01" From e7b247aa805d22dbf97faec8d129b998bdfaeb28 Mon Sep 17 00:00:00 2001 From: stefan Date: Fri, 27 Dec 2024 12:55:33 +0100 Subject: [PATCH 3/4] Fix reconfiguration for existing installations (oops) Signed-off-by: stefan --- custom_components/sonnenbatterie/config_flow.py | 15 ++++++++------- custom_components/sonnenbatterie/manifest.json | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/custom_components/sonnenbatterie/config_flow.py b/custom_components/sonnenbatterie/config_flow.py index 3371739..6f7a3fd 100644 --- a/custom_components/sonnenbatterie/config_flow.py +++ b/custom_components/sonnenbatterie/config_flow.py @@ -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( diff --git a/custom_components/sonnenbatterie/manifest.json b/custom_components/sonnenbatterie/manifest.json index 38b5291..3374beb 100644 --- a/custom_components/sonnenbatterie/manifest.json +++ b/custom_components/sonnenbatterie/manifest.json @@ -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" } From e1392f082b5f54d790136d8cab648b61b500629f Mon Sep 17 00:00:00 2001 From: stefan Date: Fri, 27 Dec 2024 13:00:39 +0100 Subject: [PATCH 4/4] Sort manifest entries Signed-off-by: stefan --- custom_components/sonnenbatterie/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/sonnenbatterie/manifest.json b/custom_components/sonnenbatterie/manifest.json index 3374beb..b5edf52 100644 --- a/custom_components/sonnenbatterie/manifest.json +++ b/custom_components/sonnenbatterie/manifest.json @@ -5,8 +5,8 @@ "config_flow": true, "dependencies": [], "documentation": "https://github.com/weltmeyer/ha_sonnenbatterie", - "issue_tracker": "https://github.com/weltmeyer/ha_sonnenbatterie/issues", "iot_class": "local_polling", + "issue_tracker": "https://github.com/weltmeyer/ha_sonnenbatterie/issues", "requirements": ["requests","sonnenbatterie>=0.3.0"], "version": "2024.12.02" }