From d50b933c04aba4010e9beaea608d2eccd6830194 Mon Sep 17 00:00:00 2001 From: odin568 Date: Mon, 16 Mar 2026 10:48:59 +0100 Subject: [PATCH 1/2] Build multi-arch container --- .github/workflows/latest.yml | 37 ++++++++++++++++++++++++++++++++++++ .gitignore | 4 +++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/latest.yml diff --git a/.github/workflows/latest.yml b/.github/workflows/latest.yml new file mode 100644 index 0000000..6f1e8c2 --- /dev/null +++ b/.github/workflows/latest.yml @@ -0,0 +1,37 @@ +name: Latest +on: + push: + branches: [ main ] + + workflow_dispatch: + +jobs: + docker_buildx: + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v6 + + - name: Set up QEMU environment + uses: docker/setup-qemu-action@v4.0.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4.0.0 + + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v4.0.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push all images + uses: docker/build-push-action@v7.0.0 + with: + context: . + platforms: | + linux/amd64 + linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + build-args: BUILDX_QEMU_ENV=true + tags: odin568/pyfusionsolardatarelay:latest \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4fc4e3a..5703114 100644 --- a/.gitignore +++ b/.gitignore @@ -133,4 +133,6 @@ dmypy.json # Project specific ignores /config.yaml -/cache/**/*.json \ No newline at end of file +/cache/**/*.json + +.idea/ \ No newline at end of file From ac8fe45972682ffc0d79bef92cd450ce0da20354 Mon Sep 17 00:00:00 2001 From: odin568 Date: Wed, 25 Mar 2026 11:59:38 +0100 Subject: [PATCH 2/2] Avoid structurally incorrect API calls in case there is no grid meter available. Return gracefully --- modules/fetch_fusion_solar_open_api.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/fetch_fusion_solar_open_api.py b/modules/fetch_fusion_solar_open_api.py index 35797f4..30a37b5 100644 --- a/modules/fetch_fusion_solar_open_api.py +++ b/modules/fetch_fusion_solar_open_api.py @@ -143,17 +143,26 @@ def fetch_fusionsolar_grid_meter_device_kpis(self) -> List[FusionSolarMeterMeasu Retrieve real-time KPIs from the FusionSolar OpenAPI. Uses rate limiting to avoid frequent calls. - :return: A list of FusionSolarMeterKpi objects containing inverter metrics. + :return: A list of FusionSolarMeterKpi objects containing grid meter metrics. """ - self.logger.info(f"Requesting inverter realtimeKpi's from FusionSolarOpenAPI.") + self.logger.info(f"Requesting grid meter realtimeKpi's from FusionSolarOpenAPI.") # Ensure the device list is populated if not self.device_list: self.update_device_list() + grid_meters = [ + str(item["id"]) + for item in self.device_list + if item.get("devTypeId") == 17 and item.get("id") is not None + ] + + if not grid_meters: + self.logger.warning("No compatible grid meter found. Skipping") + return [] + url = f"{self.conf.fusionsolar_open_api_url}/thirdData/getDevRealKpi" - devices_str = ",".join(str(item["id"]) for item in self.device_list if "id" in item and "devTypeId" in item and item["devTypeId"] == 17) - data = {"devTypeId": 17, "devIds": devices_str} + data = {"devTypeId": 17, "devIds": ",".join(grid_meters)} response_json = self._fetch_fusionsolar_data_request(url, data) api_measurement_list = response_json.get("data", [])