Version 1.1.0 (#3)

* Delete .gitignore

* Added Readme, Added Nuget Infos in Project

* Added GoveeService that unites Api and Udp Service

Added ColorTemp Method to Udp Service

* Added UdpListener check

* Added ApiKey check

* Moved Class and changed Namespace

* Update GoveeCSharpConnector.csproj
This commit is contained in:
Markus Bender
2024-02-03 00:57:33 +01:00
committed by GitHub
parent 602926c43e
commit bb01b3342d
10 changed files with 250 additions and 21 deletions

View File

@ -38,9 +38,9 @@ public class GoveeUdpService : IGoveeUdpService
try
{
// Build Message
var message = new GoveeUdpMessage()
var message = new GoveeUdpMessage
{
msg = new msg()
msg = new msg
{
cmd = "scan",
data = new { account_topic = "reserve" }
@ -76,9 +76,9 @@ public class GoveeUdpService : IGoveeUdpService
try
{
// Build Message
var message = new GoveeUdpMessage()
var message = new GoveeUdpMessage
{
msg = new msg()
msg = new msg
{
cmd = "devStatus",
data = new { }
@ -107,9 +107,9 @@ public class GoveeUdpService : IGoveeUdpService
try
{
// Build Message
var message = new GoveeUdpMessage()
var message = new GoveeUdpMessage
{
msg = new msg()
msg = new msg
{
cmd = "turn",
data = new { value = on ? 1 : 0 }
@ -131,9 +131,9 @@ public class GoveeUdpService : IGoveeUdpService
try
{
// Build Message
var message = new GoveeUdpMessage()
var message = new GoveeUdpMessage
{
msg = new msg()
msg = new msg
{
cmd = "brightness",
data = new { value = brightness }
@ -155,9 +155,9 @@ public class GoveeUdpService : IGoveeUdpService
try
{
// Build Message
var message = new GoveeUdpMessage()
var message = new GoveeUdpMessage
{
msg = new msg()
msg = new msg
{
cmd = "colorwc",
data = new
@ -173,7 +173,6 @@ public class GoveeUdpService : IGoveeUdpService
};
// Send Message
SendUdpMessage(JsonSerializer.Serialize(message), deviceAddress, uniCastPort);
}
catch (Exception e)
{
@ -181,6 +180,39 @@ public class GoveeUdpService : IGoveeUdpService
throw;
}
}
public async Task SetColorTemp(string deviceAddress, int colorTempInKelvin, int uniCastPort = 4003)
{
try
{
// Build Message
var message = new GoveeUdpMessage
{
msg = new msg
{
cmd = "colorwc",
data = new
{
color = new
{
r = 0,
g = 0,
b = 0
},
colorTempInKelvin = colorTempInKelvin
}
}
};
// Send Message
SendUdpMessage(JsonSerializer.Serialize(message), deviceAddress, uniCastPort);
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
}
/// <inheritdoc/>
public async void StartUdpListener()
{