INNER CODE UNIT · Go
CreateDeviceEntityWorkers
joshuar/go-hass-agent · agent/entity_workers.go:16
func CreateDeviceEntityWorkers(ctx context.Context, restAPIURL string) []workers.EntityWorker {
var deviceWorkers []workers.EntityWorker
// Initialize and add connection latency sensor w.
if w, err := workers.NewConnectionLatencyWorker(ctx, restAPIURL); err != nil {
slogctx.FromCtx(ctx).Warn("Could not set up worker.",
slog.Any("error", err))
} else {
deviceWorkers = append(deviceWorkers, w)
}
// Initialize and add external IP address sensor workezr.
if w, err := workers.NewExternalIPWorker(ctx); err != nil {
slogctx.FromCtx(ctx).Warn("Could not init agent worker.",
slog.Any("error", err))
} else {
deviceWorkers = append(deviceWorkers, w)
}
// Initialize and add external version sensor w.