SMTPd Plugin

Posted on
Fri Jul 01, 2016 2:11 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

SMTPd Plugin

I gotta admit, this is a bit of a weird one. I'll explain...

I finally got the ethernet cable connected to my Onan Cummins backup generator. This thing has a web interface that duplicates the control panel. Handy for some things, but to get any kind of almost real time notifications I'd need to poll the index page and screen scrape the HTML. Something I'll probably do at some point, but not right now.

It also will send emails when any kind of event happens. Great. Except it's a stupid micro-controller and doesn't know how to do encrypted connections to an SMTP server. And I wasn't really happy about (1) sending my email authentication info in the clear and (2) depending on external email servers. If it's the generator reporting things, there's a fair chance that my Internet connection is down.

So, I needed to set up an SMTP server on my LAN that the generator could talk to. I could have done that on my Indigo server, or my Synology file server. But then I got the bright idea to write a plugin that was an SMTP server. So I did.

This thing is dead simple. In the configuration dialog, you specify the port you want the server to listen on, and a username/password pair for your email client to use to authenticate. That's it. There's no devices and no actions. When an email is sent to the server (any email), an Event is triggered and the To/From/Subject/Text of the message are stored in variables that the plugin creates. Currently, I have my Twilio plugin send me an SMS with the Text of the email I get from the generator.

One gotcha (maybe) - this particular device (the generator) won't connect to an IP address. So you need a hostname for the email server (Indigo) machine that it can resolve. I have a DNS server on my Synology box, so I set up the generator's network to use it for DNS, and used a hostname there that resolves to the Indigo box. In the email setup for the device, you specify the hostname (or IP address) of the Indigo server, the port number you specified in the plugin config, and the username/password also specified in the plugin config. What you actually put on the email for From and To addresses is irrelevant. ANY email sent to the plugin will trigger the event. And there is NO forwarding from the plugin. Use BetterEmail or the built in email sender to forward the message if needed.

Download from: https://github.com/FlyingDiver/Indigo-S ... tag/v0.0.1

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Jun 29, 2019 9:03 pm
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: SMTPd Plugin

Thank you for this plugin and for working with me to get it functioning on my end.

I am using your plugin to get motion notifications from IP Cameras and NVRs into indigo. Since it's not going to an actual email and then being read by indigo or processed by IFTTT or whatever, it's instant. :D

Step 1) Set up SMTPd plugin
Step 2) Set up cameras to email the plugin.
SMTP Server = Indigo IP address.
Port = SMTPd port in config
Username = <username> (from SMTPd config)
Password = <password> (from SMTPd config)
Sender = CameraName@ipc.com
Receiver = CameraName@ipc.com
(Some of my cameras don't let you set a subject, some do... I use the receiver name to trigger)

Step 3) Set up a 30 second timer device pr. camera. (I like 30 seconds as a dwell time)
SMTP_CameraName

Step 4) Create 2 variables per camera.
SMTP_CameraName_Motion
SMTP_CameraName_DTG

Step 5) Create 2 triggers per camera.
SMTP_CameraName_Motion
Trigger: SMTPd Message Receive
Condition: if variable smtpd_messageTo contains value CameraName
Action: modify variable SMTP_CameraName_Motion = true
Action: insert timestamp into variable: SMTP_CameraName_DTG
Action: restart timer SMTP_CameraName

SMTP_CameraName_Motion Timer End
Trigger: Timer and Pester Event, Timer Expired: SMTP_CameraName
Condition: Always
Action: modify variable SMTP_CameraName_Motion = true

Presto: Video motion detection within indigo and it should work with any Dahua type camera (Amcrest, Foscam, Lorex, Q-See, etc.)

Thanks again Joe for all your work on this plugin!!!

v/r
Bill

Bill
My Plugin: My People

Posted on
Tue Jan 19, 2021 5:08 pm
mclass offline
Posts: 312
Joined: May 13, 2015
Location: Melbourne, Australia

Re: SMTPd Plugin

Thanks for all your plugins!

I'm attempting to integrate some Hikvision cameras but have been stumped by your "gotcha":
One gotcha (maybe) - this particular device (the generator) won't connect to an IP address. So you need a hostname for the email server (Indigo) machine that it can resolve.


The Hikvision cameras do not support IP address email, and I don't have a local DNS server :( . Is it possible to simply install one on the Indigo server, or better yet include one in the SMPTd plugin? My coding skills are minimal, so it's not a task to take on lightly. If there are limited options this may be the solution to my issue:
https://www.mamp.info/namo/en/

TIA

mclass

Posted on
Tue Jan 19, 2021 5:10 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: SMTPd Plugin

I run a local DNS just for this device on my Synology NAS box. Or a Docker container on your Mac server would also work. But including a DNS server is way beyond the scope of the plugin.

Setting up a DNS server can be complicated. If you don't want to learn how, paying $20 for that product may be worth it.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed May 11, 2022 6:44 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: SMTPd Plugin updated for Indigo 2022.1


joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests