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