READ THIS UPDATE!!!!
Tasmota updates have changed some necessary settings!
Here's what you need now: (Thanks Chris Norton)
Switchretain 1
Powerretain 1
switchtopic2 garagestate
switchmode1 0
switchmode2 2
GPIO 14 to 10 Switch2
GPIO 4 to 22 Relay2
cover.yaml
- platform: mqtt
name: "Sonoff SV Garage"
state_topic: "cmnd/garagestate/POWER2"
command_topic: "cmnd/sonoffsv01/POWER"
payload_open: "ON"
payload_close: "ON"
payload_stop: "ON"
state_open: "ON"
state_closed: "OFF"
optimistic: false
customize.yaml
cover.sonoff_sv_garage:
device_class: garage
friendly_name: Garage
group.yaml
Garage Door:
name: Garage Door
view: no
control: hidden
icon: mdi:garage
entities:
- cover.sonoff_sv_garage
just thought I’d share the full details of a sonoff sv garage switch with 6.2.1 firmware.
A few common problems people have can be solved by:
#1 - in the Tasmota Console, type "Switchretain 1". That will make it so HA gets the last state from the door sensor after a reboot.
#2 - pick an unused GPIO pin on the Sonoff SV and set it as "Relay2". Use D4 or D5, not D1 or D3. That should stop the reed switch from triggering the relay. I haven't had to do this, but I think it may be because I'm using an older version of Tasmota.
#3 - in the Tasmota Console type "Powerretain 1". That will stop the relay from randomly triggering when the Sonoff disconnects and reconnects to the MQTT broker.
I know I went kinda fast in this one. Everything you need is here.
To Smarten up your garage doors you’ll need:
Sonoff SV [ Ссылка ]
Reed Switch [ Ссылка ]
USB cord and wall plug or some other power adapter
Jumper wires [ Ссылка ]
Soap dish [ Ссылка ]
There is soldering involved. No way around it on this one
Garage SV setup
Open sonoff.ino
Set a project name and your Wifi and MQTT info in user_config.h
Upload Tasmota
Find the IP address of your new Tasmotized Sonoff (you can look in your router)
Put the Sonoff IP address in your browser, go to Configuration Configure Module and and change the Module Type to Sonoff SV. Save and it’ll restart.
Go back into Configure Module and set GPIO 14 to Switch2 save and it’ll restart again
Click Console and type: switchmode1 0 and then switchmode2 2, restart one more time
Now we’ve got some work to do in Home Assistant
Open configuration.yaml
Make a heading called “cover:” and paste these lines
cover:
- platform: mqtt
name: "test"
state_topic: "cmnd/2/POWER2"
command_topic: "cmnd/sonoffSV04/POWER"
payload_open: "ON"
payload_close: "ON"
payload_stop: "ON"
state_open: "ON"
state_closed: "OFF"
optomistic: false
retain: false
Under Customize: set the device class and give it a friendly name
cover.test:
device_class: garage
friendly_name: Justin Garage
If you want to make a card that says Garage Doors instead of Cover then open your groups.yaml. If you don’t have one just create and new empty file with that name and past these lines.
garage_doors:
name: Garage Doors
view: no
control: hidden
icon: mdi:garage
entities:
- cover.test
Save both config and groups. In Home Assistant UI check the config and restart.
Now go to the Automation editor, make a new automation. The trigger is the MQTT topic that fires whenever the relay is turned ON. The action is to turn it back off after one second. Save and reload Automations.
Now the hardware setup:
To isolate the power to the ESP chip from what’s being switched by the relay, use a small screwdriver to pop the 2 resistors.
Solder 2 lengths of small wire, one on the Input + and one on the output +, these wires will connect to the switch contacts on your garage door motor.
Connect female end of jumper wires to GPIO 14 and Ground. These are going to the reed switch and will tell you if the garage is open or closed.
Use a USB cable for power. The red wire is + and the uncovered wire and the outer metal sheath are negative.
Connect those to female jumpers and plug them into + and - for the ESP chip.
Test:
Lay it out. Connect the reed switch, power up the board, and open Home Assistant.
Move the magnet to test the reed switch
Click the open/close buttons to check the relay.
If it all works it’s time to install
Install:
I put mine up near the garage motor. You don’t have to do it this way.
Mount the reed switch. I put mine on the track and the magnet on the top of the door. Took a few tries to find something that would keep them connected. There’s a lot of motion on that track.
Find the contacts for your open/close button. Connect the wire from the input side of the relay to one contact, and the wire from the output side to the other.
On my garage door those wires are 12v.
Connect the +/- jumpers from the USB cord, for power to the ESP, and plug it in.
You’re done!
![](https://i.ytimg.com/vi/QMepwpyjMCY/mqdefault.jpg)