So, I got the idea from watching Dr. Zzz's video where he built his garage door controller (version 2) with a Sonoff SV. He was switching line voltage so he needed to remove a couple of resistors from the board to isolate the control/wifi circuit from the line voltage. Luckily, my garage door opener has a 24V control circuit so I can power the device and switch the signal to the door opener button without any additional power supply. Here's his video:
https://www.youtube.com/watch?v=QMepwpyjMCY
Also, this video was helpful in learning how to decouple the secondary switch input to use as a binary door sensor:
https://www.youtube.com/watch?v=qZqmkhpJ55A
You need to decouple the secondary switch input as normally this would control the relay, and we don't want that. The relay is for opening/closing the door. I wanted to use the secondary switch input as a sensor to see if the door is physically open or closed. I used:
- Sonoff SV (the low-voltage version of the basic), flashed with Tasmota.
- Enclosure. The one I got was made for a Sonoff basic, I thought the mounting would be the same as for the SV but it wasn't *facepalm* I glued 4 lego blocks as mounting studs and mounted the board to that.
- Wired reed-type door sensor.
Watch the videos and pay extra attention to the console commands needed in Tasmota to change the function of the SV. For me, I needed a momentary switch so that when the device is activated it powers the relay for 1 second (this can also be done in the automation if you prefer). You also need the console commands to decouple the secondary switch input switchtopic [name of your switch] and you can also set it to be NO or NC using switchmode2. See the second video or the docs here: https://tasmota.github.io/docs/Commands/
Getting it integrated in HA wasn't easy but a good learning experience. I changed the device type of the entity to a garage door and now the icon looks right and even shows open/closed. More work was needed to get it looking nice in Lovelace and working as a pushbutton. FYI, if you did the Tasmota configuration correctly, HA should discover 3 entities related to the device:
- The switch itself
- A wifi signal strength
- Binary sensor (this is the one I changed the device type to garage to get the icons for open/closed working)