Browse Source

Add temperature to API.

feature-colorvalue2 3.4.1
Stian Fredrik Aune 3 years ago
parent
commit
8c9b47aa1d
  1. 1
      cmd/lucy/handlercmd.go
  2. 4
      models/device.go

1
cmd/lucy/handlercmd.go

@ -157,6 +157,7 @@ func applyCmdToHandler(model models.EventHandler, cmd Command) models.EventHandl
model.Actions.SetPower = nds.Power
model.Actions.SetColor = nds.Color
model.Actions.SetIntensity = nds.Intensity
model.Actions.SetTemperature = nds.Temperature
// Add intensity
model.Actions.AddIntensity = cmd.Params.Get("add-intensity").Float()

4
models/device.go

@ -198,6 +198,10 @@ func (d *Device) SetState(newState NewDeviceState) error {
d.State.Intensity = *newState.Intensity
}
if newState.Temperature != nil && d.HasCapability(DCTemperatureControl) {
d.State.Temperature = *newState.Temperature
}
return nil
}

Loading…
Cancel
Save