Beispiel #1
0
        private static async Task <int> RunLightOff(string deviceSpec)
        {
            var parsedSpec = DeviceSpec.Parse(deviceSpec);
            var bulb       = LightBulb.Create(parsedSpec.IPEndPoint, parsedSpec.MacAddress, service: 1);

            var client = await LifxClient.CreateAsync(new TraceLogger());

            await client.TurnBulbOffAsync(bulb, TimeSpan.FromMilliseconds(0));

            return(0);
        }
Beispiel #2
0
        private static async Task <int> RunGetDeviceLabel(string deviceSpec)
        {
            var parsedSpec = DeviceSpec.Parse(deviceSpec);
            // TODO: don't assume it's a bulb
            var device = LightBulb.Create(parsedSpec.IPEndPoint, parsedSpec.MacAddress, service: 1);

            var client = await LifxClient.CreateAsync(new TraceLogger());

            var result = await client.GetDeviceLabelAsync(device);

            Console.WriteLine(result);
            return(0);
        }
Beispiel #3
0
        private static async Task <int> RunGetDeviceVersion(string deviceSpec)
        {
            var parsedSpec = DeviceSpec.Parse(deviceSpec);
            // TODO: don't assume it's a bulb
            var device = LightBulb.Create(parsedSpec.IPEndPoint, parsedSpec.MacAddress, service: 1);

            var client = await LifxClient.CreateAsync(new TraceLogger());

            var versionTask         = client.GetDeviceVersionAsync(device);
            var firmwareVersionTask = client.GetDeviceHostFirmwareAsync(device);

            var version         = await versionTask;
            var firmwareVersion = await firmwareVersionTask;

            // TODO: look up values to something meaningful
            Console.WriteLine($"Vendor ID: {version.Vendor} Product ID: {version.Product} Version: {version.Version}");
            Console.WriteLine($"Firmware version {firmwareVersion.Version} (built at {firmwareVersion.Build})");

            return(0);
        }