DIY Smart Home - Ep#7 | Smart Garage Door Solutions | How to with no fees or cloud
UPDATE: The Shelly1 process shown in this video is the easy no solder method.
We added a bit of DIY automation to the garage door for minimal costs and of course without any fees or forced cloud control Taking a deep dive for the new folks to the DIY Garage scene and for the semi-DIY'ers we also show some other easy solutions.
Parts
Moes Garage Door Opener (not a recommended choice unless you like this hardware) Shelly1 or Sonoff SV is my recommendation
Tasmota Garage Setup & Rules (for easy copy and paste from the video)
ATTN Shelly1 Users! Use the Shelly1 Section at the bottom of this post for modified rules/commands (the below is for the Sonoff SV)
switchmode2 1
poweronstate 0
setoption0 0
pulsetime1 10
(This rule below should all be pasted at one time)
Rule1 on switch2#state=0 do publish2 stat/%topic%/status closed endon on switch2#state=1 do publish2 stat/%topic%/status open endon
Turn on the rule with this command:
Rule1 1
Sonoff SV - YAML Config
cover:
- platform: mqtt
name: "Garage Door"
command_topic: "cmnd/GarageDoor/POWER"
state_topic: "stat/GarageDoor/status"
availability_topic: "tele/GarageDoor/LWT"
qos: 1
payload_available: "Online"
payload_not_available: "Offline"
payload_open: "ON"
payload_close: "ON"
payload_stop: "ON"
state_open: "open"
state_closed: "closed"
device_class: garage
Change the MQTT Topic of "GarageDoor" in all three spots if you use a different topic in the Tasmota MQTT Config
How to Utilize a Wireless Door/Window Sensor (Wyze, Zwave, Zigbee, 433mhz etc)
Setup the wireless sensor in Home Assistant and verify it is working. The switch2 rule and setup of the wired reed sensor will not be needed in Tasmota. You will still need the pulsetime1 command done to only make the relay toggle for the short period to simulate the garage door button push.
Create an automation in Home Assistant either via the YAML editor or Automation GUI as follows. Edit the binary_sensor and MQTT topic name as needed. This will push the state of the wireless sensor state changes into MQTT which Home Assistant will then read as an all in one sensor/relay from the Garage Door. A small but quick loop around trick!
YAML Method
- id: '15912322314808'
alias: Reed2MQTT
description: ''
trigger:
- entity_id: binary_sensor.wyzebenchreed
platform: state
action:
- data:
payload_template: "{{ states('binary_sensor.wyzebenchreed') }}"
topic: stat/GarageDoor/status
service: mqtt.publish
GUI Method
YAML Config for secondary reed sensor (small change to state payloads)
cover:
- platform: mqtt
name: "Garage Door"
command_topic: "cmnd/GarageDoor/POWER"
state_topic: "stat/GarageDoor/status"
availability_topic: "tele/GarageDoor/LWT"
qos: 1
payload_available: "Online"
payload_not_available: "Offline"
payload_open: "ON"
payload_close: "ON"
payload_stop: "ON"
state_open: "on"
state_closed: "off"
device_class: garage
Shelly 1 Tasmota Garage Setup & Rules
switchmode1 2
poweronstate 0
setoption0 0
pulsetime1 10
(This rule below should all be pasted at one time)
Rule1 on switch1#state=0 do publish2 stat/%topic%/status closed endon on switch1#state=1 do publish2 stat/%topic%/status open endon
Turn on the rule with this command:
Rule1 1
Shelly1 YAML Config
cover:
- platform: mqtt
name: "Garage Door"
command_topic: "cmnd/GarageDoor/POWER"
state_topic: "stat/GarageDoor/status"
availability_topic: "tele/GarageDoor/LWT"
qos: 1
payload_available: "Online"
payload_not_available: "Offline"
payload_open: "ON"
payload_close: "ON"
payload_stop: "ON"
state_open: "open"
state_closed: "closed"
device_class: garage
Can't see the little garage door being up or down in the Home Assistant GUI? Create an easy to read binary sensor
Secondary Binary Sensor YAML Config
binary_sensor:
- platform: mqtt
name: "Garage Door State"
state_topic: "stat/GarageDoor/status"
payload_on: "open"
payload_off: "closed"
availability_topic: "tele/GarageDoor/LWT"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
device_class: opening
-=-=-=-Products We Use/Recommend-=-=-=-
Amazon US - https://amzn.to/2YZNDeO
Amazon UK - https://amzn.to/2TnG2R4
Amazon CA - https://amzn.to/2HchPZe
-=-=-=-Come chat with us!-=-=-=-
Discord - https://discord.gg/bNtTF2v
Patreon - https://www.patreon.com/digiblurDIY
Hey,
ReplyDeleteI have subscribed to your channel on youtube and looked just the latest videos of smart garage door. I have a similar project where I am installing in my warehouse electric lock.
But I'm having trouble getting the lock reed switch to work.
I also have a tasmotised sonoff sv which is modified in isolated mode and the reed switch is connected to the gpio 14 pin.
I know the reed switch works and I have the right cables connected because if I move the door then sonoff sv behaves the same as in your video before you modified the settings from the console.
Can you help me get the reed switch to work in sonoff sv and get the information about the door status sent to the home assistant.
Best regards
Mika Nenonen
That might not be bad to solve but probably easier to jump into the discord chat server and hit me up instead of the messaging back and forth here.
DeleteThanks for the great tutorial!
ReplyDeleteI am having trouble with the Home Assistant portion. When I paste the yaml into config.yaml my entity shows an error. It shows unavailable. I used the all the same names but I don't get the arrows in HA.
Any thoughts?
Thanks!
It might help to jump into the discord chat with the link above but in the meantime. Make sure the availability topic matches yours in your Tasmota device. A real easy way is to go to the console of Tasmota and type "restart 1" (no quotes) and hit enter. It will reboot and look for the LWT = online message. Make sure yours matches.
DeleteThanks!!
DeleteThis comment has been removed by the author.
ReplyDeleteThanks for this great tutorial. I have sonoff SV. The reed switch is located at the opener so I used switchmode2 2 indicating that when the circuit is closed the door is open and vice versa. Hopefully I got that right. When opening the door, I am seeing the rule trigger and the correct state (open) being sent but then immediately is reverts back to closed. I have reset the SV and redone the SV 2x and keep getting this issue. Here is the console output:
ReplyDelete00:39:12 MQT: stat/GarageDoor/POWER = ON
00:39:13 MQT: stat/GarageDoor/RESULT = {"POWER":"OFF"}
00:39:13 MQT: stat/GarageDoor/POWER = OFF
00:39:32 MQT: stat/GarageDoor/RESULT = {"POWER":"ON"}
00:39:32 MQT: stat/GarageDoor/POWER = ON
00:39:33 MQT: stat/GarageDoor/RESULT = {"POWER":"OFF"}
00:39:33 MQT: stat/GarageDoor/POWER = OFF
00:39:37 RUL: SWITCH2#STATE=1 performs "publish2 stat/GarageDoor/status open"
00:39:37 MQT: stat/GarageDoor/status = open (retained)
00:39:37 RUL: SWITCH2#STATE=0 performs "publish2 stat/GarageDoor/status closed"
00:39:37 MQT: stat/GarageDoor/status = closed (retained)
The garage door is opening, setting the status to open and then flipping it right back to closed. Do you know what is causing this?
Something with your reed sensor I would suspect. You can easily see if you take the two wires of the reed switch and twist them together...then open them up, see if they toggle by themselves .
DeleteYep that was it. I had them mounted horizontally. When I moved them to a vertical mount they work fine. Thanks!
DeleteGreat tutorial. I built 2 of them at the same time for both garage doors and they work great. I always expect working with HA that there is going to be some bugs to work out but not this time. It all worked exactly as expected.
ReplyDeleteCould you do this with a Shelly 2.5 for two doors?
ReplyDeleteNot directly as the Shelly isn't a dry contact device so you'd be sending mains voltage to the reed sensor and mains voltage into the garage opener. Not a good idea at all.
DeleteGreat guide -- big help to get this going here. Below is the Tasmota rule building on yours that I got some help with. It's more complex due to a conditional AND by using variables. Since the reed switch/sensor is closed when the door is closed, the effect produced is when open (reed == 0) and power triggers a closing message gets published for a few seconds (until reed == 1).
ReplyDelete`
RULE1
ON switch2#state=1 DO publish2 home-assistant/cover/state closed ENDON
ON switch2#state=0 DO Backlog var1 1; publish2 home-assistant/cover/state open; ENDON
ON power1#state=1 DO var2 %value% ENDON
ON var2#state=%var1% DO Backlog var1 0; publish home-assistant/cover/state closing ENDON
`
More complex > more edge cases. Room for improvement is (1) to set a default for var1 upon boot, and (2) in the case where status is still 'closing' after a 15 second timer finishes would indicate a problem like something's in the way, and so republished 'open' instead of sitting in a 'closing' state