diff --git a/GoveeCSharpConnector/GoveeCSharpConnector.csproj b/GoveeCSharpConnector/GoveeCSharpConnector.csproj index 52052ff..f947e04 100644 --- a/GoveeCSharpConnector/GoveeCSharpConnector.csproj +++ b/GoveeCSharpConnector/GoveeCSharpConnector.csproj @@ -12,7 +12,7 @@ https://github.com/Locxion/GoveeCSharpConnector https://github.com/Locxion/GoveeCSharpConnector https://github.com/Locxion/GoveeCSharpConnector/blob/main/LICENSE - 1.1.0 + 1.1.1 diff --git a/GoveeCSharpConnector/Services/GoveeService.cs b/GoveeCSharpConnector/Services/GoveeService.cs index 7a0c046..949c89f 100644 --- a/GoveeCSharpConnector/Services/GoveeService.cs +++ b/GoveeCSharpConnector/Services/GoveeService.cs @@ -18,6 +18,7 @@ public class GoveeService : IGoveeService public async Task> GetDevices(bool onlyLan = true) { if (string.IsNullOrWhiteSpace(GoveeApiKey)) throw new Exception("No Govee Api Key Set!"); + _apiService.SetApiKey(GoveeApiKey); var apiDevices = await _apiService.GetDevices(); var devices = apiDevices.Select(apiDevice => new GoveeDevice() { DeviceId = apiDevice.DeviceId, DeviceName = apiDevice.DeviceName, Model = apiDevice.Model, Address = "onlyAvailableOnUdpRequest" }).ToList(); if (!onlyLan) @@ -46,6 +47,7 @@ public class GoveeService : IGoveeService return new GoveeState() { State = udpState.onOff, Brightness = udpState.brightness, Color = udpState.color, ColorTempInKelvin = udpState.colorTempInKelvin }; } if (string.IsNullOrWhiteSpace(GoveeApiKey)) throw new Exception("No Govee Api Key Set!"); + _apiService.SetApiKey(GoveeApiKey); var apiState = await _apiService.GetDeviceState(goveeDevice.DeviceId, goveeDevice.Model); return new GoveeState{State = apiState.Properties.PowerState, Brightness = apiState.Properties.Brightness, Color = apiState.Properties.Color, ColorTempInKelvin = apiState.Properties.ColorTemp}; } @@ -59,6 +61,7 @@ public class GoveeService : IGoveeService return; } if (string.IsNullOrWhiteSpace(GoveeApiKey)) throw new Exception("No Govee Api Key Set!"); + _apiService.SetApiKey(GoveeApiKey); await _apiService.ToggleState(goveeDevice.DeviceId, goveeDevice.Model, on); } @@ -71,6 +74,7 @@ public class GoveeService : IGoveeService return; } if (string.IsNullOrWhiteSpace(GoveeApiKey)) throw new Exception("No Govee Api Key Set!"); + _apiService.SetApiKey(GoveeApiKey); await _apiService.SetBrightness(goveeDevice.DeviceId, goveeDevice.Model, value); } @@ -83,6 +87,7 @@ public class GoveeService : IGoveeService return; } if (string.IsNullOrWhiteSpace(GoveeApiKey)) throw new Exception("No Govee Api Key Set!"); + _apiService.SetApiKey(GoveeApiKey); await _apiService.SetColor(goveeDevice.DeviceId, goveeDevice.Model, color); } @@ -95,6 +100,7 @@ public class GoveeService : IGoveeService return; } if (string.IsNullOrWhiteSpace(GoveeApiKey)) throw new Exception("No Govee Api Key Set!"); + _apiService.SetApiKey(GoveeApiKey); await _apiService.SetColorTemp(goveeDevice.DeviceId, goveeDevice.Model, value); } } \ No newline at end of file