Page 1 of 1

Camera question get url

Posted: Thursday 10 August 2017 13:41
by JimmyH1969
Hi,

I'm running the latest Beta Domoticz on a Windows 7 system and I have some cheap chinese camera's that are not supported by Domoticz

When i do this in a browser:

Code: Select all

http://192.168.1.31/web/cgi-bin/hi3510/snap.cgi?&-getpic&-continue=1&-chn=1
The camera takes a snapshot and is showing the picture in the browser, but that doesnt work in Domoticz.

When i do this in a browser:

Code: Select all

http://192.168.1.31/web/cgi-bin/hi3510/snap.cgi?
The camera takes a snapshot and the browser shows this:
var path="/tmpfs/snap_tmpfs/20170810/IMG001/IMG_chn0_TIMER_MNG_20170810123006_003.jpg"

So it is showing the path to the just created snapshot.

Is there an option to get this path in a variable so i can use it in a notification?

Tnx...

Re: Camera question get url

Posted: Friday 11 August 2017 11:37
by zicht
Hi

I have no clue on what system you are or what level of experience you have. So i just post a snapshot of how i solved some on my windows system.
Maybe it inspires you to find a similar solution ...

Code: Select all

function GetCam(idx,naam,save)
	local Cam = 'idx='..idx..'" -OutFile "cam/'..naam..'.jpg"'
	commando = 'powershell Invoke-WebRequest -Uri "http://IP:Port/camsnapshot.jpg?'..Cam
	os.execute(commando) 
    if (save) then
		Cam = 'idx='..idx..'" -OutFile "cam/'..naam..now..'.jpg"'
		commando = 'powershell Invoke-WebRequest -Uri "http://IP:Port/camsnapshot.jpg?'..Cam
		os.execute(commando)
		SendText('Beeld opgeslagen '..naam..now)
	end
end
As you see i call a powershell --> IP:PORT are my domoticz IP and port , IDX is the IDX of the cam in domoticz.
sendtext just notifies my telegram the picture has been stored.
But this way you never capture the name.
So i suggest using a storing a second time to a fixed name (i do this also in the above example)

This way you store with date and time, but latest picture will always be available in snapshot.jpg
It should be doable to transform this into something you can use.

Re: Camera question get url

Posted: Friday 11 August 2017 16:04
by JimmyH1969
Thank you for the script, but i want to see the screeshot immidiatly, so i solved it like this.
(i'm no LUA expert, so did some copy/paste from other scripts) I do need to clean it up a bit ;)

Basicly i did...

execute the URL with Curl for windows and store the result in "content"
modify "content" so only the path to the jpg is in a variable
added that path variable to the jpg after the camera's IP adress
create a notify variable for PushSafer with the complete location of the jpg
Update the uservariable in Domoticz
Send the notification

Works like a charm :D

Image