Moes Garage Door Opener - Tasmota

In an upcoming video on the DIY Smart Home series, we planned to "smartify" the garage door and, of course, it had to be local control without all the fees and ever changing nonsense and security issues that the cloud brings.  One option we picked up was using the Sonoff SV to try, but as an alternative the Moes version of the garage door opener is easy to install.  Out of the box it does come with Tuya/Smart Life firmware, but of course we wanted to get rid of that, and put open source local control software such as Tasmota on it.  Moes Garage Door Opener on Amazon




At first glance you might be thinking that someone simply took a Sonoff basic, added a couple wires, and repackaged it; unfortunately that isn't true.  If it was as easy as a Sonoff Basic, we probably wouldn't be writing this article on how to get it to work with Tasmota.  It does have a Tuya module inside, and as of the writing of this article, Tuya-Convert does work on the device.  But before I was quick to convert it, I decided to pop it open and found that it was sporting a TuyaMCU onboard!  I had this funny feeling they were doing something odd and decided to do a bit of sniffing on the TuyaMCU RX/TX serial lines first, and I was glad I did!  So after a couple of Live Streams on YouTube of the process, and banging my head against the wall a bit, I present to you the rules necessary to set this little guy up.  


Live Stream #1 & Live Stream #2 on YouTube


Flash the device with either soldering to the chip via USB TTL and Tasmotizer, or use Tuya-Convert.  Do the dance to get the device on your WiFi like you normally would, and browse to the Tasmota GUI using the local IP of the device found from your Router/DHCP Server.  As always upgrade to teh latest Tasmota by utilizing the Firmware Upgrade button in the GUI. Configure your MQTT Broker and Custom Topic like you normally would, then click the Console Button and paste these commands in one by one:


template {"NAME":"Moes Garage","GPIO":[255,148,255,149,255,255,255,255,255,255,21,255,255],"FLAG":15,"BASE":18}

module 0


At this point, the device should reboot. Now you might be thinking “Why don't we just use TuyaMCU built into Tasmota?”  The problem with that is during any reboot of the device, it was cycling the relay which could cause your garage door to open at 3 AM!  So we do it raw, plus add a few features!  Go back to the console of Tasmota, and enter these commands in (be careful to grab the entire rule due to word wrapping):


Rule1 on System#Boot do backlog baudrate 9600 ; serialsend5 55aa000300010407 ; serialsend5 55AA0008000007 ; ruletimer1 10 endon on rules#timer=1 do backlog serialsend5 55AA00000000FF ; ruletimer1 10 endon


Rule1 1


This rule sets up the serial communication at boot, sets the LED, sends a command to query the state of the reed switch (i.e., garage door position) in case it changed while the power was off, and then sets up the 10 second heartbeat packet the TuyaMCU requires.


Rule2 on event#doortoggle do serialsend5 55AA0006000501010001000D endon


Rule2 1


This creates an event that is sent from your home automation software (via MQTT) to toggle the relay which opens/closes the garage door.  OK, now for the last rule, and this all on one line!


Rule3 on SerialReceived#Data=55AA0307000565010001007555AA03070005010100010011 do power1 1 endon on SerialReceived#Data=55AA0307000501010001001155AA0307000807020004000000001E55AA03070005650100010075 do power1 1 endon on SerialReceived#Data=55AA0307000565010001017655AA03070005010100010112 do power1 0 endon on SerialReceived#Data=55AA0307000501010001011255AA0307000807020004000000001E55AA03070005650100010176 do power1 0 endon


Rule3 1


This rule watches the TuyaMCU packets for the garage door state (open or closed) via the magnetic reed switch attached to the door.  This rule toggles the fake relay on the Tasmota GUI and can be monitored via the power1 MQTT topic.  


powerretain 1

Makes the state of the door being open or closed be retained during a Home Assistant reboot.

Restart the Garage Door Opener.  You can use the Restart button on the GUI of Tasmota.

View on Amazon - Moes Garage Door Opener


But wait . . . can't we do this without all these serial rules on Tasmota with a Sonoff SV?  Absolutely!  But you do have to remember this is an alternative solution that is ready to go in the case, without any wire soldering, 3D printed cases, etc.  Options for everyone, choose the one that best fits your needs.


Home Assistant Sample Configurations


Modify the “GarageDoor” topic below to match the unique topic set in the Tasmota MQTT Configuration:


