Skip to content

Instantly share code, notes, and snippets.

@cmsunu28
Created December 8, 2020 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmsunu28/2cf8172ed4d9e11b7f32a1f71f8a6ace to your computer and use it in GitHub Desktop.
Save cmsunu28/2cf8172ed4d9e11b7f32a1f71f8a6ace to your computer and use it in GitHub Desktop.
imp001 impExplorer agent code: control an LED from the internet
// HTTP
function requestHandler(request,response) {
try {
server.log(http.jsonencode(request.query));
if ("led" in request.query) {
device.send("set.led",request.query.led);
}
response.send(200,"OK");
} catch (err) {
response.send(500,"ERROR: "+err);
}
}
http.onrequest(requestHandler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment