Skip to content

Commit

Permalink
grrr
Browse files Browse the repository at this point in the history
Bump v0.0.37
  • Loading branch information
patrick-dmxc committed Mar 20, 2023
1 parent 3c5fa31 commit 6d2c4ea
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion NanoleafAPI/API/Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public double RefreshRate

#pragma warning disable CS8618
[JsonConstructor]
public Controller(string ip, string port, string? auth_token = null): this(ip,port, true, auth_token)
public Controller(string ip, string port, string? auth_token): this(ip,port, true, auth_token)
{
}

Expand Down
2 changes: 1 addition & 1 deletion NanoleafAPI/NanoleafAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Version>0.0.36</Version>
<Version>0.0.37</Version>
<RepositoryUrl>https://github.com/patrick-dmxc/NanoleafAPI</RepositoryUrl>
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
<PackageTags>Nanoleaf Light-Panels Canvas Shapes Essentials Elemants Lines API SmartHome</PackageTags>
Expand Down
16 changes: 15 additions & 1 deletion NanoleafAPI_Tests/ControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,19 @@ public async Task TestControlerJSON()

Controller des= JsonSerializer.Deserialize<Controller>(json)!;
}

[Test]
public async Task TestControlerJSONDeserialize()
{
string jsonControllers = "[{\"IP\":\"192.168.10.152\",\"Port\":\"16021\",\"Auth_token\":\"wwS6B8Meg3O2AlLXhBym9yVHPuPgKGvW\",\"Name\":\"Canvas C097\",\"Model\":\"NL29\",\"Manufacturer\":\"Nanoleaf\",\"SerialNumber\":\"S19124C8036\",\"HardwareVersion\":\"2.0-4\",\"FirmwareVersion\":\"7.1.0\",\"DeviceType\":2,\"NumberOfPanels\":9,\"GlobalOrientation\":0,\"GlobalOrientationStored\":0,\"GlobalOrientationMin\":0,\"GlobalOrientationMax\":360,\"EffectList\":[\"*ExtControl*\",\"Color Burst333\",\"DancingTiles\",\"Dynamic 26-4-2021 20:32\",\"EDM Strobe\",\"Electric Chill\",\"Energize\",\"Falling Whites\",\"Fireworks\",\"Flames\",\"Forest\",\"Inner Peace\",\"Magic Strobe\",\"Meteor Shower\",\"Nemo\",\"Northern Lights\",\"Paint Splatter\",\"Pulse Pop Beats\",\"Radial Sound Bar\",\"Red Beat\",\"Red Meteor\",\"Rhythmic Northern Lights\",\"Romantic\",\"Shooting Stars\",\"Soda\",\"Sound Bar\",\"Streaking Notes\",\"Strobe\",\"Sub 49 Strobe Fireworks\",\"Super Strobe\",\"Thunder\",\"Vader\",\"eeee\",\"\\u661F\\u591CStarry Night\"],\"SelectedEffect\":\"*ExtControl*\",\"SelectedEffectStored\":\"Northern Lights\",\"PowerOn\":true,\"PowerOff\":false,\"PowerOnStored\":true,\"Reachable\":true,\"StreamingStarted\":true,\"Brightness\":100,\"BrightnessStored\":100,\"BrightnessMin\":0,\"BrightnessMax\":100,\"Hue\":0,\"HueStored\":0,\"HueMin\":0,\"HueMax\":360,\"Saturation\":0,\"SaturationStored\":0,\"SaturationMin\":0,\"SaturationMax\":100,\"ColorTemprature\":5000,\"ColorTempratureStored\":5000,\"ColorTempratureMin\":1200,\"ColorTempratureMax\":6500,\"ColorMode\":\"effect\",\"ColorModeStored\":\"effect\",\"Panels\":[{\"IP\":\"192.168.10.152\",\"ID\":47583,\"X\":600,\"Y\":0,\"Orientation\":0,\"Shape\":3,\"StreamingColor\":{},\"LastUpdate\":0,\"SideLength\":100},{\"IP\":\"192.168.10.152\",\"ID\":35641,\"X\":500,\"Y\":0,\"Orientation\":270,\"Shape\":2,\"StreamingColor\":{},\"LastUpdate\":0,\"SideLength\":100},{\"IP\":\"192.168.10.152\",\"ID\":12783,\"X\":400,\"Y\":0,\"Orientation\":270,\"Shape\":2,\"StreamingColor\":{},\"LastUpdate\":0,\"SideLength\":100},{\"IP\":\"192.168.10.152\",\"ID\":43562,\"X\":300,\"Y\":0,\"Orientation\":270,\"Shape\":2,\"StreamingColor\":{},\"LastUpdate\":0,\"SideLength\":100},{\"IP\":\"192.168.10.152\",\"ID\":30232,\"X\":200,\"Y\":0,\"Orientation\":270,\"Shape\":2,\"StreamingColor\":{},\"LastUpdate\":0,\"SideLength\":100},{\"IP\":\"192.168.10.152\",\"ID\":5439,\"X\":100,\"Y\":0,\"Orientation\":270,\"Shape\":2,\"StreamingColor\":{},\"LastUpdate\":0,\"SideLength\":100},{\"IP\":\"192.168.10.152\",\"ID\":24381,\"X\":0,\"Y\":0,\"Orientation\":270,\"Shape\":2,\"StreamingColor\":{},\"LastUpdate\":0,\"SideLength\":100},{\"IP\":\"192.168.10.152\",\"ID\":65307,\"X\":0,\"Y\":0,\"Orientation\":270,\"Shape\":2,\"StreamingColor\":{},\"LastUpdate\":0,\"SideLength\":100},{\"IP\":\"192.168.10.152\",\"ID\":42857,\"X\":250,\"Y\":0,\"Orientation\":90,\"Shape\":2,\"StreamingColor\":{},\"LastUpdate\":0,\"SideLength\":100}],\"RefreshRate\":44}]";

var objControllers = JsonSerializer.Deserialize<IReadOnlyList<Controller>>(jsonControllers);
Assert.Pass(jsonControllers);
}
[Test]
public async Task TestControlerWithoutToken()
{
Controller c = new Controller(IP, PORT);
Controller c = new Controller(IP, PORT, true);
await Task.Delay(6000);
Assert.Multiple(() =>
{
Expand All @@ -69,7 +78,12 @@ public async Task TestControlerWithoutToken()
Assert.That(c.Manufacturer, Is.EqualTo("Nanoleaf"), "Manufacturer");
});
await Task.Delay(6000);
Assert.That(c.StreamingStarted, Is.False, "Stream");
await c.StartStreaming();
Assert.That(c.StreamingStarted, Is.True, "Stream");

foreach (var panel in c.Panels)
panel.StreamingColor = new RGBW(255, 0, 255);
}
}
}

0 comments on commit 6d2c4ea

Please sign in to comment.