I am trying to setup a Control ON/OFF switch to start / stop logging to ubidots from my electric imp. On the electric imp I have my code setup to receive the message from ubidots. What I need help is on how to setup the button to send the request to electric imp.
function getUbiDotsPwrBtn(){
local headers = { "Content-Type": "GET", "X-Auth-Token": UBIDOTS_X_Auth_Token }; // Replace the token with yours
local url = "http://things.ubidots.com/api/v1.6/variables/<<YOUR VARIABLE>>/values/?page_size=1&token=<<YOUR TOKEN>>";
local request = http.get(url, headers);
local response = request.sendsync();
}
Hi James, sorry to hear you didn’t got an answer before, but thanks a lot for your contribution. We’re releasing an official MQTT broker this month, so instead of doing continuous GET requests you could leave an open connection and get a faster response. Will let you know when it’s up.