Skip to content

Instantly share code, notes, and snippets.

@LuisFDuarte
Created August 5, 2014 16:45
Show Gist options
  • Save LuisFDuarte/a200eca4f58ceb4aa5f7 to your computer and use it in GitHub Desktop.
Save LuisFDuarte/a200eca4f58ceb4aa5f7 to your computer and use it in GitHub Desktop.
device.on("temp", function(value) {
server.log("Trying to post to Ubi the value:");
server.log(value);
local headers = { "Content-Type": "application/json", "X-Auth-Token": "NBbF3PWPxWc2IaO40aXOKnhIu8tOv92rYN3ibiEc7Jh6GV3KZUUCHtXuNz7Y" }; // Replace the token with yours
local url = "http://things.ubidots.com/api/v1.6/variables/53d2beb37625424630223dac/values"; // Replace the Variable ID with yours
local string = {"value": value};
local request = http.post(url, headers, http.jsonencode(string));
local response = request.sendsync();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment