Compare commits
141 Commits
add-networ
...
v1.7.11
| Author | SHA1 | Date | |
|---|---|---|---|
| a6d42086a7 | |||
| 35c97c45d6 | |||
| ff6c893b84 | |||
| 30ab208c1b | |||
| ac744a76e3 | |||
| 582260f918 | |||
| bebb06254c | |||
| a151cab3a8 | |||
| 3f98fc33d4 | |||
| 1bf75e3791 | |||
| d6f4ac9a12 | |||
| 423b291203 | |||
| 642ea750bb | |||
| 31f7d5aaaa | |||
| 90cf8c55cf | |||
| 48f508dee3 | |||
| 499c6d50da | |||
| 49e3d56b1c | |||
|
|
a0ae1ab14e | ||
| 068dcdb5d6 | |||
| 1cf67d139b | |||
| 5e1b586f01 | |||
| e0da9b110e | |||
| 9d4a95ad6a | |||
| 385c1d88d8 | |||
| bcba93d333 | |||
| 8e6130d919 | |||
|
|
f918d64ea7 | ||
| 51f73368f1 | |||
| 6489f3d01a | |||
| 24f6984021 | |||
| dbef7acec2 | |||
|
|
04dd0e76cb | ||
| 08069d61d1 | |||
| 9ce6bb5798 | |||
| 2944dff3e2 | |||
| 56384db94f | |||
| 472b3b299c | |||
| 83790754f7 | |||
| 5c1882a067 | |||
| 18de343fc5 | |||
| 988f36194c | |||
| 30b97f27f0 | |||
| e2e01ab72a | |||
| 64806b5c57 | |||
| 20b84aa56d | |||
| 4041346e45 | |||
| db2a632c3b | |||
| 48e17c1c1c | |||
| 81683091a7 | |||
| 7fee43ae4c | |||
| 0ff6915de4 | |||
| eb89414dc4 | |||
| 490d84d47a | |||
| 8cc9a078b6 | |||
| 4b9699a100 | |||
| ff03988c19 | |||
| 49d843cf1e | |||
| 716aa84792 | |||
| 6e176eb3e1 | |||
| 95ed67b399 | |||
| 429ae78f77 | |||
| f2cc305dc1 | |||
| b8f66b8f6a | |||
| effa72b1dc | |||
| 8116bb499d | |||
| 4d721d8c3a | |||
| 1d498866b5 | |||
| 916cf6c939 | |||
| a5450163d5 | |||
| 0f16e4ffcc | |||
|
|
89f7296f9f | ||
| 1ce3e0ab47 | |||
| f1d9d9123f | |||
|
|
4f96d02e79 | ||
|
|
0a9626cdfa | ||
| 1af8a83a83 | |||
| af1af22cc4 | |||
| 703d89eeac | |||
| 9c652b4c57 | |||
| d95b0f3390 | |||
|
|
9c8d437bd3 | ||
|
|
0704476ee7 | ||
| be40ee48b3 | |||
| 521c18c6b3 | |||
| e9ec14eb2e | |||
|
|
c52fc328c8 | ||
|
|
c2f99cc99f | ||
| 6d71c0487d | |||
| 37d35ca158 | |||
|
|
e422a78734 | ||
|
|
288311b2ad | ||
| 288d67b2ab | |||
|
|
13006b80a3 | ||
| 1c53fe26eb | |||
| 9a0ff2fa07 | |||
| ee7a861f9d | |||
| 60a272a042 | |||
|
|
90d2a2ce64 | ||
| fa5ba06f9c | |||
|
|
0484e9ec6e | ||
| 89b3048d0e | |||
| 6bcc6936f3 | |||
|
|
3fd737651d | ||
|
|
c4d6357154 | ||
| b2c68b7624 | |||
|
|
1e148cb395 | ||
| b810a58c8b | |||
|
|
833e42f78b | ||
| 8b31b70f00 | |||
| c22f8003db | |||
| c919b5de36 | |||
|
|
27e3a515d7 | ||
| d40e077dd1 | |||
|
|
02d8b752d5 | ||
| 0ab4fe1e6b | |||
| 85eb35443f | |||
|
|
02faa494bd | ||
| 0aa5abf687 | |||
| 0d0d79f8e6 | |||
| 8d2db8617d | |||
|
|
259b759991 | ||
| 01d415b1ef | |||
| 418eea6f1a | |||
| 58a827b1aa | |||
|
|
adb4cb6060 | ||
| 13cb51706b | |||
| e83a7bbfae | |||
|
|
49a8693fc0 | ||
| b143379f20 | |||
|
|
534a8b805e | ||
| de1d073c6d | |||
| d3e34871aa | |||
| 3e8aead632 | |||
| 9498554758 | |||
| c2167d5d97 | |||
| 6eb2d0145e | |||
| b1ca0497b0 | |||
| 589fb4fcf7 | |||
| 51213c51e0 | |||
| da20bbe045 |
30
.gitea/workflows/publish.yaml
Normal file
30
.gitea/workflows/publish.yaml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
name: Build and publish Image
|
||||||
|
run-name: ${{ gitea.actor }} is building py-eagle-mqtt image
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '*' # matches every branch that doesn't contain a '/'
|
||||||
|
- '*/*' # matches every branch containing a single '/'
|
||||||
|
- '**' # matches every branch
|
||||||
|
- '!master' # excludes master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Docker
|
||||||
|
run: curl -fsSL https://get.docker.com | sh
|
||||||
|
|
||||||
|
- name: Build Docker image
|
||||||
|
run: docker build -t harbor.evanshome.io/library/py-eagle-mqtt:dev ./Docker/
|
||||||
|
|
||||||
|
- name: Login to Harbor
|
||||||
|
run: docker login -u ${{ secrets.HARBOR_USERNAME }} -p ${{ secrets.HARBOR_PASSWORD }} harbor.evanshome.io
|
||||||
|
|
||||||
|
- name: Push Docker image to Harbor
|
||||||
|
run: docker push harbor.evanshome.io/library/py-eagle-mqtt:dev
|
||||||
|
|
||||||
61
.gitea/workflows/semantic-release.yaml
Normal file
61
.gitea/workflows/semantic-release.yaml
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
name: Semantic Release and Changelog
|
||||||
|
run-name: ${{ gitea.actor }} is running Semantic Release
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Patch:
|
||||||
|
name: Patch
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: '0'
|
||||||
|
- name: Minor version for each merge
|
||||||
|
id: taggerDryRun
|
||||||
|
uses: anothrNick/github-tag-action@1.67.0
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.REPO_PUSH_TOKEN }}
|
||||||
|
WITH_V: true
|
||||||
|
DRY_RUN: true
|
||||||
|
|
||||||
|
- name: echo new tag
|
||||||
|
run: |
|
||||||
|
echo "The next tag version will be: ${{ steps.taggerDryRun.outputs.new_tag }}"
|
||||||
|
- name: echo tag
|
||||||
|
run: |
|
||||||
|
echo "The current tag is: ${{ steps.taggerDryRun.outputs.tag }}"
|
||||||
|
- name: echo part
|
||||||
|
run: |
|
||||||
|
echo "The version increment was: ${{ steps.taggerDryRun.outputs.part }}"
|
||||||
|
|
||||||
|
Build-and-Publish:
|
||||||
|
name: Build and Publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Docker
|
||||||
|
run: curl -fsSL https://get.docker.com | sh
|
||||||
|
|
||||||
|
- name: Build Docker image
|
||||||
|
run: docker build -t harbor.evanshome.io/library/py-eagle-mqtt:latest ./Docker/
|
||||||
|
|
||||||
|
- name: Minor version for each merge
|
||||||
|
id: taggerFinal
|
||||||
|
uses: anothrNick/github-tag-action@1.67.0
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.REPO_PUSH_TOKEN }}
|
||||||
|
WITH_V: true
|
||||||
|
|
||||||
|
- name: tag with name
|
||||||
|
run: docker tag harbor.evanshome.io/library/py-eagle-mqtt:latest harbor.evanshome.io/library/py-eagle-mqtt:${{ steps.taggerFinal.outputs.new_tag }}
|
||||||
|
|
||||||
|
- name: Login to Harbor
|
||||||
|
run: docker login -u ${{ secrets.HARBOR_USERNAME }} -p ${{ secrets.HARBOR_PASSWORD }} harbor.evanshome.io
|
||||||
|
|
||||||
|
- name: Push Docker image to Harbor
|
||||||
|
run: docker push --all-tags harbor.evanshome.io/library/py-eagle-mqtt
|
||||||
124
.gitlab-ci.yml
124
.gitlab-ci.yml
@@ -4,74 +4,34 @@
|
|||||||
# See https://docs.gitlab.com/ee/ci/variables/#priority-of-environment-variables
|
# See https://docs.gitlab.com/ee/ci/variables/#priority-of-environment-variables
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
#- test
|
||||||
- build
|
- build
|
||||||
- push_local
|
|
||||||
- release
|
- release
|
||||||
- push_dockerhub
|
- push_local
|
||||||
|
##- push_dockerhub
|
||||||
.docker_base:
|
|
||||||
image: docker:18.09.7-dind
|
|
||||||
services:
|
|
||||||
- docker:18.09.7-dind
|
|
||||||
variables:
|
|
||||||
DOCKER_DRIVER: overlay
|
|
||||||
DOCKER_HOST: tcp://localhost:2375/
|
|
||||||
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
|
|
||||||
FF_GITLAB_REGISTRY_HELPER_IMAGE: 1
|
|
||||||
before_script:
|
|
||||||
- docker version
|
|
||||||
- docker info
|
|
||||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
extends:
|
image: docker:24.0.7-dind
|
||||||
- .docker_base
|
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
|
||||||
- docker pull $CI_REGISTRY_IMAGE:latest || true
|
|
||||||
- >
|
|
||||||
docker build
|
|
||||||
--pull
|
|
||||||
--cache-from $CI_REGISTRY_IMAGE:latest
|
|
||||||
--tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
|
||||||
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
|
||||||
--build-arg VCS_REF=$CI_COMMIT_SHORT_SHA
|
|
||||||
./Docker/
|
|
||||||
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
|
||||||
|
|
||||||
push local:
|
|
||||||
extends:
|
|
||||||
- .docker_base
|
|
||||||
stage: push_local
|
|
||||||
variables:
|
|
||||||
GIT_STRATEGY: none
|
|
||||||
only:
|
only:
|
||||||
- master
|
refs:
|
||||||
script:
|
- tags
|
||||||
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
- branches
|
||||||
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
|
services:
|
||||||
- docker push $CI_REGISTRY_IMAGE:latest
|
- name: docker:24.0.7-dind
|
||||||
|
command: ["--tls=false"]
|
||||||
push dockerhub:
|
|
||||||
extends:
|
|
||||||
- .docker_base
|
|
||||||
stage: push_dockerhub
|
|
||||||
variables:
|
variables:
|
||||||
GIT_STRATEGY: none
|
DOCKER_DRIVER: overlay2
|
||||||
CI_DOCKERHUB_IMAGE: index.docker.io/evanrich/py-eagle-mqtt
|
DOCKER_HOST: tcp://docker:2375
|
||||||
CI_DOCKERHUB_REGISTRY: docker.io
|
DOCKER_TLS_CERTDIR: ""
|
||||||
only:
|
FF_GITLAB_REGISTRY_HELPER_IMAGE: 1
|
||||||
- tags
|
|
||||||
script:
|
script:
|
||||||
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||||
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_DOCKERHUB_IMAGE:$CI_COMMIT_REF_NAME
|
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg VCS_REF=$CI_COMMIT_SHORT_SHA ./Docker/
|
||||||
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_DOCKERHUB_IMAGE:latest
|
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||||
- docker login -u "$CI_DOCKERHUB_USER" -p "$CI_DOCKERHUB_PASSWORD" $CI_DOCKERHUB_REGISTRY
|
|
||||||
- docker push $CI_DOCKERHUB_IMAGE
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
image: node:13
|
image: node:20.10.0-alpine3.18
|
||||||
stage: release
|
stage: release
|
||||||
only:
|
only:
|
||||||
refs:
|
refs:
|
||||||
@@ -81,32 +41,40 @@ release:
|
|||||||
- /^(([0-9]+)\.)?([0-9]+)\.x/
|
- /^(([0-9]+)\.)?([0-9]+)\.x/
|
||||||
# This matches pre-releases
|
# This matches pre-releases
|
||||||
- /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
|
- /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
|
||||||
|
except:
|
||||||
|
refs:
|
||||||
|
- tags
|
||||||
script:
|
script:
|
||||||
- touch CHANGELOG.md
|
- touch CHANGELOG.md
|
||||||
- npm install @semantic-release/gitlab @semantic-release/changelog @semantic-release/git
|
- apk add --no-cache git
|
||||||
|
- git config user.email "ci-bot@evanshome.io"
|
||||||
|
- git config user.name "ci-bot"
|
||||||
|
- npm install @semantic-release/gitlab@12.1.1 @semantic-release/changelog@6.0.3
|
||||||
|
@semantic-release/git@10.0.1 conventional-changelog-eslint@5.0.0
|
||||||
- npx semantic-release
|
- npx semantic-release
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- CHANGELOG.md
|
- CHANGELOG.md
|
||||||
|
|
||||||
sast:
|
push local:
|
||||||
stage: test
|
image: docker:24.0.7-dind
|
||||||
include:
|
stage: push_local
|
||||||
- template: Security/SAST.gitlab-ci.yml
|
services:
|
||||||
|
- name: docker:24.0.7-dind
|
||||||
sonarqube-check:
|
command: ["--tls=false"]
|
||||||
image:
|
|
||||||
name: sonarsource/sonar-scanner-cli:latest
|
|
||||||
entrypoint: [""]
|
|
||||||
variables:
|
variables:
|
||||||
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
|
DOCKER_DRIVER: overlay2
|
||||||
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
|
DOCKER_HOST: tcp://docker:2375
|
||||||
cache:
|
DOCKER_TLS_CERTDIR: ""
|
||||||
key: "${CI_JOB_NAME}"
|
GIT_STRATEGY: none
|
||||||
paths:
|
FF_GITLAB_REGISTRY_HELPER_IMAGE: 1
|
||||||
- .sonar/cache
|
|
||||||
script:
|
|
||||||
- sonar-scanner
|
|
||||||
allow_failure: true
|
|
||||||
only:
|
only:
|
||||||
- master # or the name of your main branch
|
- master
|
||||||
|
script:
|
||||||
|
- echo $CI_COMMIT_TAG
|
||||||
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||||
|
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||||
|
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
|
||||||
|
- docker push $CI_REGISTRY_IMAGE:latest
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,38 @@
|
|||||||
plugins:
|
plugins:
|
||||||
- "@semantic-release/commit-analyzer"
|
- - "@semantic-release/commit-analyzer"
|
||||||
- "@semantic-release/release-notes-generator"
|
- preset: eslint
|
||||||
|
releaseRules:
|
||||||
|
- tag: Breaking
|
||||||
|
release: major
|
||||||
|
- tag: Build
|
||||||
|
release: patch
|
||||||
|
- tag: Chore
|
||||||
|
release: minor
|
||||||
|
- tag: Fix
|
||||||
|
release: patch
|
||||||
|
- tag: New
|
||||||
|
release: minor
|
||||||
|
- tag: Update
|
||||||
|
release: minor
|
||||||
|
- tag: Upgrade
|
||||||
|
release: minor
|
||||||
|
- - "@semantic-release/release-notes-generator"
|
||||||
|
- preset: eslint
|
||||||
|
releaseRules:
|
||||||
|
- tag: Breaking
|
||||||
|
release: major
|
||||||
|
- tag: Build
|
||||||
|
release: patch
|
||||||
|
- tag: Chore
|
||||||
|
release: minor
|
||||||
|
- tag: Fix
|
||||||
|
release: patch
|
||||||
|
- tag: New
|
||||||
|
release: minor
|
||||||
|
- tag: Update
|
||||||
|
release: minor
|
||||||
|
- tag: Upgrade
|
||||||
|
release: minor
|
||||||
- - "@semantic-release/changelog"
|
- - "@semantic-release/changelog"
|
||||||
- changelogFile: CHANGELOG.md
|
- changelogFile: CHANGELOG.md
|
||||||
- "@semantic-release/gitlab"
|
- "@semantic-release/gitlab"
|
||||||
|
|||||||
58
CHANGELOG.md
58
CHANGELOG.md
@@ -1,3 +1,61 @@
|
|||||||
|
## [1.7.10](https://gitlab.evanshome.io/erichardson/py-eagle-mqtt/compare/v1.7.9...v1.7.10) (2023-12-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
* fix build pipeline order ([1cf67d1](https://gitlab.evanshome.io/erichardson/py-eagle-mqtt/commit/1cf67d139b8ce3954a42afeeef49262c72d9b0a5))
|
||||||
|
|
||||||
|
### CI
|
||||||
|
|
||||||
|
* add branches to refs for building ([e0da9b1](https://gitlab.evanshome.io/erichardson/py-eagle-mqtt/commit/e0da9b110e69fc4f18f6588d297589ca71a27c08))
|
||||||
|
* Add push latest tag on master ([8e6130d](https://gitlab.evanshome.io/erichardson/py-eagle-mqtt/commit/8e6130d9195c19933054d9a4efbeeb3d025b5301))
|
||||||
|
* fix ordering of stages ([385c1d8](https://gitlab.evanshome.io/erichardson/py-eagle-mqtt/commit/385c1d88d85e64591fd0d3814111a7e335ea45f8))
|
||||||
|
|
||||||
|
## [1.7.9](https://gitlab.evanshome.io/erichardson/py-eagle-mqtt/compare/v1.7.8...v1.7.9) (2023-12-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
* bump docker base to python:3.12-alpine ([6489f3d](https://gitlab.evanshome.io/erichardson/py-eagle-mqtt/commit/6489f3d01a71fba8e1a4ac35de2b0bffdf2529bd))
|
||||||
|
|
||||||
|
## [1.7.8](https://gitlab.evanshome.io/erichardson/py-eagle-mqtt/compare/v1.7.7...v1.7.8) (2023-12-03)
|
||||||
|
|
||||||
|
|
||||||
|
### ci
|
||||||
|
|
||||||
|
* fix semantic versioning and docker push to local registry ([9ce6bb5](https://gitlab.evanshome.io/erichardson/py-eagle-mqtt/commit/9ce6bb579847fba7fd31cc7ece4bcbb0661247b8))
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
* semantic versioning and docker push to local registry ([08069d6](https://gitlab.evanshome.io/erichardson/py-eagle-mqtt/commit/08069d61d135eff8c2ee5b210279589c4e4eed8f))
|
||||||
|
|
||||||
|
## [1.7.6](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/compare/v1.7.5...v1.7.6) (2021-05-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
* Change docker driver to overlay2 ([13cb517](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/commit/13cb51706b97f25486f62dd6985903e834d28ee2))
|
||||||
|
|
||||||
|
## [1.7.5](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/compare/v1.7.4...v1.7.5) (2021-05-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
* push all tags instead of just latest ([b143379](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/commit/b143379f2018f410677a9646234e7b483d9277d3))
|
||||||
|
|
||||||
|
## [1.7.4](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/compare/v1.7.3...v1.7.4) (2021-05-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
* cleanup long install line ([de1d073](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/commit/de1d073c6daf5d43fb7d9b7dafddd3b0cbcffc9b))
|
||||||
|
|
||||||
|
### ci
|
||||||
|
|
||||||
|
* Add git to node image ([6eb2d01](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/commit/6eb2d0145eff50c3243a364d821e769ae2ee06c9))
|
||||||
|
* change semantic release image to alpine to save space, updated to node 16 ([b1ca049](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/commit/b1ca0497b0b51e0c50ca1e5f99e5c8abd4224d53))
|
||||||
|
* Update DinD base to 20.10.6 and semantic release to node:15. Also pin sonar-scanner-cli to 4.6 ([589fb4f](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/commit/589fb4fcf7841d3c5f08327d7fb5d5c107562ed6))
|
||||||
|
|
||||||
## [1.7.3](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/compare/v1.7.2...v1.7.3) (2021-04-12)
|
## [1.7.3](https://gitlab.evanrichardsonphotography.com/erichardson/py-eagle-mqtt/compare/v1.7.2...v1.7.3) (2021-04-12)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.9.4-alpine3.13
|
FROM python:3.12-alpine
|
||||||
LABEL maintainer="Evan Richardson (evanrich81[at]gmail.com)"
|
LABEL maintainer="Evan Richardson (evanrich81[at]gmail.com)"
|
||||||
|
|
||||||
ARG BUILD_DATE
|
ARG BUILD_DATE
|
||||||
@@ -18,6 +18,7 @@ COPY requirements.txt /app
|
|||||||
COPY ./src/conf/logrotate/tHome /etc/logrotate.d/
|
COPY ./src/conf/logrotate/tHome /etc/logrotate.d/
|
||||||
ENV PYTHONPATH=/app/src/python
|
ENV PYTHONPATH=/app/src/python
|
||||||
RUN apk --update add --no-cache logrotate \
|
RUN apk --update add --no-cache logrotate \
|
||||||
|
&& apk upgrade \
|
||||||
&& pip3 install --no-cache-dir --upgrade pip \
|
&& pip3 install --no-cache-dir --upgrade pip \
|
||||||
&& pip3 install --no-cache-dir -r requirements.txt
|
&& pip3 install --no-cache-dir -r requirements.txt
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
paho-mqtt==1.5.1
|
paho-mqtt==1.6.1
|
||||||
bottle==0.12.19
|
bottle==0.12.25
|
||||||
defusedxml==0.7.1
|
defusedxml==0.7.1
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# ===========================================================================
|
#===========================================================================
|
||||||
#
|
#
|
||||||
# Eagle posting server
|
# Eagle posting server
|
||||||
#
|
#
|
||||||
# ===========================================================================
|
#===========================================================================
|
||||||
|
|
||||||
__doc__ = """
|
__doc__ = """
|
||||||
Starts a small web server. The Rain Forest Eagle is configured with
|
Starts a small web server. The Rain Forest Eagle is configured with
|
||||||
@@ -22,116 +22,100 @@ import json
|
|||||||
import bottle as B
|
import bottle as B
|
||||||
import tHome as T
|
import tHome as T
|
||||||
|
|
||||||
|
#===========================================================================
|
||||||
|
def meter( client, data, cfg ):
|
||||||
|
msg = {
|
||||||
|
"time" : data.TimeUnix,
|
||||||
|
"consumed" : data.Consumed, # kWh
|
||||||
|
"produced" : data.Produced, # kWh
|
||||||
|
}
|
||||||
|
|
||||||
# ===========================================================================
|
return ( cfg.mqttEnergy, msg )
|
||||||
def meter(client, data, cfg):
|
|
||||||
msg = {
|
|
||||||
"time": data.TimeUnix,
|
|
||||||
"consumed": data.Consumed, # kWh
|
|
||||||
"produced": data.Produced, # kWh
|
|
||||||
}
|
|
||||||
|
|
||||||
return cfg.mqttEnergy, msg
|
#===========================================================================
|
||||||
|
def instant( client, data, cfg ):
|
||||||
|
msg = {
|
||||||
|
"time" : data.TimeUnix,
|
||||||
|
"power" : data.Power * 1000, # W
|
||||||
|
}
|
||||||
|
|
||||||
|
return ( cfg.mqttPower, msg )
|
||||||
|
|
||||||
|
#===========================================================================
|
||||||
|
def price( client, data, cfg ):
|
||||||
|
msg = {
|
||||||
|
"time" : data.TimeUnix,
|
||||||
|
"price" : data.Price,
|
||||||
|
"tier" : data.Tier,
|
||||||
|
}
|
||||||
|
return ( cfg.mqttPrice, msg )
|
||||||
|
|
||||||
# ===========================================================================
|
#===========================================================================
|
||||||
def instant(client, data, cfg):
|
|
||||||
msg = {
|
|
||||||
"time": data.TimeUnix,
|
|
||||||
"power": data.Power * 1000, # W
|
|
||||||
}
|
|
||||||
|
|
||||||
return cfg.mqttPower, msg
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
def price(client, data, cfg):
|
|
||||||
msg = {
|
|
||||||
"time": data.TimeUnix,
|
|
||||||
"price": data.Price,
|
|
||||||
"tier": data.Tier,
|
|
||||||
}
|
|
||||||
return cfg.mqttPrice, msg
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
def network(client, data, cfg):
|
|
||||||
msg = {
|
|
||||||
"status": data.Status,
|
|
||||||
"description": data.Description,
|
|
||||||
"linkstrength": data.LinkStrength
|
|
||||||
}
|
|
||||||
return cfg.mqttNetwork, msg
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
handlers = {
|
handlers = {
|
||||||
# "BlockPriceDetail" :
|
#"BlockPriceDetail" :
|
||||||
"CurrentSummation": meter,
|
"CurrentSummation" : meter,
|
||||||
# "DeviceInfo" :
|
#"DeviceInfo" :
|
||||||
# "FastPollStatus" :
|
#"FastPollStatus" :
|
||||||
"InstantaneousDemand": instant,
|
"InstantaneousDemand" : instant,
|
||||||
# "MessageCluster" :
|
#"MessageCluster" :
|
||||||
# "MeterInfo" :
|
#"MeterInfo" :
|
||||||
"NetworkInfo": network,
|
#"NetworkInfo" :
|
||||||
"PriceCluster": price,
|
"PriceCluster" : price,
|
||||||
# "Reading" :
|
#"Reading" :
|
||||||
# "ScheduleInfo" :
|
#"ScheduleInfo" :
|
||||||
# "TimeCluster" :
|
#"TimeCluster" :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#===========================================================================
|
||||||
|
|
||||||
# ===========================================================================
|
@B.post( '/' )
|
||||||
|
|
||||||
@B.post('/')
|
|
||||||
def root_post():
|
def root_post():
|
||||||
data = B.request.body.read(B.request.content_length)
|
data = B.request.body.read( B.request.content_length )
|
||||||
try:
|
try:
|
||||||
obj = T.eagle.parse(data)
|
obj = T.eagle.parse( data )
|
||||||
except:
|
except:
|
||||||
log.exception("Error parsing Eagle posted data")
|
log.exception( "Error parsing Eagle posted data" )
|
||||||
return "ERROR"
|
return "ERROR"
|
||||||
|
|
||||||
log.info("Read packet: %s" % obj.name)
|
log.info( "Read packet: %s" % obj.name )
|
||||||
|
|
||||||
|
func = handlers.get( obj.name, None )
|
||||||
|
if func:
|
||||||
|
topic, msg = func( client, obj, cfg )
|
||||||
|
if msg:
|
||||||
|
log.info( "Publish: %s: %s" % ( topic, msg ) )
|
||||||
|
|
||||||
|
payload = json.dumps( msg )
|
||||||
|
client.publish( topic, payload )
|
||||||
|
|
||||||
func = handlers.get(obj.name, None)
|
return "ok"
|
||||||
if func:
|
|
||||||
topic, msg = func(client, obj, cfg)
|
|
||||||
if msg:
|
|
||||||
log.info("Publish: %s: %s" % (topic, msg))
|
|
||||||
|
|
||||||
payload = json.dumps(msg)
|
#===========================================================================
|
||||||
client.publish(topic, payload)
|
|
||||||
|
|
||||||
return "ok"
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
#
|
#
|
||||||
# Main applications script
|
# Main applications script
|
||||||
#
|
#
|
||||||
# ===========================================================================
|
#===========================================================================
|
||||||
|
|
||||||
p = argparse.ArgumentParser(prog=sys.argv[0],
|
p = argparse.ArgumentParser( prog=sys.argv[0],
|
||||||
description="T-Home Eagle Server")
|
description="T-Home Eagle Server" )
|
||||||
p.add_argument("-c", "--configDir", metavar="configDir",
|
p.add_argument( "-c", "--configDir", metavar="configDir",
|
||||||
default="/etc/tHome",
|
default="/etc/tHome",
|
||||||
help="Configuration file directory.")
|
help="Configuration file directory." )
|
||||||
p.add_argument("-l", "--log", metavar="logFile",
|
p.add_argument( "-l", "--log", metavar="logFile",
|
||||||
default=None, help="Logging file to use. Input 'stdout' "
|
default=None, help="Logging file to use. Input 'stdout' "
|
||||||
"to log to the screen.")
|
"to log to the screen." )
|
||||||
c = p.parse_args(sys.argv[1:])
|
c = p.parse_args( sys.argv[1:] )
|
||||||
|
|
||||||
# Parse the eagle config file.
|
# Parse the eagle config file.
|
||||||
cfg = T.eagle.config.parse(c.configDir)
|
cfg = T.eagle.config.parse( c.configDir )
|
||||||
log = T.eagle.config.log(cfg, c.log)
|
log = T.eagle.config.log( cfg, c.log )
|
||||||
|
|
||||||
# Create the MQTT client and connect it to the broker.
|
# Create the MQTT client and connect it to the broker.
|
||||||
client = T.broker.connect(c.configDir, log)
|
client = T.broker.connect( c.configDir, log )
|
||||||
|
|
||||||
# Start the MQTT as a background thread. This way we can run the web
|
# Start the MQTT as a background thread. This way we can run the web
|
||||||
# server as the main thread here.
|
# server as the main thread here.
|
||||||
client.loop_start()
|
client.loop_start()
|
||||||
|
|
||||||
log.info("Starting web server at port %d" % cfg.httpPort)
|
log.info( "Starting web server at port %d" % cfg.httpPort )
|
||||||
B.run(host='0.0.0.0', port=cfg.httpPort, quiet=True)
|
B.run( host='0.0.0.0', port=cfg.httpPort, quiet=True )
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ mqttPrice = 'power/elec/Home/price'
|
|||||||
#Current rate label (returns rate label from meter)
|
#Current rate label (returns rate label from meter)
|
||||||
mqttRateLabel = 'power/elec/Home/ratelabel'
|
mqttRateLabel = 'power/elec/Home/ratelabel'
|
||||||
|
|
||||||
#Network Info Topic (returns status, description and link strength from meter)
|
|
||||||
mqttNetwork = 'power/elec/Home/network'
|
|
||||||
|
|
||||||
#===========================================================================
|
#===========================================================================
|
||||||
#
|
#
|
||||||
# Logging configuration. Env variables are allowed in the file name.
|
# Logging configuration. Env variables are allowed in the file name.
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
# Arbitrary file importing utility. Does NOT modify sys.modules
|
# Arbitrary file importing utility. Does NOT modify sys.modules
|
||||||
#
|
#
|
||||||
#===========================================================================
|
#===========================================================================
|
||||||
import imp
|
#import importlib
|
||||||
import os
|
import os
|
||||||
|
import types
|
||||||
|
|
||||||
def fimport( filePath ):
|
def fimport( filePath ):
|
||||||
# Read the file and compile the code. This will fail if the file
|
# Read the file and compile the code. This will fail if the file
|
||||||
@@ -19,7 +20,7 @@ def fimport( filePath ):
|
|||||||
rootName, ext = os.path.splitext( fileName )
|
rootName, ext = os.path.splitext( fileName )
|
||||||
|
|
||||||
# Create a new module and exec the code in it's context.
|
# Create a new module and exec the code in it's context.
|
||||||
m = imp.new_module( rootName )
|
m = types.ModuleType( rootName )
|
||||||
m.__file__ = absPath
|
m.__file__ = absPath
|
||||||
exec(code, m.__dict__)
|
exec(code, m.__dict__)
|
||||||
|
|
||||||
|
|||||||
12
renovate.json
Normal file
12
renovate.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"config:base",
|
||||||
|
":semanticCommits"
|
||||||
|
],
|
||||||
|
"prConcurrentLimit": 5,
|
||||||
|
"labels": [
|
||||||
|
"upgrade",
|
||||||
|
"bot"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user