Hello everyone,
I have a motion detector in the backyard and I would like to use a lamp in the living room as a movement notifier. This lamp is usually dimmed to 50%, so, what I want to do is to bright it to 100% when a movement is detected, pause 1 second and return it to the previous level.
The code below sometimes works, sometimes does not. As I'm pretty new to HG and C#, there should be a better way to do it.
Thanks
---------------------------------
var lamp = Modules.WithName("Test Lamp");
var level = lamp.Level;
if (lamp.IsOn)
{
lamp.Level = 100;
Pause(1);
lamp.Level = level;
}
// if lamp is off, do nothing
---------------------------------