Send command when mail is received

Hey there,

i couldn’t find anything similar by searching and only found lots of information about how to send a mail via OH.

I have an IP-Camera that has Motion-Detection. On detection it sends a Mail to a dedicated Gmail account. I would like OH to change the state of an Item if it receives this mail.

I would be thankful for any ideas on how to get it working or maybe even if there is a smarter way of getting it done…

thanks in advance!

have you had a look on the ipcamera binding?
that should be exactly what you want…

what is “if it receives this mail” in this context ?
As already suggested with the IP cam binding you should be able to change an item without the need to go via mail.
In case you need to go via mail you need to poll the gmail server for new mails.
Question then is how often you would like to poll the server.
It should be possible / doable by using e.g. a python script to check the inbox for mails with a specific subject. The script could be executed e.g. via executeCommandLine or exec-binding.

Just learned that there is an other alternative:
smarthome/j mailbinding - content-type-channel

1 Like

You can do a similar thing if the camera supports FTP when motion is detected.

FTP Upload - Bindings | openHAB

Also there is another way which uses CPU power to do motion detection with ffmpeg, but the camera needs to have a stream of some kind like a RTSP url.

IP Camera - Bindings | openHAB

I would suspect if you checked a gmail account every 10 seconds or more often, you would get banned from hammering the account with too much traffic.

Hey, thanks for the reply. The Problem is, i dont have direct access to the camera because it is in a second network with a different dhcp host and different IPs…

Is email the only means of notification or do you have other options like sending http requests, ftp upload of alarm picture, SIP call, closing a contact, …?
Furthermore, does your camera provide a link where you can get alarm information from, like date of last alarm or latest alarm picture?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.