Beispiel #1
0
 public async Task TurnLightOff()
 {
     GatewayLight newState = new GatewayLight()
     {
         rgb          = 0,
         illumination = Illumination
     };
     await base.ChangeDeviceState(newState).ConfigureAwait(false);
 }
Beispiel #2
0
        public async Task TurnLightOn(byte r, byte g, byte b, int illumination)
        {
            var rgb = 0xFF000000 | r << 16 | g << 8 | b;

            if (illumination < 300 || illumination > 1300)
            {
                throw new ArgumentException("Illumination must be in range 300 - 1300");
            }

            GatewayLight newState = new GatewayLight()
            {
                rgb          = rgb,
                illumination = illumination
            };
            await base.ChangeDeviceState(newState).ConfigureAwait(false);
        }