Author Topic: http command using LUA  (Read 239 times)

Offline Lucas68

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
http command using LUA
« on: May 31, 2018, 12:59:28 pm »
Hi,

Sorry for the noob question. I just got a Vera Edge from my fren and I'm trying to figure out how to send http command using LUA, but i just cant figure out how.

I was trying to create a "Virtual switch" that will send a http command of let say:
http://192.168.1.123:4000/turnoff

and put the command in LUA code of the device, but I cant find something like that.

Then I try to create lua scene, but it requires a trigger which i dont have any sensor yet at the moment, is it possible for me to create a variable of lets say xxx=1. and the scene will check if xxx=1 and run the http command if it is?

I've spent whole day trying to look for more info, but most of the explanation is quite confusing for me as I dont code, I just want to send a simple command. Thanks so much!

Offline parkerc

  • Sr. Hero Member
  • ******
  • Posts: 2458
  • Karma: +35/-48
  • Life Moves Pretty Fast....
Re: http command using LUA
« Reply #1 on: June 04, 2018, 10:43:12 am »
It sounds like creating an app/plug-in would be quite a task if you do not have any programming experience.

If it help, if you want to call something via a url, using lua, then this is an example of code that i have that calls a second Vera to turn on a light.

The url you use could be anything with it?s own http/API - set the scene to manual and it will run on your command.

Code: [Select]
luup.inet.wget("http://192.168.1.183:3480/data_request?id=lu_action&DeviceNum=90&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0")
« Last Edit: June 04, 2018, 11:51:42 am by parkerc »