Skip to content

Commit

Permalink
Support for Hub2000 (#48)
Browse files Browse the repository at this point in the history
* support new mqtt topic location

* subscribe to new homeUsage topic

* ensure conversion of float values for home usage

* have online hubs report to new mqtt topics (support multiple hubs)

* ensure float values properly cast to int

* ensure proper type cast (#37)

* type conversion

* type conversion

* type conversion

* convert temperature from Kelvin to Celsius

* conversion between kelvin and celsius

* conversion kelvin to celsius

* converting kelvin to celsius

* convert kelvin to celsius

* convert kelvin to celsius

* also subscribe to local HUB2k topics

* Update pipeline

* pipeline syntx error
  • Loading branch information
reinhard-brandstaedter authored Jun 17, 2024
1 parent 5eca24e commit cd5eb05
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pipeline {
}

environment {
//DOCKER_HOST = "tcp://docker.local:2375"
DOCKER_REGISTRY = "rbrandstaedter"
LOG_LEVEL = "INFO"
BUILD_NUMBER = "${BUILD_NUMBER}"
Expand All @@ -27,23 +28,28 @@ pipeline {
}
}
stage('Build Docker Images') {
environment {
BRANCH_NAME = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim()
TAG = "0.${BUILD_NUMBER}"
}
steps {
container('docker-buildx') {
sh 'printenv'
dir("${env.WORKSPACE}/src"){
sh label: 'Set up X-Builder', script: 'docker buildx create --name crossbuilder --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 && docker buildx ls && docker buildx use crossbuilder && docker buildx inspect --bootstrap'
sh label: 'Build solarflow-statuspage', script: 'docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -t ${DOCKER_REGISTRY}/solarflow-statuspage:${BRANCH_NAME} .'
sh label: 'Set up X-Builder', script: 'docker buildx create --name crossbuilder --platform linux/amd64,linux/arm64,linux/arm/v7 && docker buildx ls && docker buildx use crossbuilder && docker buildx inspect --bootstrap'
sh label: 'Build solarflow-statuspage', script: 'docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t ${DOCKER_REGISTRY}/solarflow-statuspage:${BRANCH_NAME} .'
}
script {
if (env.BRANCH_NAME == 'master') {
dir("${env.WORKSPACE}/src"){
sh label: 'Set up X-Builder', script: 'docker buildx create --name crossbuilder --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 && docker buildx ls && docker buildx use crossbuilder && docker buildx inspect --bootstrap'
sh label: 'Build solarflow-statuspage', script: 'docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -t ${DOCKER_REGISTRY}/solarflow-statuspage:${TAG} -t ${DOCKER_REGISTRY}/solarflow-statuspage:latest .'
sh label: 'Set up X-Builder', script: 'docker buildx rm crossbuilder && docker buildx create --name crossbuilder --platform linux/amd64,linux/arm/v7 && docker buildx ls && docker buildx use crossbuilder && docker buildx inspect --bootstrap'
sh label: 'Build solarflow-statuspage', script: 'docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t ${DOCKER_REGISTRY}/solarflow-statuspage:${TAG} -t ${DOCKER_REGISTRY}/solarflow-statuspage:latest .'
}
dir("${env.WORKSPACE}/imageexport") {
sh label: 'Github CLI install', script: 'apk add github-cli'
sh label: 'GitHub CLI login', script: 'echo ${GITHUB_AUTH_TOKEN} | gh auth login --with-token'
sh label: 'GitHub CLI status', script: 'gh auth status'
//sh label: 'Save docker images', script: 'docker save -o solarflow-statuspage-${TAG}.tar ${DOCKER_REGISTRY}/solarflow-statuspage:${TAG}'
sh label: 'git config', script: 'git config --global --add safe.directory /home/jenkins/agent/workspace/solarflow-statuspage-master'
sh label: 'Create Release', script: 'gh release create ${TAG} --generate-notes -t "Release ${TAG}"'
}
}
Expand All @@ -52,17 +58,21 @@ pipeline {
}
}
stage('Push Docker Images') {
environment {
BRANCH_NAME = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim()
TAG = "0.${BUILD_NUMBER}"
}
steps {
container('docker-buildx') {
sh label: 'Docker Login', script: 'docker login -u ${DOCKERHUB_LOGIN_USR} -p ${DOCKERHUB_LOGIN_PSW}'
dir("${env.WORKSPACE}/src") {
sh label: 'Push solarflow-statuspage', script: 'docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -q -t ${DOCKER_REGISTRY}/solarflow-statuspage:${BRANCH_NAME} .'
sh label: 'Push solarflow-statuspage', script: 'docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7 -q -t ${DOCKER_REGISTRY}/solarflow-statuspage:${BRANCH_NAME} .'
}
script {
if (env.BRANCH_NAME == 'master') {
dir("${env.WORKSPACE}/src"){
sh label: 'Push solarflow-statuspage', script: 'docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -q -t ${DOCKER_REGISTRY}/solarflow-statuspage:latest .'
sh label: 'Push solarflow-statuspage', script: 'docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -q -t ${DOCKER_REGISTRY}/solarflow-statuspage:${TAG} .'
sh label: 'Push solarflow-statuspage', script: 'docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7 -q -t ${DOCKER_REGISTRY}/solarflow-statuspage:latest .'
sh label: 'Push solarflow-statuspage', script: 'docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7 -q -t ${DOCKER_REGISTRY}/solarflow-statuspage:${TAG} .'
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/solarflow-status.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,12 @@ def local_subscribe(client: mqtt_client):
client.subscribe("solarflow-hub/+/telemetry/#")
client.subscribe("solarflow-hub/+/control/#")
client.subscribe("solarflow-hub/smartmeter/homeUsage")
client.subscribe("/73bkTV/+/properties/report")
client.subscribe("/73bkTV/+/log")
client.subscribe("iot/73bkTV/+/properties/write")
client.subscribe("/A8yh63/+/properties/report")
client.subscribe("/A8yh63/+/log")
client.subscribe("iot/A8yh63/+/properties/write")
client.subscribe(report_topic)
client.subscribe(log_topic)
client.subscribe(iot_topic)
Expand Down

0 comments on commit cd5eb05

Please sign in to comment.