This commit is contained in:
Dawit Gulino 20013954
2018-05-31 16:00:00 +02:00
parent b79a7615d2
commit 2f5b7826d9
11 changed files with 252 additions and 90 deletions

View File

@@ -53,10 +53,18 @@ public class Hue {
}
}
public void setAttribute(String attribute, String value){
/*public void setAttribute(String attribute, String value){
for (String light : allLights.keySet()) {
String callURL = lightsURL + light + "/state";
String body = "{ \""+attribute+"\" : "+value+" }";
String body = "{ \"+attribute+\" : "+value+" }";
Rest.put(callURL, body, "application/json");
}
}*/
public void colorLoop() {
for (String light : allLights.keySet()) {
String callURL = lightsURL + light + "/state";
String body = "{ \"on\" : true, \"effect\" : \"colorloop\" }";
Rest.put(callURL, body, "application/json");
}
}

View File

@@ -11,7 +11,7 @@ public class TestLights {
//Hue lights = new Hue("http://localhost/api/newdeveloper/");
Hue lights = new Hue();
Set<String> toRemove = new HashSet<String>();
Set<String> toRemove = new HashSet<>();
for(String str: lights.getNameLights())
if(!str.equals("4"))
toRemove.add(str);
@@ -24,15 +24,15 @@ public class TestLights {
this.wait(0b1111101000); // 1000
}
lights.turnOn();
for(int i=0; i<256; i++) {
lights.setBrightness(i);
this.wait(10);
this.wait(2);
}
for(int i=256; i>=0; i--) {
lights.setBrightness(i);
this.wait(10);
}
lights.colorLoop();
this.wait(20);
lights.turnOff();
}
}