Introduction: Sonoff Wall Switch Add-ons

If you are running Sonoff T1 wall switches, have stepped away from using cloud-based servers for home automation and would like to get more functionality out of the wall-mounted light switch. This instructable shows you how to add a temperature sensor and optionally a buzzer.

Prerequisite

1. Means of flashing the Sonoff T1 either over the air(OTA) or with CP2102 USB to TTL adapter.

2. Mqtt Broker to receive the information.

3. Home automation platform to control the switch and display the sensor data.

My Goal for this project was to add additional functionality to one of my Sonoff wall light switches. I've had them in the apartment for a while, they all run Tasmota firmware, which allows them to communicate over MQTT to my automation platform Home Assistant.

There are plenty of youtube videos about Home Assistant and Tasmota i would recommend going to check them out.

I have always wanted to have a central apartment temperature reading so I can automate cooling/heating throughout the house. As an option, I added a buzzer to give that generic beeping when the alarm gets activated. This instructable is how I went about it

Caution!!

There will be times working with AC voltage when removing or adding the switch, Please be carefull.

Step 1: Firmware Setup

I began setting up the firmware on my wall switch, and the Sonoff runs an ESP8266 chip, which when after flashing with Tasmota or ESPhome allows for sensors, relays, switches, and LED's to be connected, I'm focusing on Tasmota as that is the firmware I mainly use.

The breakout pads used for flashing the firmware exposes 2 GPIO pins of the ESP8266 the Tx and Rx pins, which correlate to GPIO 1 and GPIO 3 respectfully.

There are two things to know when using these to pins. Both pins go High during boot, which means they output 3.3v for a split second during the bootup process, and most importantly, if the Tx GPIO 1 pin gets pulled low during the start process, the controller fails to boot.

With that in mind, I decided to add in the temperature sensor on GPIO1 (TXD) and the buzzer on GPIO3 (RXD).

With Tasmota flashed head over to the configuration page, select "configure module" and select module as "Sonoff T1" with the corresponding gang switch you have, click save, and wait to reboot.

After the reboot head back to the "Configure Module" page, now we can select our temperature sensor from the drop-down list by GPIO1. I am using a DHT22, so I have selected AM2301 other out of the box options are DHT11 and SI7021.

Optional.

If adding in the buzzer select buzzer from the drop menu for GPIO3.

Step 2: Time for Mods

Adding the sensor and the optional buzzer requires a bit of soldering and figuring out how to run the wires.

Attach the temperature sensor and buzzer as per the diagram

1. Connect the data line of the temperature sensor to TXD and the positive lead of the buzzer to RXD

2. Connect the VCC of the temperature to the 3.3v pin on the light switch

3. Connect the ground of the temperature sensor and the negative of the buzzer to GND

I decided to add some female header pins to the pcb and mill out the back of the plastic cover to let the pins run through.

I then made a small wire loom to attach the sensor and buzzer through the header pins.

Time to test it, turn on the mains and its either going to work or blow up, luckly everything worked.

Step 3: Neatining It All Up

So now came time to neaten it all up as we dont want wires sticking out the of a light switch, and off it was to Fusion 360.

I designed the a frame to wrap around the faceplate which then extends out to accomodate the temperature sensor and buzzer with a small grill, it is all printed with PLA and with supports, it could be painted or just left as is.

I scraped out a bit of plaster to run my wires past the back and out the side. Scrapping the plaster meant I had no visual mods to the faceplate so that I can use it elsewhere should the need arise..

I have attached two STL files, one that just mods for the Temperature sensor and the other that includes the buzzer.

Step 4: Conclusion

With the firmware set and all the hardware installed and neatened up the project comes to an end, the temperature sensor automatically displays on the home screen of tasmota, and once setup the values are broadcast to the MQTT server at 5min interval updates.

From here, you can import the sensor data into your preferred automation platform for viewing on your devices or used for automation.

Optional

The Buzzer can be tested in the console by typing in Buzzer followed by 3 numbers seperated by a comma

First number is the amount of beeps

Second number is the Duration of a single beep

Third number is the silence duration between individual beeps

Extra Information

To use the Buzzer with MQTT send a message payload as the number sequance of above to the cmnd/Topic/Buzzer

Documentation can be found here for more info on the buzzer

https://tasmota.github.io/docs/Buzzer/