Anonymous Anonymous - 3 months ago
135 0

No description

Javascript

JSON hue

/*
Light 4 = office

*/

function sendJSON(url, light, msg) {
	$.ajax({
	  type: 'PUT',
	  url: url + '/lights/' + light + '/state',
	  data: msg,
	  contentType: "application/json; charset=utf-8",
	  success: function (data) {
		console.log(data);
	  }
	});
}

$(document).ready(function() {

    var bridgeAPI = "http://192.168.1.30/api";
    var userName = "ZlwKkPK8TM9mMTuG865wptd8oSMqu9w4dAb5Z8p6";
    var rootUrl = bridgeAPI + "/" + userName;
    var message = '{"on": false }';
	sendJSON(rootUrl, 4, message);
	
});