Email Camera Snapshot [Solved]
Moderator: leecollings
-
- Posts: 34
- Joined: Thursday 27 October 2016 8:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Email Camera Snapshot
Hi Guys,
I'm trying to convert some of my scripts to dzVents to use the new features introduced with it (like history).
I'm looking for the api to send a camera snapshot by email but it seems to be lacking.
Is someone using that ?
Is this something easy to implement ?
Thanks,
U.
I'm trying to convert some of my scripts to dzVents to use the new features introduced with it (like history).
I'm looking for the api to send a camera snapshot by email but it seems to be lacking.
Is someone using that ?
Is this something easy to implement ?
Thanks,
U.
-
- Posts: 34
- Joined: Thursday 27 October 2016 8:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Email Camera Snapshot
Hi SweetPants,
I already send camera snapshots using the api:
/json.htm?type=command¶m=emailcamerasnapshot&camidx='..camIdxs..'&subject='..urlencode(subject)
I just do not find this api in the dzVents implementation.
Regards,
F.
I already send camera snapshots using the api:
/json.htm?type=command¶m=emailcamerasnapshot&camidx='..camIdxs..'&subject='..urlencode(subject)
I just do not find this api in the dzVents implementation.
Regards,
F.
-
- Posts: 485
- Joined: Thursday 17 September 2015 10:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
Re: Email Camera Snapshot
Why don't you just useultratoto14 wrote: ↑Thursday 07 September 2017 8:12 Hi SweetPants,
I already send camera snapshots using the api:
/json.htm?type=command¶m=emailcamerasnapshot&camidx='..camIdxs..'&subject='..urlencode(subject)
I just do not find this api in the dzVents implementation.
Regards,
F.
Code: Select all
domoticz.openURL(url)
You can build up your URL based on
Code: Select all
domoticz.settings['Domoticz url']
-
- Posts: 34
- Joined: Thursday 27 October 2016 8:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Email Camera Snapshot
@BakSeeDaa thanks for the help.
My goal is to enhance dzVents, more than finding a workaround.
I already use my own lua modules to do most of the things.
I was trying to move to dzVents to see its potential.
I solved it by adding in runtime/domoticz.lua:
Maybe @dannybloe will add it in the future.
Thanks again to the helpers.
F.
My goal is to enhance dzVents, more than finding a workaround.
I already use my own lua modules to do most of the things.
I was trying to move to dzVents to see its potential.
I solved it by adding in runtime/domoticz.lua:
Code: Select all
-- have domoticz send an email with camera snapshot
function self.emailCamera(subject, indexes)
if (indexes == nil or #indexes == 0) then
utils.log('No camera indexes provided', utils.LOG_ERROR)
else
if (subject == nil) then subject = '' end
self.sendCommand('SendCamera:'..table.concat(indexes,';'), subject)
end
end
Thanks again to the helpers.
F.
-
- Posts: 485
- Joined: Thursday 17 September 2015 10:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
Re: Email Camera Snapshot
Instead of changing dzVents I believe a better idea would be to create a shared helper function. Doing so, your code will not disappear when you upgrade Domoticz.ultratoto14 wrote: ↑Thursday 07 September 2017 13:50 @BakSeeDaa thanks for the help.
My goal is to enhance dzVents, more than finding a workaround.
I already use my own lua modules to do most of the things.
I was trying to move to dzVents to see its potential.
I solved it by adding in runtime/domoticz.lua:
Maybe @dannybloe will add it in the future.Code: Select all
-- have domoticz send an email with camera snapshot function self.emailCamera(subject, indexes) if (indexes == nil or #indexes == 0) then utils.log('No camera indexes provided', utils.LOG_ERROR) else if (subject == nil) then subject = '' end self.sendCommand('SendCamera:'..table.concat(indexes,';'), subject) end end
Thanks again to the helpers.
F.
-
- Posts: 34
- Joined: Thursday 27 October 2016 8:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Email Camera Snapshot
Nice functionality !
Will try that.
Thanks.
Will try that.
Thanks.
-
- Posts: 485
- Joined: Thursday 17 September 2015 10:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
Re: Email Camera Snapshot
You can also use the dzVents logging functionality.
Code: Select all
domoticz.log('No camera indexes provided', domoticz.LOG_ERROR)
The function can then be defined as
Code: Select all
emailCamera = function(domoticz, subject, indexes)
-
- Posts: 34
- Joined: Thursday 27 October 2016 8:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Email Camera Snapshot
Thanks a lot BakSeeDaa, this is exactly what i did and i just see your message.
Thanks for your time
The complete code
Then use
example:
Thanks for your time
The complete code
Code: Select all
return {
helpers = {
emailCamera = function(domoticz, subject, indexes)
-- have domoticz send an email with camera snapshot
if (indexes == nil or #indexes == 0) then
domoticz.log('No camera indexes provided', utils.LOG_ERROR)
else
if (subject == nil) then subject = '' end
domoticz.sendCommand('SendCamera:'..table.concat(indexes,';'), subject)
end
end
}
}
Code: Select all
domoticz.helpers.emailCamera(domoticz, subject, array_of_indexes)
Code: Select all
domoticz.helpers.emailCamera(domoticz, 'Alarm triggered', {1, 2})
-
- Posts: 485
- Joined: Thursday 17 September 2015 10:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
Re: Email Camera Snapshot
Looks great!
But you should use the domoticz.LOG_ERROR.
I took me the liberty to change your code a little bit like this:
But you should use the domoticz.LOG_ERROR.
I took me the liberty to change your code a little bit like this:
Code: Select all
return {
helpers = {
emailCamera = function(domoticz, subject, indexes)
subject = subject or ''
-- have domoticz send an email with camera snapshot
if not indexes or #indexes == 0 then
domoticz.log('No camera indexes provided', domoticz.LOG_ERROR)
else
domoticz.sendCommand('SendCamera:'..table.concat(indexes,';'), subject)
end
end
}
}
-
- Posts: 587
- Joined: Wednesday 16 December 2015 19:13
- Target OS: NAS (Synology & others)
- Domoticz version: 2022.2
- Location: Netherlands
- Contact:
Re: Email Camera Snapshot
i am working my way in dzVents(coming from lua) but i really do not see how this works
can anybody explain it to me in a way i can implement this code/function so i can use it to send an email snapshot from my camera
eg:
where do i put the camera info
do i use the complete api string i curently use in lua
can anybody explain it to me in a way i can implement this code/function so i can use it to send an email snapshot from my camera
eg:
where do i put the camera info
do i use the complete api string i curently use in lua
-
- Posts: 43
- Joined: Saturday 06 August 2016 9:53
- Target OS: Windows
- Domoticz version:
- Location: Sweden
- Contact:
Re: Email Camera Snapshot
Hi,
I'm using this command within dzvents:
I am receiving an e-mail but the image seems to be base64 decoded beacuse all I see is some random tect and not the image.
Do you have any idea how to fix this?
Thanks!
I'm using this command within dzvents:
Code: Select all
domoticz.openURL('http://x.x.x.x/json.htm?type=command¶m=emailcamerasnapshot&camidx=1&subject=Test')
Do you have any idea how to fix this?
Code: Select all
<img src="data:image/jpeg;base64,(here comes the random text).
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Email Camera Snapshot
Perhaps a someone have a script to send the [ or some of them ] pictures directly to a gmail drive???
So we can use the drive as a backup... [ for when you see after x days you miss something in the garden
]
So we can use the drive as a backup... [ for when you see after x days you miss something in the garden


Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
- Posts: 94
- Joined: Thursday 18 May 2017 8:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Left
- Contact:
Re: Email Camera Snapshot
I use this script above:
This works without problem for a single camera, but for 2 it does not work.
Is it possible to send multiple camera pictures in a single email?
Code: Select all
emailCamera = function(domoticz, subject, indexes)
subject = subject or ''
if not indexes or #indexes == 0 then
domoticz.log('No camera indexes provided', domoticz.LOG_ERROR)
else
domoticz.log('SEND '..table.concat(indexes,';'), domoticz.LOG_ERROR)
domoticz.sendCommand('SendCamera:'..table.concat(indexes,';'), subject)
end
end,
Is it possible to send multiple camera pictures in a single email?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Email Camera Snapshot
Currently not but maybe it could be implemented. What do you get when you
http://<domoticzIP:domoticzPort>/json.htm?type=command¶m=emailcamerasnapshot&camidx=1;2&subject=Test
or
http://<domoticzIP:domoticzPort>/json.htm?type=command¶m=emailcamerasnapshot&camidx=1,2&subject=Test
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 94
- Joined: Thursday 18 May 2017 8:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Left
- Contact:
Re: Email Camera Snapshot
The ; separated version works like a charmwaaren wrote: ↑Monday 21 September 2020 12:34Currently not but maybe it could be implemented. What do you get when you
http://<domoticzIP:domoticzPort>/json.htm?type=command¶m=emailcamerasnapshot&camidx=1;2&subject=Test
or
http://<domoticzIP:domoticzPort>/json.htm?type=command¶m=emailcamerasnapshot&camidx=1,2&subject=Test

I assume there is currently not a way to trigger this via DzVents?
For now I just use the url.
Last edited by elgringo on Monday 21 September 2020 18:46, edited 1 time in total.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Email Camera Snapshot
not natively in the current version but can you check if
Code: Select all
domoticz.sendCommand('SendCamera:'.. "1;2", "test")
if that does not work, below dzVents command should
Code: Select all
domoticz.openURL("http://<domoticzIP:domoticzPort>/json.htm?type=command¶m=emailcamerasnapshot&camidx=1;2&subject=Test")
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 94
- Joined: Thursday 18 May 2017 8:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Left
- Contact:
Re: Email Camera Snapshot
Code: Select all
domoticz.sendCommand('SendCamera:'.. "1;2", "test")
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Email Camera Snapshot
And can you confirm the domoticz.openurl does?elgringo wrote: ↑Monday 21 September 2020 18:48does not workCode: Select all
domoticz.sendCommand('SendCamera:'.. "1;2", "test")
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Who is online
Users browsing this forum: Google [Bot] and 1 guest