Compare commits

...

3 Commits

Author SHA1 Message Date
57c635b1e0 drop scan
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-11-11 17:20:38 +01:00
c5150b1b4f configuration 2024-11-11 17:20:13 +01:00
abc0ad0825 some more attributes
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2024-11-11 17:19:04 +01:00
3 changed files with 16 additions and 11 deletions

View File

@ -14,13 +14,6 @@ steps:
when: when:
- event: [push, tag] - event: [push, tag]
scan_image:
image: aquasec/trivy
commands:
- trivy image $FORGE_NAME/$CI_REPO:$CI_COMMIT_SHA --quiet --exit-code 1
when:
- event: [push, tag]
deploy: deploy:
image: portainer/kubectl-shell:latest image: portainer/kubectl-shell:latest
secrets: secrets:

View File

@ -119,6 +119,16 @@
} }
} }
}, },
{
"topics": [ "zigbee2mqtt/+" ],
"handler": "Z2M",
"id": "Z2M",
"config": {
"databaseConnStr": "",
"attributes": {
}
}
},
{ {
"topics": [ "shellyplusht/+/status/temperature:0" ], "topics": [ "shellyplusht/+/status/temperature:0" ],
"handler": "SVEJ", "handler": "SVEJ",

View File

@ -19,7 +19,7 @@ type Z2MHandler struct {
dbh *database.DatabaseHandle dbh *database.DatabaseHandle
} }
func parse(T any, payload string, variables *map[string]database.VariableType, attributes *map[string]interface{}) error { func parse(T any, payload string, variables *map[string]database.VariableType) error {
observationType := reflect.TypeOf(T) observationType := reflect.TypeOf(T)
observation := reflect.New(observationType).Interface() observation := reflect.New(observationType).Interface()
@ -44,7 +44,6 @@ func parse(T any, payload string, variables *map[string]database.VariableType, a
} }
} }
(*attributes)["Status"] = "ok"
return nil return nil
} }
@ -90,12 +89,15 @@ func (self *Z2MHandler) Handle(message handler.MessageT) {
measurement.Attributes = make(map[string]interface{}) measurement.Attributes = make(map[string]interface{})
err3 := parse(T, err3 := parse(T,
message.Payload, message.Payload,
&(measurement.Values), &(measurement.Values))
&(measurement.Attributes))
if err3 != nil { if err3 != nil {
self.Lost("Model parser failed", err3, message) self.Lost("Model parser failed", err3, message)
return return
} }
measurement.Attributes["Status"] = "ok"
measurement.Attributes["DeviceId"] = deviceId
measurement.Attributes["DeviceModel"] = device.DeviceType.ModelIdentifier
log.Printf("Prepared measurement item: %s", measurement) log.Printf("Prepared measurement item: %s", measurement)
self.dbh.StoreMeasurement(&measurement) self.dbh.StoreMeasurement(&measurement)
self.S() self.S()