cover:

  - platform: mqtt

    name: "Garage Door"

    command_topic: "cmnd/GarageDoor/event"

    state_topic: "stat/GarageDoor/POWER"

    availability_topic: "tele/GarageDoor/LWT"

    qos: 1

    payload_available: "Online"

    payload_not_available: "Offline"

    payload_open: "doortoggle"

    payload_close: "doortoggle"

    payload_stop: "doortoggle"

    state_open: "OFF"

    state_closed: "ON"

    device_class: garage


Swap the states of OFF/ON if your status is backwards depending on how the sensor is used/mounted.


Moes Garage Door Opener

Door Sensor and Wire

Accessories for Installation Included







Comments

  1. Thanks for sharing the instructions/video on how to set this up. Followed all the directions and was able to set this up in home assistant. The only thing that I had to change was I had to reverse the settings for the state_open and state_close. In my case state_open = "on" and state_open = "off".

    ReplyDelete
    Replies
    1. Thanks! I'll be sure to note that as I could have gotten it backwards and could also depend on how the sensor is installed for some.

      Delete
  2. I had to add 'device_class: "GARAGE"' to get this to work with Google Assistant. Thanks for the tutorial. Worked great!

    ReplyDelete
  3. Cool project.. I’m just getting into tasmota and trying to install this, but for now I would rather use the rest api since i don't have mqtt. I see that I can get the sensor state by looking at the power property returned from http://devip/cm?cmnd=status but how can I call the toggledoor command? doing a Power On or Power Off command is cycling the value but does not seem to be triggering the contact to open/close the door.

    ReplyDelete
    Replies
    1. got it.. I could not find this syntax anywhere in the tasmota docs but found it by trial and error:
      http://deviceip/cm?cmnd=event=doortoggle

      This is cool, I'd really like to add a 2nd sensor though. It would be better to have one for open and one for closed. This way you would be able to detect if one of the sensors came loose or if the garage got stuck in the middle for some reason.

      Delete
    2. This is my plan as well before I do some automations on it. I am going to use a Wyze door sensor so I have a little bit of a isolation and both sensors will have to be in agreement before any door commands are sent.

      Delete
    3. My garage doors are opening whenever I restart my home assistant. Do you guys experience the same thing? If so, could you share the steps you used to resolve this? Thanks.

      Delete
    4. Actually, the doors open when I restart proxmox. Do you know why this could be happening? Thanks.

      Delete
    5. You probably have a retained MQTT command and when it reconnects MQTT it sends the message like it is supposed to. This helps explain the why and how to fix it. https://youtu.be/dbSw6VkI-x4

      Delete
    6. Thanks for your reply. I have followed the instructions on your video and sure enough I had retained toggles on both doors. So glad I do not have to worry about my doors suddenly opening.

      Delete
  4. As always thanks for the work. I purchased this one https://www.amazon.ca/gp/product/B0823DXG15/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1
    do you think it is the same as the moes. I have opened it and has the TYWE2s unit in it that stands vertical on mainboard

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. I already have a Meross/Refoss unit installed with its own app but I'd like to converge on using just two apps (from the multitude that I currently have), HomeKit for video and HomeAssistant for everything else.

    For the garage, I was intrigued by the OpenGarage unit which has a built-in ultrasonic distance sensor (car/no-car) as well as inputs for a reed sensor (door ipen/close) but am unsure as to how well its MQTT implementation would integrate with HA.

    This is a mild DIY and there seem to be a number of clones of this on Amazon that look identical (except that some of them are white) and all use the Smart Life app. Since they are at different prices, maybe I will buy the cheapest one and see if these instructions work :-)

    I'm also looking forward to the integration of the Wyze sensor at the other end of the door's possible range of movement.

    ReplyDelete
  8. Hopefully this isn't too dumb of a question, but can the tuya-convert be undone to return to stock? Looking at the instructions, it seemed so...but...just figured I would check with an expert ;)

    ReplyDelete
    Replies
    1. No, you'd need to have a serial back up to go back to the cloud.

      Delete
  9. I finally ordered the Moes unit. Is the state of the art still to do the configuration manually instead of using module type 54 aka TuyaMCU or did Tasmota 8.5.1 fix the shortcomings?

    ReplyDelete
    Replies
    1. I haven't tried the new versions to see if that reboot stops from opening the door.

      Delete
    2. I got mine today and it did not flash OTA. Did I misunderstand the discussion and i should not have expected it to flash this way or should i try my luck with one of the clones to see if it has the older firmware which will reflash with tuya-convert?

      Thanks

      Delete
    3. I was meaning new versions of Tasmota.

      Delete
    4. Thanks for the clarification.

      Apparently the ID: in the smarthack-psk.log produced by tuya-convert needs to begin with 01 for reflashing with tasmota to work and I was seeing 02.

      I've ordered another unit to try out.

      Delete
    5. The new unit reflashed to Tasmota! This weekend I will try it on my garage door.

      Delete
  10. Hey thanks so much for this guide. I got it all done, but can't seem to control the door via the tasmoto interface. The url: http://deviceip/cm?cmnd=event=doortoggle did open/close, but using the toggle button in the tasmoto web page didn't. i didn't see any issues when entering the commands in the console. Also not sure what i'm missing to see the status in HA - the toggle doesn't seem to work from there either. thanks in advance.

    ReplyDelete
    Replies
    1. Check your topic name/order against what is in the YAML config. Open the Tasmota console and you'll see the exact name/order of it.

      Delete
    2. Here's the last bit of the console after hitting "toggle" to ON in the tasmoto ui:

      20:18:44 MQT: GarageDoor/stat/RESULT = {"SerialSend":"Done"}
      20:18:45 MQT: GarageDoor/tele/RESULT = {"SerialReceived":"55AA030000010104"}
      20:18:45 MQT: GarageDoor/stat/RESULT = {"T1":10,"T2":0,"T3":0,"T4":0,"T5":0,"T6":0,"T7":0,"T8":0}
      20:18:46 MQT: GarageDoor/tele/STATE = {"Time":"2020-11-04T20:18:46","Uptime":"0T00:56:50","UptimeSec":3410,"Heap":28,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"ON","Wifi":{"AP":1,"SSId":"ktvrouter","BSSId":"8C:3B:AD:E7:28:08","Channel":1,"RSSI":62,"Signal":-69,"LinkCount":1,"Downtime":"0T00:00:06"}}
      20:18:46 MQT: GarageDoor/stat/RESULT = {"POWER":"ON"}
      20:18:46 MQT: GarageDoor/stat/POWER = ON (retained)

      From the MQTT config page:
      topic = GarageDoor
      full topic = %topic%/%prefix%/

      I just used your "cover" text in the YAML config, but that seems secondary anyway since we would need the toggle button in Tasmota to work first ( I would have thought ).

      Delete
    3. Yep, your topics are flipped. You'll need to follow that on your YAML config too since you made that change.

      Delete
    4. So I tried to change the full topic to %prefix%/%topic%/ but it won't save that.

      In any case, the toggle button in Tasmota still doesn't work ... which tells me something more basic is broken. before MQTT can work, doesn't Tasmota have to be able to control the door? Seems more like one of the settings related to gpio ... ? Anyway i can confirm that?

      The YAML config only comes into play in HA, but I can't get the door to respond to the Tasmota web page.

      thanks again, and sorry for the bother from a noob...

      Delete
  11. now I think i know why it keeps reverting ...

    The order of %prefix% and %topic% doesn't matter, unless you have enabled Auto-discovery for Home Assistant (SetOption19). Enabling this option re-formats the FullTopic to required order.

    I have been doing SetOption19 on to get HA to auto discover.

    Still not sure what that has to do with it...

    ReplyDelete
    Replies
    1. Been many versions since they flipped around and setoption19 doesn't work with this anyways.

      Delete
    2. If the topic doesn't match then HA is sending/receiving on the wrong topics.

      Delete
    3. ok. i don't quite understand, but I'll try to change the topic/prefix order and get it to work. ( although I thought i did )

      The autodiscovery did seem to work, HA saw the opener after I did that option 19 thing.

      Delete
    4. Trying commands from the console ... these are not doing anyhing.

      02:00:11 CMD: cmnd/GarageDoor/POWER = toggle
      02:00:11 MQT: stat/GarageDoor/RESULT = {"POWER":"ON"}
      02:00:11 MQT: stat/GarageDoor/POWER = ON (retained)
      02:00:28 CMD: cmnd/GarageDoor/POWER = toggle
      02:00:28 MQT: stat/GarageDoor/RESULT = {"POWER":"ON"}
      02:00:28 MQT: stat/GarageDoor/POWER = ON (retained)
      02:00:41 CMD: cmnd/GarageDoor/Power = OFF
      02:00:41 MQT: stat/GarageDoor/RESULT = {"POWER":"ON"}
      02:00:41 MQT: stat/GarageDoor/POWER = ON (retained)

      ( toggle, on or off ) ... Pretty sure I have the prefix/topic set correctly now. ( in that order prefix/topic )

      I'm so lost!

      Delete
    5. I would suggest to follow the guide closely then, I do encourage folks to modify projects to fit them but with this comes changes of course that might be a little advanced.

      Delete

Post a Comment