Author Topic: http get from virtual switch change  (Read 192 times)

Offline swarmier

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
http get from virtual switch change
« on: April 09, 2017, 02:13:48 pm »
Hello,
    I recently switched over my light controls from HomeSeer/Fibaro HC2 where I was running a short bit of LUA/vbs via virtual buttons.  Having worked with both platforms for a while, it is much more initiative to build virtual devices that trigger any LUA but I mainly used them for IP calls to IoT devices that do not have plugins.  I have a two part question I was hoping to get some advice with (I am just getting into LUA coding):

What would be the best way to turn on 8 individual relays via HTTP GET commands, not worrying about polling for state?  BTW-This is to an IPX-800 v.2 which uses a different API than from the plugin which I do use for my IPX-800v3.

My current thought process was to use a multi-switch and then per switch build and ON and OFF scene that runs some LUA code.  Which brings me to the current problem of my LUA code not working from the scene.  I tested this in the develop section and the code works fine:

Code: [Select]
local http = require "socket.http"
local result, status = http.request "http://192.168.98.22/preset.htm?led8=1"

But when I set a scene and trigger it manually, I get the error "Scene run failed"

Screenshots attached.

Thanks in advance!

Offline akbooer

  • Master Member
  • *******
  • Posts: 4843
  • Karma: +207/-67
  • "Less is more"
Re: http get from virtual switch change
« Reply #1 on: April 09, 2017, 04:18:08 pm »
The code looks good.

One thought... it may require a blank line (actually, a carriage return) at the end.

If not that, then it's something more sinister.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P.
Razberry, MySensors Arduino, HomeWave, AltUI, DataYours, openLuup, ZWay.

Offline swarmier

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: http get from virtual switch change
« Reply #2 on: April 09, 2017, 05:17:17 pm »
It's always the simple stuff... there was a space at the beginning of the scene name, I missed that it converted it into a %.  Working now, thank you.

I assumed it was the code before checking the little stuff.

Thanks,
JG

Offline akbooer

  • Master Member
  • *******
  • Posts: 4843
  • Karma: +207/-67
  • "Less is more"
Re: http get from virtual switch change
« Reply #3 on: April 09, 2017, 05:38:56 pm »
It's always the simple stuff... there was a space at the beginning of the scene name, I missed that it converted it into a %. 

Yup, ALMOST always that.

Glad it's OK now.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P.
Razberry, MySensors Arduino, HomeWave, AltUI, DataYours, openLuup, ZWay.