diff --git a/services/mill/wifi.go b/services/mill/wifi.go index 33f4db8..8194667 100644 --- a/services/mill/wifi.go +++ b/services/mill/wifi.go @@ -20,7 +20,8 @@ type WifiBridge struct { ID string IP string - state *device.State + state *device.State + desiredState device.State mx sync.Mutex started bool @@ -36,6 +37,8 @@ func (w *WifiBridge) SetState(id string, state device.State) bool { return false } + w.desiredState = state + return true } @@ -93,9 +96,7 @@ func (w *WifiBridge) refresh() error { }) } - w.state.Temperature = gentools.Ptr(*w.state.Temperature - math.Mod(*w.state.Temperature, 0.5)) - - if math.Abs(temp-*w.state.Temperature) >= 0.1 { + if w.desiredState.Temperature != nil && math.Abs(temp-*w.desiredState.Temperature) >= 0.1 { if err := w.writeTemperature(); err != nil { return err }