Hidden Features in the Ultimate $5 Smart Home Switch

April 10, 2018

Multipurpose Tasmota Sonoffs

Today on the hookup we’re going to learn how to use some hidden functionality on  everyone’s favorite $5 smart switch, the sonoff basic with tasmota.

First let me start by saying this is not going to be a video about setting up tasmota for the first time.  If you’ve never used a sonoff with tasmota before I highly recommend you check out Dr. Zzzs videos on the subject, he’s got everything you need to get started including wiring, programming, and even a little bit on safety.

Come to think of it… I hope I’m not stepping on his toes by doing a Tasmota video, I know it’s kinda his thing.

Anyways, lets check out some advanced functionality that you may not be aware of.

The first feature you may not be using is the LED built into the sonoff basic.  By default this light turns on and off based on whether the relay is engaged, but it can be controlled separately via it’s own MQTT command, which means you can use it as an indicator for anything connected to your smart home.  In my house this light switch by the main entry hall lights up when the exterior alarms are active, and this light switch by the door into the garage lights up as a visual indicator that the garage door has been left open.

In order to use your sonoff LED as an indicator light you’ll need to first unlink it from the relay state.  The command to do this in the tasmota console is LedState (space) 0.  After you have unlinked the LED from the relay state, controlling the onboard LED is as simple as sending an MQTT message to topic cmnd/[ and then the name of name of your sonoff]/LedPower with a payload of either 1 for on, or zero for off.  In NodeRED I have an events state node with the entity ID for the garage door, a function node that turns the on and off payloads into 1s and 0s, and an MQTT publish topic to the topic cmnd/Garage_Entry/LedPower.

I designed 3D printed decora switch plates for the push buttons that operate the sonoffs.  For the plate that has the alarm indicator I printed a special switch plate at 95% infill that has a thinner silhouette of an alarm bell included in it, this allows the light to shine through the alarm icon, but not through the rest of the switch panel giving it a nice effect.

If you don’t have access to a 3d printer you can also buy these metal decora blanks from lowes and drill out a hole for the button.  After you’ve got a hole for the button you can drill a smaller hole underneath it to act as your indicator LED.  I bought some f these plastic earring backers to defuse the light and give it a more finished look than just a hole.

A side note on this:  Amazon is amazing for so many products but switch plates and blanks are an exception.  You’ll pay at least twice as much on amazon as you would just going to Lowes or Home Depot.  Moving on!

The second feature you may not know about is the ability to send both a short press and a long press command with your sonoff buttons.  Normally I have my short button press tied to whatever switch I replaced with the sonoff, but by utilizing the hold functionality I can activate any of my switches, automations or scripts from home assistant.  For instance, I am almost always the last person awake in my house and it’s my job to make sure all the lights are off, the doors are locked, and the alarm is on.  I’ve created a flow in node red that turns does all of this stuff at once, and I’ve set the trigger for this action to be the message  “HOLD” on the topic cmnd/uplights/POWER, which is the topic of the sonoff that is closest to my desk.

To set this up you’ll utilize the following commands in the tasmota console:

First you’ll need to set your switchmode.  Most people utilize switchmode 4 when using momentary push button switches, but switchmode 5 is the same as 4, but with the hold functionality enabled.

The second thing you need to do to get the hold functionality working is to set a custom topic using switchtopic.  If you want to keep your default switch topic just copy your default topic from one of the messages in the console and then type switchtopic (space) and then paste in your old topic name.  Now when you short press it sends a on/off command, and a long press sends the hold command.

By default the hold command activates after 4 seconds, but you can change that if you’d like by typing SetOption32 and then entering the hold time you want in deciseconds… in other words if you wanted to hold for 1 second you’d type SetOption32 (space) 10, for 4 seconds you’d type 40… you get the idea.

Tasmota is full of other features that are just waiting to be utilized.  Let me know down in the comments if you’ve found any other hidden features that you use in automation.

If you enjoyed this video please consider subscribing.  As always, thanks for watching the hookup.


Sonoff Basic (6 pack): https://amzn.to/2vmAvBU
Chrome Push Buttons: https://amzn.to/2qFUbw2
Earring Backers(LED Diffusers): https://amzn.to/2HcC07n

Node Red Function Node to Convert on/off to 1/0:

Decora Switch Plate .stl file:


Support my channel:
Patreon: https://www.patreon.com/thehookup

music by www.bensound.com

Related Posts