From d8320303810a8276339fd1b44d99af4c26204738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Senart?= <> Date: Mon, 13 Jan 2025 15:29:51 +0100 Subject: [PATCH 1/7] Remove deprecated template files (old naming) --- addons/gazpar2haws/build.template.yaml | 14 ----------- addons/gazpar2haws/config.template.yaml | 31 ------------------------- 2 files changed, 45 deletions(-) delete mode 100644 addons/gazpar2haws/build.template.yaml delete mode 100644 addons/gazpar2haws/config.template.yaml diff --git a/addons/gazpar2haws/build.template.yaml b/addons/gazpar2haws/build.template.yaml deleted file mode 100644 index 0f90231..0000000 --- a/addons/gazpar2haws/build.template.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -build_from: - aarch64: ghcr.io/home-assistant/aarch64-base-python:3.12-alpine3.20 - amd64: ghcr.io/home-assistant/amd64-base-python:3.12-alpine3.20 - armhf: ghcr.io/home-assistant/armhf-base-python:3.12-alpine3.20 - armv7: ghcr.io/home-assistant/armv7-base-python:3.12-alpine3.20 - i386: ghcr.io/home-assistant/i386-base-python:3.12-alpine3.20 -labels: - org.opencontainers.image.title: "Home Assistant Add-on: Gazpar2HAWS add-on" - org.opencontainers.image.description: "Gateway that reads data history from the GrDF (French gas provider) meter and send it to Home Assistant energy dashboard" - org.opencontainers.image.source: "https://github.com/ssenart/gazpar2haws" - org.opencontainers.image.licenses: "MIT" -args: - GAZPAR2HAWS_VERSION: "${PACKAGE_VERSION}" \ No newline at end of file diff --git a/addons/gazpar2haws/config.template.yaml b/addons/gazpar2haws/config.template.yaml deleted file mode 100644 index 840f261..0000000 --- a/addons/gazpar2haws/config.template.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: "Gazpar2HAWS" -description: "Gazpar2HAWS is a gateway that reads data history from the GrDF (French gas provider) meter and send it to Home Assistant using WebSocket interface." -version: "${PACKAGE_VERSION}" -slug: "gazpar2haws" -init: false -arch: - - aarch64 - - amd64 - - armhf - - armv7 - - i386 -homeassistant_api: true -hassio_api: true -options: - grdf: - scan_interval: 480 # Number of minutes between each data retrieval (0 means no scan: a single data retrieval at startup, then stops). - username: "" - password: "" - pce_identifier: "" - timezone: "Europe/Paris" - last_days: 365 # Number of days of data to retrieve. - reset: false # If true, the data will be reset before the first data retrieval. If false, the data will be kept and new data will be added. -schema: - grdf: - scan_interval: int # Number of minutes between each data retrieval (0 means no scan: a single data retrieval at startup, then stops). - username: str - password: str - pce_identifier: str - timezone: str? - last_days: int? # Number of days of data to retrieve. - reset: bool? # If true, the data will be reset before the first data retrieval. If false, the data will be kept and new data will be added. From 38e0ec6b4117c1e3e4c5d91ca9390d30aeb6f861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Senart?= <37013755+ssenart@users.noreply.github.com> Date: Wed, 15 Jan 2025 21:52:18 +0100 Subject: [PATCH 2/7] [#33] Dockerhub 'latest' tag is currently published only if the release is created in the main branch. (#39) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [#33] Dockerhub 'latest' tag is currently published only if the release is created in the main branch. * [#33] Dockerhub 'latest' tag is currently published only if the release is created in the main branch. * [#33] Dockerhub 'latest' tag is currently published only if the release is created in the main branch. --------- Co-authored-by: Stéphane Senart <> --- .github/workflows/create-release.yaml | 12 +++++++++--- .github/workflows/publish-to-dockerhub.yaml | 16 +++++++++++----- .../workflows/publish-to-dockerhub/action.yaml | 6 +++++- CHANGELOG.md | 6 ++++++ 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml index fc55f93..e3d59c2 100644 --- a/.github/workflows/create-release.yaml +++ b/.github/workflows/create-release.yaml @@ -8,6 +8,11 @@ on: required: false default: "" type: string + is_final: + description: "It is a final release (not a pre-release)" + required: false + default: true + type: boolean permissions: contents: write # Allow to commit and push. @@ -85,8 +90,8 @@ jobs: run: sudo apt-get update && sudo apt-get install -y gettext-base #---------------------------------------------- - # Replace version in pyproject.toml, config.yaml and build.yaml - - name: Replace version + # Bump version in pyproject.toml, config.yaml and build.yaml + - name: Bump version run: | envsubst < pyproject.template.toml > pyproject.toml envsubst < addons/gazpar2haws/config.yaml.template > addons/gazpar2haws/config.yaml @@ -100,7 +105,7 @@ jobs: git config --global user.name github-actions git config --global user.email github-actions@github.com git add pyproject.toml addons/gazpar2haws/config.yaml addons/gazpar2haws/build.yaml - git commit --allow-empty -m "Upgrade version to ${PACKAGE_VERSION}" + git commit --allow-empty -m "Bump version to ${PACKAGE_VERSION}" git push #---------------------------------------------- @@ -210,5 +215,6 @@ jobs: with: image: ssenart/gazpar2haws version: ${{ needs.prepare.outputs.package-version }} + is_latest : ${{ inputs.is_final }} username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} diff --git a/.github/workflows/publish-to-dockerhub.yaml b/.github/workflows/publish-to-dockerhub.yaml index e20d65e..0332574 100644 --- a/.github/workflows/publish-to-dockerhub.yaml +++ b/.github/workflows/publish-to-dockerhub.yaml @@ -8,6 +8,11 @@ on: required: false default: "" type: string + is_latest: + description: "Update the 'latest' tag" + required: false + default: true + type: boolean permissions: contents: read # Readonly permissions @@ -17,9 +22,9 @@ env: jobs: #---------------------------------------------- - # Collect information - information: - name: Collect information + # Prepare + prepare: + name: Prepare outputs: package-version: ${{ steps.select-package-version.outputs.package-version }} default_python_version: ${{ env.DEFAULT_PYTHON_VERSION }} @@ -66,7 +71,7 @@ jobs: # Publish Docker image to DockerHub publish-to-dockerhub: name: Publish to DockerHub - needs: information + needs: prepare runs-on: ubuntu-latest permissions: packages: write @@ -85,6 +90,7 @@ jobs: uses: ./.github/workflows/publish-to-dockerhub with: image: ssenart/gazpar2haws - version: ${{ needs.information.outputs.package-version }} + version: ${{ needs.prepare.outputs.package-version }} + is_latest: ${{ inputs.is_latest }} username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} diff --git a/.github/workflows/publish-to-dockerhub/action.yaml b/.github/workflows/publish-to-dockerhub/action.yaml index c6c345a..bc74835 100644 --- a/.github/workflows/publish-to-dockerhub/action.yaml +++ b/.github/workflows/publish-to-dockerhub/action.yaml @@ -10,6 +10,10 @@ inputs: version: description: "Version of the image" required: true + is_latest: + description: "Whether the version is a final release" + required: false + default: false username: description: "DockerHub username" required: true @@ -39,7 +43,7 @@ runs: images: ${{ inputs.image }} tags: | # Set latest tag for the default branch - type=raw,value=latest,enable={{is_default_branch}} + type=raw,value=latest,enable=${{ inputs.is_latest }} # Set the version tag for all branches type=raw,value=${{ inputs.version }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 4909971..b377acc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.12] - 2025-01-13 + +### Added + +[#33](https://github.com/ssenart/gazpar2haws/issues/33): Dockerhub 'latest' tag is currently published only if the release is created in the main branch. + ## [0.1.11] - 2025-01-12 ### Fixed From 56d567a3c2ca84da40926e647c5442c4551bb43e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Senart?= <37013755+ssenart@users.noreply.github.com> Date: Wed, 15 Jan 2025 21:57:31 +0100 Subject: [PATCH 3/7] [#36] Error if HA endpoint configuration is missing in configuration.yaml. (#40) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [#36] Error if HA endpoint configuration is missing in configuration.yaml * [#36] Error if HA endpoint configuration is missing in configuration.yaml --------- Co-authored-by: Stéphane Senart <> --- CHANGELOG.md | 6 +++- gazpar2haws/bridge.py | 25 +++++++++++++++-- gazpar2haws/gazpar.py | 50 +++++++++++++++++++++++++++++++-- tests/config/configuration.yaml | 1 - tests/test_gazpar.py | 6 +++- tests/test_haws.py | 6 +++- 6 files changed, 85 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b377acc..d25323d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.1.12] - 2025-01-13 +## [0.1.12] - 2025-01-15 + +### Fixed + +[#36](https://github.com/ssenart/gazpar2haws/issues/36): Error if HA endpoint configuration is missing in configuration.yaml. ### Added diff --git a/gazpar2haws/bridge.py b/gazpar2haws/bridge.py index cfe4d92..455f8b3 100644 --- a/gazpar2haws/bridge.py +++ b/gazpar2haws/bridge.py @@ -16,12 +16,30 @@ class Bridge: def __init__(self, config: config_utils.ConfigLoader): # GrDF scan interval (in seconds) + if config.get("grdf.scan_interval") is None: + raise ValueError("Configuration parameter 'grdf.scan_interval' is missing") self._grdf_scan_interval = int(config.get("grdf.scan_interval")) - # Home Assistant configuration + # Home Assistant configuration: host + if config.get("homeassistant.host") is None: + raise ValueError("Configuration parameter 'homeassistant.host' is missing") ha_host = config.get("homeassistant.host") + + # Home Assistant configuration: port + if config.get("homeassistant.port") is None: + raise ValueError("Configuration parameter 'homeassistant.port' is missing") ha_port = config.get("homeassistant.port") - ha_endpoint = config.get("homeassistant.endpoint") + + # Home Assistant configuration: endpoint + ha_endpoint = ( + config.get("homeassistant.endpoint") + if config.get("homeassistant.endpoint") + else "/api/websocket" + ) + + # Home Assistant configuration: token + if config.get("homeassistant.token") is None: + raise ValueError("Configuration parameter 'homeassistant.token' is missing") ha_token = config.get("homeassistant.token") # Initialize Home Assistant @@ -29,6 +47,9 @@ def __init__(self, config: config_utils.ConfigLoader): # Initialize Gazpar self._gazpar = [] + + if config.get("grdf.devices") is None: + raise ValueError("Configuration parameter 'grdf.devices' is missing") for grdf_device_config in config.get("grdf.devices"): self._gazpar.append(Gazpar(grdf_device_config, self._homeassistant)) diff --git a/gazpar2haws/gazpar.py b/gazpar2haws/gazpar.py index 3ab253e..229fdd4 100644 --- a/gazpar2haws/gazpar.py +++ b/gazpar2haws/gazpar.py @@ -19,15 +19,59 @@ def __init__(self, config: dict[str, Any], homeassistant: HomeAssistantWS): self._homeassistant = homeassistant - # GrDF configuration + # GrDF configuration: name + if config.get("name") is None: + raise ValueError("Configuration parameter 'grdf.devices[].name' is missing") self._name = config.get("name") - self._data_source = config.get("data_source") + + # GrDF configuration: data source + self._data_source = ( + config.get("data_source") if config.get("data_source") else "json" + ) + + # GrDF configuration: username + if self._data_source != "test" and config.get("username") is None: + raise ValueError( + "Configuration parameter 'grdf.devices[].username' is missing" + ) self._username = config.get("username") + + # GrDF configuration: password + if self._data_source != "test" and config.get("password") is None: + raise ValueError( + "Configuration parameter 'grdf.devices[].password' is missing" + ) self._password = config.get("password") + + # GrDF configuration: pce_identifier + if self._data_source != "test" and config.get("pce_identifier") is None: + raise ValueError( + "Configuration parameter 'grdf.devices[].pce_identifier' is missing" + ) self._pce_identifier = str(config.get("pce_identifier")) - self._tmp_dir = config.get("tmp_dir") + + # GrDF configuration: tmp_dir + self._tmp_dir = config.get("tmp_dir") if config.get("tmp_dir") else "/tmp" + + # GrDF configuration: last_days + if config.get("last_days") is None: + raise ValueError( + "Configuration parameter 'grdf.devices[].last_days' is missing" + ) self._last_days = int(str(config.get("last_days"))) + + # GrDF configuration: timezone + if config.get("timezone") is None: + raise ValueError( + "Configuration parameter 'grdf.devices[].timezone' is missing" + ) self._timezone = str(config.get("timezone")) + + # GrDF configuration: reset + if config.get("reset") is None: + raise ValueError( + "Configuration parameter 'grdf.devices[].reset' is missing" + ) self._reset = bool(config.get("reset")) # As of date: YYYY-MM-DD diff --git a/tests/config/configuration.yaml b/tests/config/configuration.yaml index d52f2cf..f6d86a6 100644 --- a/tests/config/configuration.yaml +++ b/tests/config/configuration.yaml @@ -17,5 +17,4 @@ grdf: homeassistant: host: "!secret homeassistant.host" port: "!secret homeassistant.port" - endpoint: "/api/websocket" token: "!secret homeassistant.token" diff --git a/tests/test_gazpar.py b/tests/test_gazpar.py index a62b406..1f357c0 100644 --- a/tests/test_gazpar.py +++ b/tests/test_gazpar.py @@ -24,7 +24,11 @@ def setup_method(self): # pylint: disable=R0801 ha_host = self._config.get("homeassistant.host") ha_port = self._config.get("homeassistant.port") - ha_endpoint = self._config.get("homeassistant.endpoint") + ha_endpoint = ( + self._config.get("homeassistant.endpoint") + if self._config.get("homeassistant.endpoint") + else "/api/websocket" + ) ha_token = self._config.get("homeassistant.token") self._haws = HomeAssistantWS( # pylint: disable=W0201 diff --git a/tests/test_haws.py b/tests/test_haws.py index 217c478..9d71b9a 100644 --- a/tests/test_haws.py +++ b/tests/test_haws.py @@ -27,7 +27,11 @@ def setup_method(self): ha_host = self._config.get("homeassistant.host") ha_port = self._config.get("homeassistant.port") - ha_endpoint = self._config.get("homeassistant.endpoint") + ha_endpoint = ( + self._config.get("homeassistant.endpoint") + if self._config.get("homeassistant.endpoint") + else "/api/websocket" + ) ha_token = self._config.get("homeassistant.token") self._haws = HomeAssistantWS( # pylint: disable=W0201 From d0c443a82db809306e4084dc15e9eed38d9a7d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Senart?= <37013755+ssenart@users.noreply.github.com> Date: Wed, 15 Jan 2025 23:00:44 +0100 Subject: [PATCH 4/7] [#38] Using the HA addon, the PCE identifier is transformed into another number. (#41) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [#38] Using the HA addon, the PCE identifier is transformed into another number. * [#38] Using the HA addon, the PCE identifier is transformed into another number. --------- Co-authored-by: Stéphane Senart <> --- CHANGELOG.md | 2 ++ .../app/config/configuration.template.yaml | 20 +++++++++---------- .../rootfs/app/config/secrets.template.yaml | 12 +++++------ config/secrets.template.yaml | 14 ++++++------- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d25323d..319899d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +[#38](https://github.com/ssenart/gazpar2haws/issues/38): Using the HA addon, the PCE identifier is transformed into another number. + [#36](https://github.com/ssenart/gazpar2haws/issues/36): Error if HA endpoint configuration is missing in configuration.yaml. ### Added diff --git a/addons/gazpar2haws/rootfs/app/config/configuration.template.yaml b/addons/gazpar2haws/rootfs/app/config/configuration.template.yaml index 7b2069d..c22f182 100644 --- a/addons/gazpar2haws/rootfs/app/config/configuration.template.yaml +++ b/addons/gazpar2haws/rootfs/app/config/configuration.template.yaml @@ -1,22 +1,22 @@ logging: file: log/gazpar2haws.log - console: true + console: true level: debug - format: '%(asctime)s %(levelname)s [%(name)s] %(message)s' + format: "%(asctime)s %(levelname)s [%(name)s] %(message)s" grdf: scan_interval: ${GRDF_SCAN_INTERVAL} # Number of minutes between each data retrieval (0 means no scan: a single data retrieval at startup, then stops). devices: - - name: gazpar2haws # Name of the device in home assistant. It will be used as the entity_id: sensor.${name}. - username: "!secret grdf.username" - password: "!secret grdf.password" - pce_identifier: "!secret grdf.pce_identifier" - timezone: ${GRDF_TIMEZONE} # Timezone of the data. It should be the same as the Home Assistant timezone. - last_days: ${GRDF_LAST_DAYS} # Number of days of data to retrieve - reset: false # If true, the data will be reset before the first data retrieval. If false, the data will be kept and new data will be added. + - name: gazpar2haws # Name of the device in home assistant. It will be used as the entity_id: sensor.${name}. + username: "!secret grdf.username" + password: "!secret grdf.password" + pce_identifier: "!secret grdf.pce_identifier" + timezone: "${GRDF_TIMEZONE}" # Timezone of the data. It should be the same as the Home Assistant timezone. + last_days: ${GRDF_LAST_DAYS} # Number of days of data to retrieve + reset: false # If true, the data will be reset before the first data retrieval. If false, the data will be kept and new data will be added. homeassistant: host: "!secret homeassistant.host" port: "!secret homeassistant.port" - endpoint: ${HOMEASSISTANT_ENDPOINT} + endpoint: "${HOMEASSISTANT_ENDPOINT}" # The websocket endpoint to use. It should be /api/websocket by default. token: "!secret homeassistant.token" diff --git a/addons/gazpar2haws/rootfs/app/config/secrets.template.yaml b/addons/gazpar2haws/rootfs/app/config/secrets.template.yaml index c4f3926..d916d4d 100644 --- a/addons/gazpar2haws/rootfs/app/config/secrets.template.yaml +++ b/addons/gazpar2haws/rootfs/app/config/secrets.template.yaml @@ -1,7 +1,7 @@ -grdf.username: ${GRDF_USERNAME} -grdf.password: ${GRDF_PASSWORD} -grdf.pce_identifier: ${GRDF_PCE_IDENTIFIER} +grdf.username: "${GRDF_USERNAME}" +grdf.password: "${GRDF_PASSWORD}" +grdf.pce_identifier: "${GRDF_PCE_IDENTIFIER}" -homeassistant.host: ${HOMEASSISTANT_HOST} -homeassistant.port: ${HOMEASSISTANT_PORT} -homeassistant.token: ${HOMEASSISTANT_TOKEN} +homeassistant.host: "${HOMEASSISTANT_HOST}" +homeassistant.port: "${HOMEASSISTANT_PORT}" +homeassistant.token: "${HOMEASSISTANT_TOKEN}" diff --git a/config/secrets.template.yaml b/config/secrets.template.yaml index c4f3926..477159e 100644 --- a/config/secrets.template.yaml +++ b/config/secrets.template.yaml @@ -1,7 +1,7 @@ -grdf.username: ${GRDF_USERNAME} -grdf.password: ${GRDF_PASSWORD} -grdf.pce_identifier: ${GRDF_PCE_IDENTIFIER} - -homeassistant.host: ${HOMEASSISTANT_HOST} -homeassistant.port: ${HOMEASSISTANT_PORT} -homeassistant.token: ${HOMEASSISTANT_TOKEN} +grdf.username: "${GRDF_USERNAME}" +grdf.password: "${GRDF_PASSWORD}" +grdf.pce_identifier: "${GRDF_PCE_IDENTIFIER}" + +homeassistant.host: "${HOMEASSISTANT_HOST}" +homeassistant.port: "${HOMEASSISTANT_PORT}" +homeassistant.token: "${HOMEASSISTANT_TOKEN}" From 3b7e4dd9f04088a2b68939ef8f08c3b873fd4703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Senart?= <37013755+ssenart@users.noreply.github.com> Date: Wed, 15 Jan 2025 23:11:42 +0100 Subject: [PATCH 5/7] =?UTF-8?q?[#37]=20Error=20GrDF=20send=20missing=20dat?= =?UTF-8?q?a=20with=20type=3D"Absence=20de=20Donn=C3=A9es".=20(#42)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Stéphane Senart <> --- CHANGELOG.md | 2 ++ gazpar2haws/gazpar.py | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 319899d..4d9b1fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +[#37](https://github.com/ssenart/gazpar2haws/issues/37): Error GrDF send missing data with type="Absence de Données". + [#38](https://github.com/ssenart/gazpar2haws/issues/38): Using the HA addon, the PCE identifier is transformed into another number. [#36](https://github.com/ssenart/gazpar2haws/issues/36): Error if HA endpoint configuration is missing in configuration.yaml. diff --git a/gazpar2haws/gazpar.py b/gazpar2haws/gazpar.py index 229fdd4..3cebaa5 100644 --- a/gazpar2haws/gazpar.py +++ b/gazpar2haws/gazpar.py @@ -173,7 +173,13 @@ async def _publish_entity( continue # Compute the total volume and energy - total += reading[property_name] + if reading[property_name] is not None: + total += reading[property_name] + else: + Logger.warning( + f"Missing property {property_name} for date {date}. Skipping..." + ) + continue statistics.append({"start": date.isoformat(), "state": total, "sum": total}) From 25de5de1b757b79f23bece18a1c6984c1aa71f9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Senart?= <37013755+ssenart@users.noreply.github.com> Date: Thu, 16 Jan 2025 21:06:43 +0100 Subject: [PATCH 6/7] [#47] 'reset' configuration parameter is ignored in the addon configuration panel. (#48) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Stéphane Senart <> --- .github/workflows/publish-to-dockerhub/action.yaml | 4 ++-- CHANGELOG.md | 6 ++++++ .../rootfs/app/config/configuration.template.yaml | 2 +- addons/gazpar2haws/rootfs/app/run.sh | 5 ++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-to-dockerhub/action.yaml b/.github/workflows/publish-to-dockerhub/action.yaml index bc74835..da3dd8d 100644 --- a/.github/workflows/publish-to-dockerhub/action.yaml +++ b/.github/workflows/publish-to-dockerhub/action.yaml @@ -42,10 +42,10 @@ runs: with: images: ${{ inputs.image }} tags: | - # Set latest tag for the default branch - type=raw,value=latest,enable=${{ inputs.is_latest }} # Set the version tag for all branches type=raw,value=${{ inputs.version }} + # Set latest tag for the default branch + type=raw,value=latest,enable=${{ inputs.is_latest }} - name: Log in to Docker Hub uses: docker/login-action@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d9b1fb..d74d7c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.13] - 2025-01-16 + +### Fixed + +[#47](https://github.com/ssenart/gazpar2haws/issues/47): 'reset' configuration parameter is ignored in the addon configuration panel. + ## [0.1.12] - 2025-01-15 ### Fixed diff --git a/addons/gazpar2haws/rootfs/app/config/configuration.template.yaml b/addons/gazpar2haws/rootfs/app/config/configuration.template.yaml index c22f182..1b15944 100644 --- a/addons/gazpar2haws/rootfs/app/config/configuration.template.yaml +++ b/addons/gazpar2haws/rootfs/app/config/configuration.template.yaml @@ -13,7 +13,7 @@ grdf: pce_identifier: "!secret grdf.pce_identifier" timezone: "${GRDF_TIMEZONE}" # Timezone of the data. It should be the same as the Home Assistant timezone. last_days: ${GRDF_LAST_DAYS} # Number of days of data to retrieve - reset: false # If true, the data will be reset before the first data retrieval. If false, the data will be kept and new data will be added. + reset: ${GRDF_RESET} # If true, the data will be reset before the first data retrieval. If false, the data will be kept and new data will be added. homeassistant: host: "!secret homeassistant.host" diff --git a/addons/gazpar2haws/rootfs/app/run.sh b/addons/gazpar2haws/rootfs/app/run.sh index 8aed658..855eb19 100644 --- a/addons/gazpar2haws/rootfs/app/run.sh +++ b/addons/gazpar2haws/rootfs/app/run.sh @@ -6,6 +6,7 @@ GRDF_PCE_IDENTIFIER=$(bashio::config 'grdf.pce_identifier') GRDF_SCAN_INTERVAL=$(bashio::config 'grdf.scan_interval') GRDF_LAST_DAYS=$(bashio::config 'grdf.last_days') GRDF_TIMEZONE=$(bashio::config 'grdf.timezone') +GRDF_RESET=$(bashio::config 'grdf.reset') HOMEASSISTANT_HOST=supervisor HOMEASSISTANT_PORT=80 @@ -18,6 +19,7 @@ HOMEASSISTANT_TOKEN=${SUPERVISOR_TOKEN} : "${GRDF_SCAN_INTERVAL:="480"}" # 8 hours : "${GRDF_LAST_DAYS:="365"}" # 1 year : "${GRDF_TIMEZONE:="Europe/Paris"}" # Default timezone: Europe/Paris +: "${GRDF_RESET:="false"}" # Default reset: false : "${HOMEASSISTANT_HOST:?HOMEASSISTANT_HOST is required and not set.}" : "${HOMEASSISTANT_PORT:="8123"}" # Default Home Assistant port @@ -35,9 +37,10 @@ echo "HOMEASSISTANT_HOST: ${HOMEASSISTANT_HOST}" echo "HOMEASSISTANT_PORT: ${HOMEASSISTANT_PORT}" echo "HOMEASSISTANT_ENDPOINT: ${HOMEASSISTANT_ENDPOINT}" echo "HOMEASSISTANT_TOKEN: ${HOMEASSISTANT_TOKEN}" +echo "GRDF_RESET: ${GRDF_RESET}" # Export environment variables -export GRDF_USERNAME GRDF_PASSWORD GRDF_PCE_IDENTIFIER GRDF_SCAN_INTERVAL GRDF_LAST_DAYS GRDF_TIMEZONE HOMEASSISTANT_HOST HOMEASSISTANT_PORT HOMEASSISTANT_ENDPOINT HOMEASSISTANT_TOKEN +export GRDF_USERNAME GRDF_PASSWORD GRDF_PCE_IDENTIFIER GRDF_SCAN_INTERVAL GRDF_LAST_DAYS GRDF_TIMEZONE GRDF_RESET HOMEASSISTANT_HOST HOMEASSISTANT_PORT HOMEASSISTANT_ENDPOINT HOMEASSISTANT_TOKEN # Instantiate the template config if [ ! -e /app/config/configuration.yaml ]; then From fbe1a50618616675a5eb3578c6b06e2abe87ec6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Senart?= <37013755+ssenart@users.noreply.github.com> Date: Fri, 17 Jan 2025 19:35:14 +0100 Subject: [PATCH 7/7] [#50] In dockerhub, version displayed in log file is wrong and always N-1 (#51) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [#50] In dockerhub, version displayed in log file is wrong and always N-1 * [#50] In dockerhub, version displayed in log file is wrong and always N-1 --------- Co-authored-by: Stéphane Senart <> --- .github/workflows/create-release.yaml | 4 +++- CHANGELOG.md | 6 ++++++ docker/Dockerfile | 5 +++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml index e3d59c2..9d7363c 100644 --- a/.github/workflows/create-release.yaml +++ b/.github/workflows/create-release.yaml @@ -204,9 +204,11 @@ jobs: id-token: write steps: #---------------------------------------------- - # Check-out repo + # Checkout the tag from the repository - name: Check out repository uses: actions/checkout@v4 + with: + ref: ${{ needs.prepare.outputs.package-version }} #---------------------------------------------- # Publish the Docker image diff --git a/CHANGELOG.md b/CHANGELOG.md index d74d7c4..3ad67ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.14] - 2025-01-17 + +### Fixed + +[#50](https://github.com/ssenart/gazpar2haws/issues/50): In dockerhub, version displayed in log file is wrong and always N-1. + ## [0.1.13] - 2025-01-16 ### Fixed diff --git a/docker/Dockerfile b/docker/Dockerfile index 7d2d316..ed0d51e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -12,8 +12,6 @@ WORKDIR /app COPY pyproject.toml ./ COPY poetry.lock ./ -COPY README.md ./ -COPY LICENSE ./ COPY gazpar2haws/ /app/gazpar2haws @@ -48,6 +46,9 @@ RUN chmod +x /app/entrypoint.sh COPY gazpar2haws/ /app/gazpar2haws RUN mkdir /app/config RUN mkdir /app/log +COPY README.md /app +COPY CHANGELOG.md /app +COPY LICENCE /app COPY config/configuration.template.yaml /app COPY config/secrets.template.yaml /app