diff --git a/app/services/publisher/publisher.go b/app/services/publisher/publisher.go index 2b3f604..2550e84 100644 --- a/app/services/publisher/publisher.go +++ b/app/services/publisher/publisher.go @@ -177,6 +177,11 @@ func (p *Publisher) reassignDevice(device models.Device) bool { // Stop here, no scene should be assigned. return false + } else { + if p.sceneData[selectedAssignment.SceneID] == nil { + // Freeze until scene becomes available. + return false + } } if p.sceneAssignment[device.ID] != nil { diff --git a/internal/drivers/hue/state.go b/internal/drivers/hue/state.go index 288eaa0..588f4ae 100644 --- a/internal/drivers/hue/state.go +++ b/internal/drivers/hue/state.go @@ -122,6 +122,9 @@ func (state *hueSensorState) Update(newData SensorData) *models.Event { if time.Since(stateTime) > time.Second*3 { return nil } + if state.prevData == nil { + return nil + } pe := state.prevData.State.ButtonEvent ce := newData.State.ButtonEvent