Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
a78c6952f0
|
|||
|
3b69e1e2af
|
@@ -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
|
|
||||||
|
|||||||
@@ -146,3 +146,37 @@ create or replace view ntp_server_variables_v as
|
|||||||
from measurements
|
from measurements
|
||||||
where application = 'TSM' and device = '172.16.13.10';
|
where application = 'TSM' and device = '172.16.13.10';
|
||||||
|
|
||||||
|
|
||||||
|
-- Status string `unit:"" json:"status"`
|
||||||
|
-- Timestamp string `unit:"" json:"timestamp"`
|
||||||
|
-- VoltageL1 float32 `unit:"V" json:"voltageL1"`
|
||||||
|
-- VoltageL2 float32 `unit:"V" json:"voltageL2"`
|
||||||
|
-- VoltageL3 float32 `unit:"V" json:"voltageL3"`
|
||||||
|
-- CurrentL1 float32 `unit:"A" json:"currentL1"`
|
||||||
|
-- CurrentL2 float32 `unit:"A" json:"currentL2"`
|
||||||
|
-- CurrentL3 float32 `unit:"A" json:"currentL3"`
|
||||||
|
-- PowerL1 float32 `unit:"W" json:"powerL1"`
|
||||||
|
-- PowerL2 float32 `unit:"W" json:"powerL2"`
|
||||||
|
-- PowerL3 float32 `unit:"W" json:"powerL3"`
|
||||||
|
-- TotalImportEnergy float32 `unit:"Wh" json:"totalImportEnergy"`
|
||||||
|
-- TotalExportEnergy float32 `unit:"Wh" json:"totalExportEnergy"`
|
||||||
|
-- Cnt int `unit:"" json:"cnt"`
|
||||||
|
|
||||||
|
|
||||||
|
create or replace view car_values_v as
|
||||||
|
select time,
|
||||||
|
cast(values->'VoltageL1'->>'value' as float) as voltage_l1,
|
||||||
|
cast(values->'VoltageL2'->>'value' as float) as voltage_l2,
|
||||||
|
cast(values->'VoltageL3'->>'value' as float) as voltage_l3,
|
||||||
|
cast(values->'CurrentL1'->>'value' as float) as current_l1,
|
||||||
|
cast(values->'CurrentL2'->>'value' as float) as current_l2,
|
||||||
|
cast(values->'CurrentL3'->>'value' as float) as current_l3,
|
||||||
|
cast(values->'PowerL1'->>'value' as float) as power_l1,
|
||||||
|
cast(values->'PowerL2'->>'value' as float) as power_l2,
|
||||||
|
cast(values->'PowerL3'->>'value' as float) as power_l3,
|
||||||
|
cast(values->'TotalImportEnergy'->>'value' as float) as total_import_energy,
|
||||||
|
cast(values->'TotalExportEnergy'->>'value' as float) as total_export_energy,
|
||||||
|
values->'Status'->>'value' as status,
|
||||||
|
device
|
||||||
|
from measurements
|
||||||
|
where application = 'Car';
|
||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user