diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 854eea6..8400155 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,36 +1,11 @@ name: Lint -on: - push: - branches: - - main - pull_request: - branches: - - main - schedule: - - cron: "0 0 * * *" +on: [push, pull_request, workflow_dispatch] jobs: - find: - name: Find add-ons - runs-on: ubuntu-latest - outputs: - addons: ${{ steps.addons.outputs.addons_list }} - steps: - - name: ⤵️ Check out code from GitHub - uses: actions/checkout@v4.1.1 - - - name: 🔍 Find add-on directories - id: addons - uses: home-assistant/actions/helpers/find-addons@master - lint: - name: Lint add-on ${{ matrix.path }} + name: Lint runs-on: ubuntu-latest - needs: find - strategy: - matrix: - path: ${{ fromJson(needs.find.outputs.addons) }} steps: - name: ⤵️ Check out code from GitHub uses: actions/checkout@v4.1.1 @@ -38,4 +13,4 @@ jobs: - name: 🚀 Run Home Assistant Add-on Lint uses: frenck/action-addon-linter@v2.15 with: - path: "./${{ matrix.path }}" + path: ./pwsmqttdispatcher diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 9436aef..75b6482 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -7,21 +7,29 @@ on: jobs: publish: - name: Publish + name: Build and publish runs-on: ubuntu-latest + strategy: + matrix: + arch: ["aarch64", "amd64", "armhf", "armv7", "i386"] + steps: - name: Checkout the repository uses: actions/checkout@v3 + - name: Login to GH Container registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Publish - uses: home-assistant/builder@2023.12.0 + + - name: Publish ${{ matrix.arch }} + uses: home-assistant/builder@2024.01.0 with: args: | - --all \ + --addon \ + --${{ matrix.arch }} \ --target /data/pwsmqttdispatcher \ + --image "${{ matrix.arch }}-pwsmqttdispatcher" \ --docker-hub "ghcr.io/${{ github.repository_owner }}" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9745238..39fa579 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -6,14 +6,18 @@ jobs: build: name: Test build runs-on: ubuntu-latest + strategy: + matrix: + arch: ["aarch64", "amd64", "armhf", "armv7", "i386"] steps: - name: Checkout the repository uses: actions/checkout@v3 - name: Test build - uses: home-assistant/builder@2023.12.0 + uses: home-assistant/builder@2024.01.0 with: args: | --test \ - --all \ + --${{ matrix.arch }} \ + --addon \ --target /data/pwsmqttdispatcher \ --docker-hub "ghcr.io/${{ github.repository_owner }}" \ diff --git a/README.md b/README.md index d5ce281..109aa5b 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,10 @@ # PWS to MQTT dispatcher addon for Home Assistant [![Lint](https://github.com/peterzen/hass-pws-mqtt-addon/actions/workflows/lint.yaml/badge.svg)](https://github.com/peterzen/hass-pws-mqtt-addon/actions/workflows/lint.yaml) -[![Builder](https://github.com/peterzen/hass-pws-mqtt-addon/actions/workflows/builder.yaml/badge.svg)](https://github.com/peterzen/hass-pws-mqtt-addon/actions/workflows/builder.yaml) -This Home Assistant add-on retrieves live weather data from a WH2600 personal weather station (PWS) and publishes it to an MQTT topic where HAAS can access it as sensor information. +[![Test](https://github.com/peterzen/hass-pws-mqtt-addon/actions/workflows/test.yaml/badge.svg)](https://github.com/peterzen/hass-pws-mqtt-addon/actions/workflows/test.yaml) + +This add-on retrieves live weather data from a WH2600 personal weather station (PWS) and publishes it to an MQTT topic where HAAS can access it as sensor information. Supported weather stations: Renkforce WH2600, Froggit units. diff --git a/pwsmqttdispatcher/CHANGELOG.md b/pwsmqttdispatcher/CHANGELOG.md index 2c7d5d2..ffdee4a 100644 --- a/pwsmqttdispatcher/CHANGELOG.md +++ b/pwsmqttdispatcher/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.1.24 + + - NaN values received from the PWS are now passed through to MQTT, instead of throwing an error. + - Fixed multi arch build + ## 0.1.22 - Image repository changed to ghcr.io, addon now available on all supported HASS platforms diff --git a/pwsmqttdispatcher/Dockerfile b/pwsmqttdispatcher/Dockerfile index f8cb13f..9bff935 100644 --- a/pwsmqttdispatcher/Dockerfile +++ b/pwsmqttdispatcher/Dockerfile @@ -1,18 +1,17 @@ - # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile ARG BUILD_FROM -FROM golang:1.21 AS build +FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.21 AS build WORKDIR /root/ COPY ./src/ . -RUN CGO_ENABLED=0 GO111MODULE=on go build +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" + FROM $BUILD_FROM ARG TEMPIO_VERSION ARG BUILD_ARCH - # Execute during the build of the image RUN \ curl -sSLf -o /usr/bin/tempio \ @@ -23,5 +22,3 @@ COPY rootfs / # Copy pwsmqttdispatcher binary COPY --from=build /root/pwsmqttdispatcher /usr/bin - -# ENTRYPOINT [ "/bin/sh" ] \ No newline at end of file diff --git a/pwsmqttdispatcher/build.yaml b/pwsmqttdispatcher/build.yaml index 8947273..473f432 100644 --- a/pwsmqttdispatcher/build.yaml +++ b/pwsmqttdispatcher/build.yaml @@ -12,3 +12,6 @@ labels: org.opencontainers.image.licenses: "Apache License 2.0" args: TEMPIO_VERSION: "2021.09.0" +codenotary: + signer: peter@froggle.org + base_image: notary@home-assistant.io diff --git a/pwsmqttdispatcher/config.yaml b/pwsmqttdispatcher/config.yaml index fda01b3..674ae72 100644 --- a/pwsmqttdispatcher/config.yaml +++ b/pwsmqttdispatcher/config.yaml @@ -1,6 +1,6 @@ # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config name: PWS to MQTT dispatcher addon -version: "0.1.22" +version: "0.1.24" slug: pwsmqttdispatcher description: Push weather station (PWS) data to MQTT url: "https://github.com/peterzen/hass-pws-mqtt-addon/tree/main/pwsmqttdispatcher" @@ -23,6 +23,6 @@ schema: mqtt_client_id: "str?" fetch_interval: "int" debug_enabled: "bool" -image: "ghcr.io/peterzen/pwsmqttdispatcher" +image: "ghcr.io/peterzen/{arch}-pwsmqttdispatcher" services: - mqtt:want