-
-
Save kunal732/c96427c82a886c9f4899 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Meteor.isClient) { | |
} | |
if (Meteor.isServer) { | |
Meteor.startup(function () { | |
// code to run on server at startup | |
Meteor.Router.add({ | |
'/apartment': function() { | |
post = this.request.body; | |
console.log(post); | |
color = post.subject; | |
if(color.toLowerCase() == "on") { | |
Meteor.http.call('PUT','http://192.168.1.7/api/newdeveloper/lights/1/state', {data: {"on": true}}) | |
Meteor.http.call('PUT','http://192.168.1.7/api/newdeveloper/lights/2/state', {data: {"on": true}}) | |
Meteor.http.call('PUT','http://192.168.1.7/api/newdeveloper/lights/3/state', {data: {"on": true}}) | |
} | |
else if(color.toLowerCase() == "off") { | |
Meteor.http.call('PUT','http://192.168.1.7/api/newdeveloper/lights/1/state', {data: {"on": false}}) | |
Meteor.http.call('PUT','http://192.168.1.7/api/newdeveloper/lights/2/state', {data: {"on": false}}) | |
Meteor.http.call('PUT','http://192.168.1.7/api/newdeveloper/lights/3/state', {data: {"on": false}}) | |
}else { | |
color = parseFloat(color); | |
console.log(Meteor.http.call('PUT','http://192.168.1.7/api/newdeveloper/lights/2/state', {data: {"hue": color}})); | |
Meteor.http.call('PUT','http://192.168.1.7/api/newdeveloper/lights/1/state', {data: {"hue": color}}) | |
Meteor.http.call('PUT','http://192.168.1.7/api/newdeveloper/lights/3/state', {data: {"hue": color}}) | |
} | |
return [200, "Success"] } | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment