Add temperature to API.
continuous-integration/drone/push Build is passing

This commit is contained in:
Stian Fredrik Aune
2021-11-07 19:03:42 +01:00
parent 5bd7a7f6b6
commit 8c9b47aa1d
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -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
View File
@@ -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
}