Skip to content

@kunal732 /hookjs secret

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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
Something went wrong with that request. Please try again.