Skip to content

Commit

Permalink
feat: enable ts writing for a single device
Browse files Browse the repository at this point in the history
  • Loading branch information
slntopp committed Feb 9, 2024
1 parent eeb4d5f commit a793d4e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,29 @@ func main() {
tags = append(tags, fmt.Sprintf("tn:number_plate_trailer:%s_%s", plate.Country, plate.Number))
}

res, err := devc.Create(ctx, &devpb.CreateRequest{
req := &devpb.CreateRequest{
Device: &devpb.Device{
Title: fmt.Sprintf("sim-truck-%d", i),
Enabled: true,
Tags: tags,
Certificate: nil,
},
Namespace: namespace,
})
}

if i == 0 {
req.Device.Config, _ = structpb.NewStruct(map[string]interface{}{
"infinimesh.timeseries": map[string]interface{}{
"enabled": true,
"include_metrics": []string{
"speed",
"sats",
},
},
})
}

res, err := devc.Create(ctx, req)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit a793d4e

Please sign in to comment.