Locxion / NanoTwitchLeafs

Nanotwitchleafs was originaly build to let your Twitch Chat play with your Nanoleaf Lights with simple Chat Commands. First Commit made 09.01.2019 it evolved in a Connection between Twitch and the real World.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

User Color Trigger not working

Locxion opened this issue · comments

Happens on Random Users.
Got Logfile from Twitch User SugarTiddays:
Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object. at NanoTwitchLeafs.Controller.TriggerLogicController.<SendColorToSinglePanel>d__36.MoveNext() in D:\Eigene Daten\Dokumente\Git\Locxion\NanoTwitchLeafs\Controller\TriggerLogicController.cs:line 606 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NanoTwitchLeafs.Controller.TriggerLogicController.<<RunQueueHandler>b__22_0>d.MoveNext() in D:\Eigene Daten\Dokumente\Git\Locxion\NanoTwitchLeafs\Controller\TriggerLogicController.cs:line 225

private async Task SendColorToSinglePanel(Color color, int brightness)
{
foreach (var device in _appSettings.NanoSettings.NanoLeafDevices)
{
var random = new Random();
var randomIndex = random.Next(1, device.NanoleafControllerInfo.panelLayout.layout.numPanels);
var panelId = device.NanoleafControllerInfo.panelLayout.layout.positionData[randomIndex - 1]
.panelId;
_logger.Debug($"Set Panel with ID: {panelId} to Color #{color.Name} on Device {device.PublicName}");
await _nanoController.SetPanelColor(device, panelId, color.R, color.G, color.B, color.A);
await _nanoController.SetBrightness(device, brightness);
}
}

@Silverdark @Revyn112 any of you 2 an idea? cant really reproduce it on my End.
Could it be that in Devices there is a invalid Object that throws this Error?
I used the Debug Commands earlier in the same Stream of Her and there is no Error in sending Commands to the Device List

Still present Issue ... its definitely something with the Device ... i added some Warning Messages to catch Null values from the Device Information