Http post in lua

How do I make a http post in a scene using LUA. Could someone post an example of the syntax please.

Good afternoon,

The following link should help you in that process: Luup Scenes Events - MiCasaVerde

Regards,

Thanks. I did look there but i cant get it to work.

I tried this:

local http = require(“socket.http”)

http.TIMEOUT = 5

result, status = http.request(“http://192.168.1.90:81/admin?camera=RearGarden&alerts=2”, “run=run”)

But is doesn’t work. If I run the URL http://192.168.1.90:81/admin?camera=RearGarden&alerts=2 direct in a browser it works fine. But i’d like to have this command work as part of a scene.

On a Vera or Ezlo hub ?

Its a vera hun running UI7

On a Vera firmware hub you can just do this in your lua code:

  luup.inet.wget("http://192.168.1.90:81/admin?camera=RearGarden&alerts=2") --Your comment here

thank you. Do I need the socket request an timeout code also?

Think you can just add a ,5 to the request.

luup.inet.wget("http://192.168.1.90:81/admin?camera=RearGarden&alerts=2",5) --Your comment here
2 Likes

That’s perfect. Works a treat. Thank you.

1 Like

Best Home Automation shopping experience. Shop at getvera!

© 2021 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules