You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a UI app similar to the old GUI application which works with the .Net Standard library.
I have added 2 buttons:
button which will turn all lights on: private async void button1_Click(object sender, EventArgs e) { foreach (var device in _devices) { if (device.DeviceType == DeviceType.Light) await _tradfriController.DeviceController.SetLight(device, true); } }
_devices is my List instance with all devices, retrieved with tradfriController.GatewayController.GetDeviceObjects
button which will turn the lights on using the group (I only have 1 group with 4 lights): await _tradfriController.GroupController.SetLight(_group, true);
Button 1 only turns the last light (of 4 lights) on (or off).
Button 2 does not turn a light on/off at all.
So, I tried to turn the lights on/off individually. I have tried to call await _tradfriController.DeviceController.SetLight(xx, true); for all 4 light device ID's, but it does not matter which ID I pass to the SetLight method, it always turns on/off the last light.
I think this is really strange behavior, so I analyzed my code a bit more and I also added the ObserveDevice method calls on the DeviceController property of the tradfriController instance. When I removed these method call, all lights and groups are correctly turned on/off.
So there is some strange behavior with the ObserveDevice method.
Does anyone have an idea what the problem is?
Thanks,
Danny
P.s. I am using a copy of the Tradfri project, where I set the CoapClient property of the TradfriController to public, so I am able to use this property for the ObserveDevice method call.
The text was updated successfully, but these errors were encountered:
I was able to create a workaround by creating a 2nd instance of the TradfriController which I use for observing the devices. It works but in my opinion the library should handle this.
Hi,
I have created a UI app similar to the old GUI application which works with the .Net Standard library.
I have added 2 buttons:
private async void button1_Click(object sender, EventArgs e) { foreach (var device in _devices) { if (device.DeviceType == DeviceType.Light) await _tradfriController.DeviceController.SetLight(device, true); } }
_devices is my List instance with all devices, retrieved with
tradfriController.GatewayController.GetDeviceObjects
await _tradfriController.GroupController.SetLight(_group, true);
Button 1 only turns the last light (of 4 lights) on (or off).
Button 2 does not turn a light on/off at all.
So, I tried to turn the lights on/off individually. I have tried to call await
_tradfriController.DeviceController.SetLight(xx, true);
for all 4 light device ID's, but it does not matter which ID I pass to the SetLight method, it always turns on/off the last light.I think this is really strange behavior, so I analyzed my code a bit more and I also added the ObserveDevice method calls on the DeviceController property of the tradfriController instance. When I removed these method call, all lights and groups are correctly turned on/off.
So there is some strange behavior with the ObserveDevice method.
Does anyone have an idea what the problem is?
Thanks,
Danny
P.s. I am using a copy of the Tradfri project, where I set the CoapClient property of the TradfriController to public, so I am able to use this property for the ObserveDevice method call.
The text was updated successfully, but these errors were encountered: