Compare commits
3 Commits
b6a7447cb3
...
0.0.62
Author | SHA1 | Date | |
---|---|---|---|
57c635b1e0
|
|||
c5150b1b4f
|
|||
abc0ad0825
|
@ -14,13 +14,6 @@ steps:
|
||||
when:
|
||||
- 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:
|
||||
image: portainer/kubectl-shell:latest
|
||||
secrets:
|
||||
|
@ -119,6 +119,16 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"topics": [ "zigbee2mqtt/+" ],
|
||||
"handler": "Z2M",
|
||||
"id": "Z2M",
|
||||
"config": {
|
||||
"databaseConnStr": "",
|
||||
"attributes": {
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"topics": [ "shellyplusht/+/status/temperature:0" ],
|
||||
"handler": "SVEJ",
|
||||
|
@ -19,7 +19,7 @@ type Z2MHandler struct {
|
||||
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)
|
||||
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
|
||||
}
|
||||
@ -90,12 +89,15 @@ func (self *Z2MHandler) Handle(message handler.MessageT) {
|
||||
measurement.Attributes = make(map[string]interface{})
|
||||
err3 := parse(T,
|
||||
message.Payload,
|
||||
&(measurement.Values),
|
||||
&(measurement.Attributes))
|
||||
&(measurement.Values))
|
||||
if err3 != nil {
|
||||
self.Lost("Model parser failed", err3, message)
|
||||
return
|
||||
}
|
||||
|
||||
measurement.Attributes["Status"] = "ok"
|
||||
measurement.Attributes["DeviceId"] = deviceId
|
||||
measurement.Attributes["DeviceModel"] = device.DeviceType.ModelIdentifier
|
||||
log.Printf("Prepared measurement item: %s", measurement)
|
||||
self.dbh.StoreMeasurement(&measurement)
|
||||
self.S()
|
||||
|
Reference in New Issue
Block a user