Beispiel #1
0
 private void PostRequest(State state)
 {
     using (var client = new HttpClient())
     {
         client.BaseAddress = new Uri(string.Format("http://{0}/api/newdeveloper/lights/",BridgeIp));
         client.Timeout = new TimeSpan(0,0,5);
         foreach (int lamp in Lamps)
         {
             StringContent content = new StringContent(state.ToJson(), Encoding.UTF8, "application/json");
             client.PutAsync(string.Format("{0}/state",lamp),content).Wait();
         }
     }
 }
Beispiel #2
0
 public HueNotifier(string bridgeIp, List<int> lamps, State lampStateConfiguration = null)
 {
     BridgeIp = bridgeIp;
     Lamps = lamps;
     StateConfiguration = lampStateConfiguration ?? State.LightBlue;
 }