I’ve been having too much fun with Home Assistant and decided I want to make use of the alarms on my new Amcrest cameras (Motion, Tamper, etc). I built a little SMTP server using Twisted (which is already installed as a dependency for something else). Unfortunately, the Mail components of Twisted aren’t python3 ready yet so I had to do some manual work there. I have my cameras configured to send email alerts to my HA server on port 2525. The Twisted protocol will receive the email, decode it and then pass it on to an HA sensor.
As per usual, everything is at: https://github.com/drytoastman/haconfig
The files are:
custom_components/amcrestsmtpreactory.py - the Twisted SMTP server
custom_components/amcrestalert.py - the new platform
custom_components/sensor/amcrestalert.py - the new sensor
Example config (duplicates the camera info, haven’t figure out a way to share that yet):
sensor:
- platform: amcrestalert
cameras:
- host: 192.168.2.3
name: Driveway
- host: 192.168.2.4
name: FrontDoor