Weird luup.inet.wget() behaviour on Vera Plus

I have used HTTP Get commands in scenes before using the luup.inet.wget( ) method. No problems.

For some reason I am having trouble with a new string now.

If I run this from a browser
http://192.168.2.109//cmd:turnoff1+pwd:mickeyMouse
it works fine

If I run this from this from the Vera/Apps/Develop Apps/ Test Luup code (Lua) it works fine

luup.inet.wget(“http://192.168.2.109//cmd:turnoff1+pwd:mickeyMouse”, 5)

When I put that same luup line as the command in lua section of a scene (Also, execute the following Luup code:) it does not work when I manually run the scene…

I’m perplexed. I have been doing for years with other http get commands…

anything obvious?
could it be the scene is expecting a certain return response or code? whereas the test luup code doesn’t care?

Could it be related to the pretty quotes ?

Or is that just the forum post formatting ?

luup.inet.wget("http://192.168.2.109//cmd:turnoff1+pwd:mickeyMouse", 5)

Also why two forward slashes before cmd: ?

I think the formatting is just the forum. I played around with deleting and reinserting the quotes in the Vera scene editor just to be sure. Also used notepad instead of MSWORD. No effect. I saw others threads on the pretty quote issue.

Its odd the exact same string works in the Vera LUUP test window but not as a line of LUUP code in a scene.

This same command works perfectly fine from a meshbot on EzloPlus (run as a http get).

The two forward slashes before cmd: was just a design choice at the other end. It could be anything that is just what I went with. Syntax is http://ipaddress//cmd:command+pwd:password

Strange then, if the code works in the test window OK it should also work in a Vera scene.

I have some scenes that use luup.inet.wget

Just checked some of my scenes, I noticed I dont have a space

", 5)
",5)

But I doubt that should matter.

It;s the HTML encoding your browser does automatically, but the wget does not. Try this:

luup.inet.wget("http://192.168.2.109//cmd%3Aturnoff1%2Bpwd%3AmickeyMouse", 5)

Cheers Rene

1 Like

That should work I forget about encoding the URL.

OK so today it works… I don’t need the %3A or %2B : and + are fine within the " string "

  luup.inet.wget("http://192.168.2.109//cmd:turnoff1+pwd:mickeyMouse",5)

I think somehow it relates to the pasting of the quotes being the wrong character (curly quotes) and maybe I didn’t realize what had happened. I thought I had that covered but I guess not. I did tick the box in security tab “Enable potentially unsafe lua code, like wget and RunLua.” so maybe that was part of it.

Anyway another reason to move off of Vera to EzloPlus for my primary home. Ezlo handles HTML Gets/Puts much more elegantly. The AND NOT OR in meshbot triggers will save me a lot of cryptic LUUP code I have in Vera simply to create an AND function on the trigger. Just need to see more stability on Ezlo still for me to make the leap of faith…

Appreciate the help.

1 Like