Esempio n. 1
0
		private async Task TestLifx()
		{
			// ***
			// *** Initialize the API
			// ***
			LifxApi api = new LifxApi("c1c1b8b4760452f88074f9457b728ce8b2c92f97cbabcd4dec6d7ccabd82011c");

			// ***
			// *** Validate a color
			// ***
			Color color = await api.ValidateColor("#ff0000");

			// ***
			// *** Lists the lights
			// ***
			IEnumerable<Light> lights = await api.ListLights(Selector.All);

			// ***
			// *** List the scenes
			// ***
			IEnumerable<Scene> sceneList = await api.ListScenes();

			// ***
			// *** Select a single light
			// ***			
			Light light = lights.Where(t => t.Label == "iWindow").SingleOrDefault();

			// ***
			// ***
			// ***
			Mix mix = new Mix()
			{
				States = new SentState[]
				{
					new SentState() { Brightness = 1, Color = "Red" },
					new SentState() { Brightness = 1, Color = "Green" },
					new SentState() { Brightness = 1, Color = "Blue" },
					new SentState() { Power = "off" }
				},
				Defaults = new SentState() { Power = "on", Duration = 1, }
			};

			await api.Cycle(light, mix);

			// ***
			// *** Create a list selector
			// ***
			ISelector items = Selector.CreateList(lights.ElementAt(0), lights.ElementAt(1));

			if (light != null)
			{
				await api.TogglePower(light, 3);
				await api.SetState(light, new SentState() { Power = "on", Duration = 2, Color = "#1fa1b2" });
			}
		}
Esempio n. 2
0
 public async Task <IEnumerable <OperationResult> > Set(Mix mix)
 {
     return(await this.Execute(mix));
 }
Esempio n. 3
0
 public async Task Cycle(ISelector selector, Mix mix)
 {
     Cycle api = new Cycle(this.Identity);
     await api.Set(selector, mix);
 }
Esempio n. 4
0
 public async Task SetStates(Mix mix)
 {
     SetStates api = new SetStates(this.Identity);
     await api.Set(mix);
 }
Esempio n. 5
0
		public async Task Cycle(ISelector selector, Mix mix)
		{
			Cycle api = new Cycle(this.Identity);
			await api.Set(selector, mix);
		}
Esempio n. 6
0
		public async Task SetStates(Mix mix)
		{
			SetStates api = new SetStates(this.Identity);
			await api.Set(mix);
		}