not a coder but just hacker… Trying to use presets with my veracams by utilizing manual scenes. I set the presets in the native controls going to the ip of the camera and they work in the native controls. I did research and came up with the following Luna code but can’t seem to make it work. Any assistance would be greatly appreciated.
local IP_address = “X.X.X.X”
local username = “admin”
local password = “XXXXXXXXX”
local timeout = “5”
local http = require("socket.http")
local ip_address = "127.0.0.1"
local username = "admin"
local password = "password"
http.request("http://"..ip_address.."/decoder_control.cgi?command=33,"..username..","..password)
So this is where I am at still with no results. in UI7 can I use a scenes with a mannual trigger and just a Luup script? As I still can seem to get it to work.
local IP_address = “192.168.1.142”
local username = “admin”
local password = “Password”
local timeout = “5”
Couple of issues here. Here is what you’re using which deviates from what I provided. I’ll underline the issues.
http.request(“http:80//”…ip_address…“/decoder_control.cgi?command=33,”…username…“,”…password)
[1] Case sensitivity … The two variables must match, otherwise I wouldn’t expect it to work. I’ll use what you posted.
local IP_address = “192.168.1.142”
http.request(“http:80//”…IP_address…“/decoder_control.cgi?command=33,”…username…“,”…password)
[2] You might want to re-think that port location or in other words, simply drop it as it’s port 80 (default)…
http.request(“http://”…IP_address…“/decoder_control.cgi?command=33,”…username…“,”…password)
[quote=“Dsitver, post:3, topic:182428”]So this is where I am at still with no results. in UI7 can I use a scenes with a mannual trigger and just a Luup script? As I still can seem to get it to work.
local IP_address = “192.168.1.142”
local username = “admin”
local password = “Password”
local timeout = “5”
I’m Looking at code trying to understand, My first question is Comand 33 the pre-set location. If so which location
If I have 5 pre-sets are they 33,34,35,36,37, I copied the code and made A scene if i run the scene is say sucess but camera is not moving. thanks for any help here,
Using your original code ‘http://ip_address/decoder_control.cgi?command=33,username,password’. If you put in the correct values for the IP-address, user name and password and paste it in a browser window and then hit the enter key. Does the camera move? Do your get an OK or similar or do you get an error message?
If the camera moves, then your URL code is correct and I’m at a loss why the Vera LUA code doesn’t work.
If the camera doesn’t move and you get an error, it means your http request/code is incorrect and you’ll have to experiment in a browser until you can get it to move the camera as desired and then convert it to the type of code (watch the case semsitivity!) CudaNet created for you.
I was able to copy statement to web browser and camera moves this is a great help. At least I have a test point now I just need to figure out what I don’t know about the code.
The top 4 line I’m telling ip address = my camera’s ip login = name (insert name) and so on.
Sorry I have been away so long working for Fedex. Holiday are so busy.
I can move camera in browser no problem. When Scene runs no errors get success under scene but camera not moving.
this is my code
local http = require(“socket.http”)
local ip_address = “192.168.0.000”
local username = “admin”
local password = “xxxxxx”
local timeout = “5”
Presumably you are setting your actual IP address in the variable ip_address? You don’t need to keep it a secret.
You should set the timeout for the http request otherwise it could crash your Vera if the target does not respond.
Send the response from the http request to the log so you can see if there are any errors returned.
[code]local http = require(“socket.http”)
local ip_address = “192.168.0.000”
local username = “admin”
local password = “xxxxxx”
local timeout = “5” – This does not do anything so could be removed
http.TIMEOUT = 5
local response, status = http.request (“http://”…ip_address…“/decoder_control.cgi?command=33,”…username…“,”…password)
if response == nil then
luup.log("http request error: " … status)
else
luup.log("http request response: " … response)
end
[/code]
The camera is not liking the userid and/or password you are supplying it based on the log entries you posted. It could be that the camera expects and encrypted userid/password which is something Vera is not capable of supplying at this time. But that is only a guess based on experience as the logs are not detailed enough to be able to prove that.
Well I’m no closer to getting my vistacam pt to move. But I sure have learned alot a would like to thank everyone for there input. I’m not sure why if I can send the info from the browser the camera will move but if vera sends the info it wont. I would think that its the same info being sent.
So I tried some different things this what i found. when i paste the code in my Google browser it returns ok and camera moves. when I paste the same code in foxfire it return a box to enter name and password.
if I don’t enter error 401 is return same as in log. So I think the Google browser is inserting the password because I click on the remember password box and in foxfire once i clicked on the same box it now moves camera. So my error is in the the user name and password part of script. When I move the camera with the browser I see nothing in the log.