Browse Source

fixed a rare hue driver crash on startup and crash if an event sets an invalid scene id.

pull/1/head
Gisle Aune 3 years ago
parent
commit
cdf5173503
  1. 5
      app/services/publisher/publisher.go
  2. 3
      internal/drivers/hue/state.go

5
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 {

3
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

Loading…
Cancel
Save