Interfacing Mailbox Alert® with SmartThings® via WiFi using ESP8266 NodeMCU and Tasmota Edge
Prerequisites
This document assumes you have a.) a SmartThings® installation at your location, b.) working knowledge of how to configure SmartThings® Devices and Routines and, c.) the ability and willingness to solder. A basic working knowledge of Tasmota and Tasmota Edge would be helpful. (Users of Habitat, Home Assistant, and other HA solutions should have no problem adapting the basic ideas presented here in order to implement their own solution.)
Description
Mail Alert® is.a commercial product which will tuns on an LED light and sounds a buzzer whenever the mail box door is opened. In this document we will describe how to interface this unit with the SmartThings® platform. Once interfaced, you can write routines to perform various tasks whenever the Mailbox Alert® is triggered.
Technical Overview
In this solution, we connect the buzzer output of the Mailbox Alert® to a 5v opto-isolated relay. The relay is in turn connected to a GPIO pin on the ESP8266. When the Mailbox Alert® is triggered, the voltage from the buzzer circuit drives the relay. The Tasmota software on the ESP8266 senses the changes in the relay state and sends a notification to SmartThings® over WiFi and SmartThings® performs whatever routine(s) are applicable.
Block Diagram
Build Steps
-
Open up the Mailbox Alert® receiver and de-solder the buzzer from the PCB. Note that the + (pos) contact is closest to the outside edge of the board
-
Connect two wires to the PCB in place of the buzzer. Pass the wires out of the top of the plastic case using the buzzer vent holes and re-assemble the case
-
Connect the - (neg) wire to the DC- terminal on the relay
-
Connect the + (pos) wire to the DC+ terminal on the relay
-
Connect a jumper wire from the DC+ terminal on the relay to the In/Trigger terminal on the relay
-
Set the Bias jumper on the 5v relay to HI. This will keep the contact closed when there is no power to the relay
-
Adjust the voltage being sent to the relay as follows:
a.) Power up the MailBox Alert® receiver and press the reset button to turn off the LED
b. )Turn the volume all the way down, but do not click it off.
c.) Use the door sensor to trigger the Mailbox Alert® receiver. The LED should come on immediately. The receiver (thinking it still has a buzzer) will turn the buzzer on/off rapidly for about 3 secs and then pause for about 1 sec. It does this four times.
d.) Slowly turn up the volume until the relay starts receiving power, it lights up it’s LEDs, and you can hear the relay clicking. Do not over power the relay. -
Flash the ESP8266 with the current release of TASMOTA firmware. Instructions for this are outside of the scope of this document but can be found here Getting Started - Tasmota. (Caution: Power the ESP8266 via the USB port for flashing, do not use external power)
-
Configure the ESP8266 as a Generic Tasmota device. Designate GPIO14 as switch 1 and GPIO12 as Relay 1 (We don’t use the relay, but the device GUI looks better when a relay is configured in tandem with a switch)
-
Add the device to SmartThings® using TASMOTA EDGE drivers. Instructions for this are outside of the scope of this document but can be found here. [ST Edge] •• Tasmota Edge •• for Sonoff, Tuya & many other ESP WiFi & HTTP devices - over 2000 Tasmota supported devices - #473 by ragoss
-
Connect the COM terminal on the 5v Relay to the G pin on the ESP8266. Connect the NC terminal on the 5v Relay to pin D5 (GPIO14) on the ESP8266.
-
Long Term Power Options. The Mailbox Alert® runs on 12v DC power. The ESP8266 runs on 5v dc if powered via the USB port -OR- 3.3v dc if powered via the Vin pin. I have used a single 12V wall wart connected in parallel to the Mailbox Alert® and a DC-DC step-down converter which provides the correct voltage for the ESP8266.
SmartThings® configuration
Issue: When triggered by the receiver, the 5v relay will open and close about 50 times in 12 seconds! We only need to capture ONE event that we can act upon in SmartThings®.
Solution: Debounce the relay using a virtual switch and routines.
Create a routine that says if the physical switch state (GPIO14) changes to ON or OFF, turn on the Virtual switch. The virtual switch masks the flapping of the physical switch.
The virtual switch can now be used to trigger events such as sending a text that says ‘You Have Mail’. You can turn it off at night as part of your GOODNIGHT routine, manually in the app, with voice commands from Alexa, or with a custom routine. Note that the red light on the Mailbox Alert® needs to be reset manually.
Hardware
Mailbox Alert® from Hannah Products
5v Opto-isolated relay fro HiLetGo
ESP8266 NodeMcu (With CH340 serial chip)
DC-DC step-down converter
Software TASMOTA software flashed to ESP8266
TASMOTA EDGE driver installed on SmartThings® Hub
Acknowledgements
This solution builds upon prior work which is documented in this thread