From cd5eb05676552cdd5588b4f5412b312dfa97e470 Mon Sep 17 00:00:00 2001 From: "Reinhard Weber (Brandstaedter)" Date: Mon, 17 Jun 2024 20:33:39 +0200 Subject: [PATCH] Support for Hub2000 (#48) * 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 --- src/Jenkinsfile | 26 ++++++++++++++++++-------- src/solarflow-status.py | 6 ++++++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/Jenkinsfile b/src/Jenkinsfile index e0ea9fe..def96de 100644 --- a/src/Jenkinsfile +++ b/src/Jenkinsfile @@ -4,6 +4,7 @@ pipeline { } environment { + //DOCKER_HOST = "tcp://docker.local:2375" DOCKER_REGISTRY = "rbrandstaedter" LOG_LEVEL = "INFO" BUILD_NUMBER = "${BUILD_NUMBER}" @@ -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}"' } } @@ -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} .' } } } diff --git a/src/solarflow-status.py b/src/solarflow-status.py index 17287aa..3526c4f 100644 --- a/src/solarflow-status.py +++ b/src/solarflow-status.py @@ -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)