Page 1 of 1

Getting error when trying to email snapshot

Posted: Monday 28 November 2022 17:38
by alkempter
Hello,

I am currently trying to integrate an old Foscam C1 Lite into Domoticz.
I added it int cameras and when I click onto the photo camara icon a snapshot gets downloaded to my PC download folder.
When I click onto the video camera icon I the video output of the camera is getting displayed in a frame on the screen.

But when I try to relate the camera to a switch in the lower section of the camera page I only get the following error messages in the domoticz log:
2022-11-28 17:18:10.793 Error: SMTP Mailer: Error sending Email to: <[email protected]> !
2022-11-28 17:18:10.793 Error: libcurl: (56)
2022-11-28 17:18:10.793 Error: Failure when receiving data from the peer
2022-11-28 17:18:10.793

Text in the url field of the camera definition reads:
/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=admin&pwd=adminpassword

Note: I omitted the http: in the following samples so the text will not be converted to a link:

From the internet browser I can enter //192.168.0.123:88/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=admin&pwd=adminpassword"
and get a snapshot displayed in the browser.

Entering the following command in the shell of the domoticz server:
sudo curl '//192.168.0.123:88/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=admin&pwd=adminpassword' --output /home/pi/domoticz/snapC1L.img
will write a snapshot to the directory.

Am I missing something here?
Any hints are welcome.

Best regards
Al

Re: Getting error when trying to email snapshot

Posted: Monday 28 November 2022 21:56
by waltervl
You can send emails from Domoticz? Google has changed its authentication method for Gmail. But if you already did that it should not be an issue.

Other possibility is that the location were Domoticz is saving the snapshot is not readable for the email function. Are you running Domoticz in a Docker container?

Re: Getting error when trying to email snapshot

Posted: Monday 28 November 2022 22:15
by alkempter
Hello waltervl,

yes, I can send emails, but I use another mail service (I put in gmail.com just to make it anonymous).

Apart from Domoticz I had my troubles setting up the camera to send me emails directly (which I only got to work with Gmail app password because the camera's hardware certificate is too old).

Cheers
Al

Re: Getting error when trying to email snapshot

Posted: Tuesday 29 November 2022 15:22
by waltervl
I see from your signature that you run Domoticz on synology (in Docker?).
So could be an Docker access issue. Or try the snapshot link within the Docker container.

Re: Getting error when trying to email snapshot

Posted: Wednesday 30 November 2022 1:11
by alkempter
waltervl wrote: Tuesday 29 November 2022 15:22 I see from your signature that you run Domoticz on synology (in Docker?).
So could be an Docker access issue. Or try the snapshot link within the Docker container.
Sorry, my profile was not current. Domoticz is not on Synology any more.
I run Domoticz 2022.2 on Raspberry Pi 3B with Bullseye. Mosquitto is installed and zWave JS is up and running (snapd install, no Docker).
I avoided Docker as I saw not enough value in it to dig into a technology new to me.

If I can't get this snapshot sending working I'll leave it. The camera itself has a lot of functionality and so does Surveillance Station on the NAS. Just wanted to have the automation on one point and not one function here and the other over there...

Cheers
Al

Re: Getting error when trying to email snapshot

Posted: Wednesday 30 November 2022 9:00
by waltervl
What if you do

Code: Select all

http://domoticz-ip:8080/json.htm?type=command&param=emailcamerasnapshot&camidx=1&subject=test
Change camidx to the correct one.

Re: Getting error when trying to email snapshot

Posted: Wednesday 30 November 2022 10:56
by alkempter
waltervl wrote: Wednesday 30 November 2022 9:00 What if you do

Code: Select all

http://domoticz-ip:8080/json.htm?type=command&param=emailcamerasnapshot&camidx=1&subject=test
Change camidx to the correct one.
Hi Walter,

thanks for your patience.

IDX is shown as 1 in my case. Entering the command in the browser gave the following result in the browser:
{
"status" : "OK",
"title" : "Email Camera Snapshot"
}

Domoticz log showed the following:
2022-11-30 09:58:05.625 Error: SMTP Mailer: Error sending Email to: <my email address> !
2022-11-30 09:58:05.625 Error: libcurl: (56)
2022-11-30 09:58:05.625 Error: Failure when receiving data from the peer
2022-11-30 09:58:05.625

I wonder where I can find what "libcurl: (56)" may mean.

.....
But after that I decided that the error can't really be in the emailcamerasnapshot function and began to think what I could change in my Domoticz setup.

I then changed the E-mail setup in domoticz to use not my usual e-mail gateway, but the new one via Gmail which I created for the camera directly (because of the old FOSCAM hardware certificate).
And voilà, it worked like a charm!

I can only assume the problem has to do with the the fact that I have to use TLS/STARTTLS which usually requires a certificate or that the emailcamerasnapshot function requires to use Gmail if you want to use an attachment.

For the time being I'll stay with this setup, but I would prefer not to use Gmail to email my important Domoticz messages.

Thanks!

Cheers
Al

Re: Getting error when trying to email snapshot

Posted: Wednesday 30 November 2022 11:12
by waltervl
It also should work with other mail providers. Did you play with the email setting "Send Camera Snapshots as attachment (Gmail)"?
See also
viewtopic.php?p=287307#p287307

Re: Getting error when trying to email snapshot

Posted: Wednesday 30 November 2022 23:26
by alkempter
waltervl wrote: Wednesday 30 November 2022 11:12 It also should work with other mail providers. Did you play with the email setting "Send Camera Snapshots as attachment (Gmail)"?
See also
viewtopic.php?p=287307#p287307
I did some tests and turning off the setting "Send Camera Snapshots as attachment (Gmail)" just changed that no snapshot was attached to the e-mail.

The thing is, that my other e-mail providers do not accept e-mails from my old camera, no difference directly or via Domoticz because they all require TLS or STARTTLS and a valid certificate.
When trying sending an e-mail directly from the camera, I get an error message that there is a problem with the certifcate of the device. Trying it via Domoticz I just get that unclear error message mentioned before.
Gmail allows to create an application password which means that I can send an e-mail from a device via Gmail without requiring a certificate.
In Domoticz I know no way to use different e-mail settings just for the camera, so I have to stick to Gmail if I want to continue sending camera snapshots from this old camera via Domoticz.

Cheers
Al

Re: Getting error when trying to email snapshot

Posted: Thursday 01 December 2022 0:22
by waltervl
In latest beta a lot has changed with security settings see wiki https://www.domoticz.com/wiki/Security
I am no expert on this matter but perhaps in beta you can use it with certificates.