voltage hack
All checks were successful
ci/woodpecker/tag/woodpecker Pipeline was successful

This commit is contained in:
2025-12-22 18:50:59 +01:00
parent 3b69e1e2af
commit a78c6952f0
2 changed files with 15 additions and 9 deletions

View File

@@ -1,3 +1,7 @@
when:
- event: tag
steps: steps:
build: build:
image: golang:1.22.5-alpine3.20 image: golang:1.22.5-alpine3.20
@@ -7,8 +11,6 @@ steps:
- go mod tidy - go mod tidy
- go build -a -installsuffix nocgo -o udi main.go - go build -a -installsuffix nocgo -o udi main.go
- cp udi ../.. - cp udi ../..
when:
- event: [push, tag]
scan: scan:
image: quay.io/wollud1969/woodpecker-helper:0.5.1 image: quay.io/wollud1969/woodpecker-helper:0.5.1
@@ -43,8 +45,6 @@ steps:
-F "projectVersion=$TAG" \ -F "projectVersion=$TAG" \
-F "bom=@/tmp/sbom.xml"\ -F "bom=@/tmp/sbom.xml"\
"$DTRACK_API_URL/api/v1/bom" "$DTRACK_API_URL/api/v1/bom"
when:
- event: [push, tag]
dockerize: dockerize:
image: plugins/kaniko image: plugins/kaniko
@@ -58,8 +58,6 @@ steps:
password: password:
from_secret: local_password from_secret: local_password
dockerfile: Dockerfile dockerfile: Dockerfile
when:
- event: tag
deploy: deploy:
image: quay.io/wollud1969/k8s-admin-helper:0.4.1 image: quay.io/wollud1969/k8s-admin-helper:0.4.1
@@ -73,5 +71,3 @@ steps:
- printf "$KUBE_CONFIG_CONTENT" > /tmp/kubeconfig - printf "$KUBE_CONFIG_CONTENT" > /tmp/kubeconfig
- export KUBECONFIG=/tmp/kubeconfig - export KUBECONFIG=/tmp/kubeconfig
- ./deployment/deploy.sh - ./deployment/deploy.sh
when:
- event: tag

View File

@@ -74,12 +74,22 @@ func (self *Mbgw3Handler) Handle(message handler.MessageT) {
measurement.Values = make(map[string]database.VariableType) measurement.Values = make(map[string]database.VariableType)
unitMap := map[string]string { "Energy": "Wh", "Power": "W", "Voltage": "V", "Current": "A", "Volume": "m3" } unitMap := map[string]string { "Energy": "Wh", "Power": "W", "Voltage": "V", "Current": "A", "Volume": "m3" }
keyCount := make(map[string]int)
for k, v := range observation.Values { for k, v := range observation.Values {
unit, exists := unitMap[k] unit, exists := unitMap[k]
if ! exists { if ! exists {
unit = "Unmapped Unit" unit = "Unmapped Unit"
} }
measurement.Values[k] = database.VariableType {
// Check if key already exists and create unique key if needed
keyCount[k]++
uniqueKey := k
if keyCount[k] > 1 {
uniqueKey = k + strconv.Itoa(keyCount[k])
}
measurement.Values[uniqueKey] = database.VariableType {
Label: "", Label: "",
Variable: k, Variable: k,
Unit: unit, Unit: unit,