Camera question get url

Post Reply
JimmyH1969
Posts: 80
Joined: Tuesday 28 June 2016 16:38
Target OS: Windows
Domoticz version: Beta
Location: Amersfoort NL
Contact:

Camera question get url

Post by JimmyH1969 » Thursday 10 August 2017 13:41

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...

zicht
Posts: 174
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 3.8xxx
Location: NL
Contact:

Re: Camera question get url

Post by zicht » Friday 11 August 2017 11:37

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.
Rpi & Win x64. Using : cam's,Nest,RFXCom,Kaku,LaCrosse,RFY,IsAlive,Dummy,Wether Underground, standard Lua, Curl on windows,Domoticz Android App & Tasker,

"The only source of knowledge is experience (A.Einstein)"

JimmyH1969
Posts: 80
Joined: Tuesday 28 June 2016 16:38
Target OS: Windows
Domoticz version: Beta
Location: Amersfoort NL
Contact:

Re: Camera question get url

Post by JimmyH1969 » Friday 11 August 2017 16:04

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
Attachments
IPCam.png
IPCam.png (101.5 KiB) Viewed 325 times

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests