Camera question get url

Moderator: leecollings

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

Camera question get url

Post 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...
zicht
Posts: 272
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: Camera question get url

Post 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.
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
JimmyH1969
Posts: 153
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 »

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 1399 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest