HTTP Request Get - Capture Response to more than one variable

I am just starting with Reactor and would like to convert my LUA code into Reactor sensors. I have successfully added a ‘Notify’ when my solar panels stop producing (RCD trip).

I also upload current temperature and solar live output to and would like to be notified when this upload fails.

I get the temperature from an API call to In the LUA code this returns two variables (wstatus and wresult).

local wurl = "<MyAPIKey>"
local wstatus,wresult = luup.inet.wget(wurl, 5)

I hoped I could migrate this to Reactor with HTTP Request Get. However I cannot see a way to get Reactor to accept the two returned variables?

If not possible, I could use the ‘Run LUA’ Activity to get the returned variables, but cannot see how to then use the variables as a condition to initiate a ‘Notify’ activity within the same Reactor sensor?

Any help gratefully received
Thanks Malcolm

Off topic, but I have to ask: does this happen often?

While you wait for @rigpapa to chime in, it occurs to me that his other plug-in, SiteSensor, might stand a better chance at satisfying your requirements. Its primary focus is on sending GET/POST requests and parsing multiple variables from the response.

I’m not saying Reactor can’t accomplish what you’re after, but it’s entirely possible that it is limited to a single variable assignment in this case. Not sure. Either way, it works great with SiteSensor, so I wanted to suggest you at least consider that alternative.

No, every few months.

Last time I did not notice for several days, hence my requirement for a ‘Notification’.

Sometimes there is a reason (power outage, lightning etc.), other times, no apparent cause.


Hmm, I’ve never seen that problem on my own system, but it might indeed be tough to notice…

…although I do continuously log the output, I may not look at it for a while.

You can use an HTTP Request action to load a variable with the JSON response, which will be a string at that point. The unstringify() function will convert it to a table, and from there, you make other expressions to extract the data from the table. You don’t need SiteSensor for this, but you certainly could do it that way.

See the documentation

1 Like

Thanks rigpapa, I didn’t know that approach.

The reason I wanted to get at both variables. If there is an error in say the API key, I am not sure ‘wresult’ is returned or if it is what is it’s value. Whereas the ‘wstatus’ definitely returns non zero. So I was going to use the ‘wstatus’ as a positve indication of failure.

I had seen SiteSensor referenced in the documentation, and did not realise it was your plugin! I didn’t pursue it as I wanted to keep the number of plugins down, if it could be done natively in a Reactor sensor.


1 Like

Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules