HTTP REQUEST to control LED

I’m trying to build a status monitor that will turn on a specific LED based on the value returned from a web server. I’m having trouble getting the value into the planner from my web server. I have tried the JSON response I found in the httpapi documentation and examples from other posts without luck.

Webpage return:
{"STRING":40.0,"RESPONSE":"Saturation"}

Here is my code attempt:
`
// Input from web service
class plannerIn extends InputPort
{
name = “dsIn”
type = “string”

function set(_httpIn)
{
server.log(“httpIn:”+_httpIn);
}
}
local _dsIn = plannerIn();

// Register with the server
imp.configure(“StringIN”, [_dsIn], []);
server.log(“getting value from webpage”);
server.show(“getting value from webpage”);
`

HTTP REQUEST is set to “GET” and “application/json”.

Here is a screenshot of my planner:

How can I get the above sting value (in this case “40.0”) into the planner so I can write my if statement to control the LEDs?

You need to add an OutputPort to your code, and use that to initiate the request:
local request = OutputPort("http-request") request.set(0)
Connect this output port to the HTTP Request node in your plan.

@dwatts
Everyone is on pins and needles in anticipation of the new agents, which are currently in beta testing. They will give us the ability to do all of the back and forth between imp and remote server without using the planner.

But until that happens, you’ll keep plugging away with the node vimps on your planner.

I’m not really sure by your post if your imp is patiently waiting for your website to send it some information, or would you rather have your imp post to your PHP script and request that the PHP script give it some info periodically.

You could actually do both if you wanted.

Can you explain more about the website or web server? What info you are expecting, and is it some PHP server-side scripting you are dealing with?