Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6e67325
Adapted to NEXA
May 21, 2025
4fe5a56
Reworked thread structure and MQTT connection handling
May 22, 2025
bf0324b
Added some (so far unused) client parameter setters
Jun 16, 2025
d453a2b
Added script for creating Debian packages
Jun 16, 2025
a768295
Added Gitlab CI
Jun 16, 2025
cc548e0
-
Jun 16, 2025
ca22056
-
Jun 16, 2025
8b9ad76
Added working mode
Jun 17, 2025
7de2eaa
work_mode and status enums added to Home Assistant Discovery
Jun 18, 2025
74bc2ef
Merge branch 'temp-1' into nexa
Jun 18, 2025
6b9d593
Parameters: renamed 'output_power_w' to 'default_output_w', added 'de…
Jun 18, 2025
47b53be
Refactored setting parameters
Jun 20, 2025
1c406cb
Default mode can now be set
Jun 20, 2025
72c89d6
Refactored Home Assistant discovery
Jun 23, 2025
d8256c2
Rename 'noah' to 'nexa'
Jun 23, 2025
5249ccd
Rename module
Jun 23, 2025
6af9644
Renamed main path
Jun 23, 2025
ff72bf0
More renames
Jun 24, 2025
03940da
Fully reconnects after MQTT disconnect
Jun 24, 2025
d435c1e
Reworked setting of parameters
Jun 25, 2025
d8140e6
Merge branch 'temp-2' into nexa
Jun 26, 2025
8f53338
Unit test package endpoint_mqtt
Jun 27, 2025
d25f5cd
Unit test package growatt_app (client_http.go)
Jun 28, 2025
34ced8d
Unit test package growatt_app (client.go)
Jun 28, 2025
5948922
Unit test package growatt_app (payload.go)
Jun 30, 2025
8817807
Merge branch 'unit-test' into nexa
Jun 30, 2025
06bb130
Fix condition for re-login. More error logs.
Jun 30, 2025
bc09e49
Update Dockerfile to nexa
Jun 30, 2025
3b1c9ec
Github actions
Jul 1, 2025
04e9681
Updated README.md
Jul 1, 2025
1dd8e44
Merge branch 'docker' into nexa
Jul 1, 2025
3a8662c
Create DEB package with goreleaser
Jul 2, 2025
4315291
Updated README.md
Jul 2, 2025
150a90c
Removed old build scripts
Jul 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text eol=lf
*.png binary
13 changes: 0 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,3 @@ jobs:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: 'release: Trigger mtrossbach/hassio-addons build'
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
run: |
TAG=${GITHUB_REF#refs/*/}
echo "Triggering with tag '$TAG'"
curl \
-X POST \
-H "Authorization: token ${{ secrets.WORKFLOW_PAT }}" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/mtrossbach/hassio-addons/dispatches \
--data "{\"event_type\": \"release\", \"client_payload\": { \"version\": \"${TAG:1}\"}}"
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ go.work
go.work.sum
.idea
dist
/noah-mqtt
/nexa-mqtt

build/
tmp/
cmd/nexa-mqtt/__debug_bin*
65 changes: 49 additions & 16 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
project_name: noah-mqtt
project_name: nexa-mqtt
version: 2

before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
Expand All @@ -13,11 +16,13 @@ builds:
- darwin_arm64
- windows_amd64
- windows_arm64
main: ./cmd/noah-mqtt
main: ./cmd/nexa-mqtt

archives:
- files:
- LICENSE
- passwd

checksum:
name_template: 'checksums.txt'

Expand All @@ -29,18 +34,19 @@ dockers:
- --platform=linux/arm64/v8
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/mtrossbach/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/mtrossbach/{{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/mgerczuk/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/mgerczuk/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=Apache-2.0
image_templates:
- &arm64v8_image "ghcr.io/mtrossbach/{{ .ProjectName }}:{{ .Version }}-arm64v8"
- &arm64v8_image "ghcr.io/mgerczuk/{{ .ProjectName }}:{{ .Version }}-arm64v8"
extra_files:
- LICENSE
- passwd
dockerfile: Dockerfile_goreleaser

- use: buildx
goos: linux
goarch: arm
Expand All @@ -49,51 +55,78 @@ dockers:
- --platform=linux/arm/v6
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/mtrossbach/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/mtrossbach/{{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/mgerczuk/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/mgerczuk/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=Apache-2.0
image_templates:
- &armv6_image "ghcr.io/mtrossbach/{{ .ProjectName }}:{{ .Version }}-armv6"
- &armv6_image "ghcr.io/mgerczuk/{{ .ProjectName }}:{{ .Version }}-armv6"
extra_files:
- LICENSE
- passwd
dockerfile: Dockerfile_goreleaser

- use: buildx
goos: linux
goarch: amd64
build_flag_templates:
- --platform=linux/amd64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/mtrossbach/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/mtrossbach/{{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/mgerczuk/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/mgerczuk/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=Apache-2.0
image_templates:
- &amd64_image "ghcr.io/mtrossbach/{{ .ProjectName }}:{{ .Version }}-amd64"
- &amd64_image "ghcr.io/mgerczuk/{{ .ProjectName }}:{{ .Version }}-amd64"
extra_files:
- LICENSE
- passwd
dockerfile: Dockerfile_goreleaser

docker_manifests:
- name_template: "ghcr.io/mtrossbach/{{ .ProjectName }}:{{ .Version }}"
- name_template: "ghcr.io/mgerczuk/{{ .ProjectName }}:{{ .Version }}"
image_templates:
- *arm64v8_image
- *armv6_image
- *amd64_image
- name_template: "ghcr.io/mtrossbach/{{ .ProjectName }}:latest"
- name_template: "ghcr.io/mgerczuk/{{ .ProjectName }}:latest"
image_templates:
- *arm64v8_image
- *armv6_image
- *amd64_image


nfpms:
- id: default
package_name: nexa-mqtt
vendor: Martin Gerczuk
homepage: https://github.com/mgerczuk/nexa-mqtt
maintainer: Martin Gerczuk <martin@mgsoftware.de>
description: NEXA 2000 MQTT Publisher
license: Apache-2.0
formats:
- deb
bindir: /usr/bin
contents:
- src: ./package/etc/systemd/system/nexa-mqtt.service
dst: /etc/systemd/system/nexa-mqtt.service
- src: ./package/etc/systemd/system/nexa-mqtt.service.d/override.conf
dst: /etc/systemd/system/nexa-mqtt.service.d/override.conf
type: config|noreplace
scripts:
postinstall: ./package/DEBIAN/postinst
preremove: ./package/DEBIAN/prerm
postremove: ./package/DEBIAN/postrm
deb:
scripts:
templates: ./package/DEBIAN/templates

release:
github:
owner: mtrossbach
name: noah-mqtt
owner: mgerczuk
name: nexa-mqtt
draft: false
25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch main",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "cmd/nexa-mqtt/main.go",
"env": {
"GROWATT_USERNAME": "nexa_user",
"GROWATT_PASSWORD": "secret",
"MQTT_HOST": "localhost",
"GROWATT_API_MODE": "web+app",
"MQTT_TOPIC_PREFIX": "nexa_test",
"POLLING_INTERVAL": "30",
"GROWATT_SERVER_URL_WEB": "http://localhost:8080",
"GROWATT_SERVER_URL_APP": "http://localhost:8081"
}
}
]
}
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Dockerfile for local build
# Alpine image to build
FROM alpine:latest AS builder

Expand All @@ -13,17 +14,18 @@ RUN go mod download

# Build the application
COPY . .
RUN go build -o noah-mqtt cmd/noah-mqtt/main.go
ENV CGO_ENABLED=0
RUN go build -o nexa-mqtt cmd/nexa-mqtt/main.go

# scratch image to run
FROM scratch

# Copy built binaries
COPY --from=builder /app/noah-mqtt /noah-mqtt
COPY --from=builder /app/nexa-mqtt /nexa-mqtt
COPY LICENSE /
COPY passwd /etc/passwd
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

# Set permissions and entry point
USER gouser
ENTRYPOINT ["/noah-mqtt"]
ENTRYPOINT ["/nexa-mqtt"]
4 changes: 2 additions & 2 deletions Dockerfile_goreleaser
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM alpine AS builder

FROM scratch
COPY noah-mqtt /
COPY nexa-mqtt /
COPY LICENSE /
COPY passwd /etc/passwd
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
USER gouser
ENTRYPOINT ["/noah-mqtt"]
ENTRYPOINT ["/nexa-mqtt"]
Loading