This commit is contained in:
Mats Tornberg
2025-11-22 21:19:38 +01:00
parent 57ba34b929
commit b6343149c8
4 changed files with 213 additions and 91 deletions

View File

@@ -24,10 +24,14 @@ func (s *Syncer) SyncDevices() error {
for i := 0; i < numDevices; i++ {
deviceID := telldus.GetDeviceId(i)
name := telldus.GetName(deviceID)
protocol := telldus.GetProtocol(deviceID)
model := telldus.GetModel(deviceID)
device := &datastore.Device{
ID: deviceID,
Name: name,
UniqueID: fmt.Sprintf("telldus_device_%d", deviceID),
Protocol: protocol,
Model: model,
}
if err := s.store.UpsertDevice(device); err != nil {
log.Printf("Error upserting device %d: %v", deviceID, err)