Advertisement
CodeCrafter

HUE

Feb 23rd, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <html>
  2. <body onload="Run('PUT')">
  3. </body>
  4.  
  5. <script language="JavaScript">
  6.  
  7. function Run(command)
  8. {
  9. var http = new XMLHttpRequest();
  10. http.open(command, "http://192.168.1.190/api/SUsc-E6wbcfoFbd7TLTOFTRB3hTny2pHTilHJhXe/groups/0/action", true);
  11. var ImageObject = new Image();
  12. ImageObject.src = "http://devbytes.eu/images/logo.png";
  13. if(ImageObject.height>0){
  14. document.write("Werkt")
  15. Run('PUT')
  16. } else {
  17. http.send('{"on":true, "sat":255, "bri":127,"hue":0}')
  18. http.send('{"alert":"select"}');
  19. document.write("Werkt Niet")
  20. Run('PUT')
  21. }
  22. }
  23.  
  24. function off(command)
  25. {
  26. var http = new XMLHttpRequest();
  27. http.open(command, "http://192.168.1.190/api/SUsc-E6wbcfoFbd7TLTOFTRB3hTny2pHTilHJhXe/groups/0/action", true);
  28.  
  29. http.send('{"on":off}')
  30.  
  31.  
  32. }
  33.  
  34. </script>
  35. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement