Chamberlain MyQ Binding

It’s been stated multiple times in the thread.

Ratgdo connects to the actual communication bus of the opener, so not only gives reliable control of the door, but you get built in feedback on the current state of the door. As well as feedback and control of other features, such as the light, if a physical opener button was pressed, motion sensor in the wall control if you have one, obstruction sensor status, lockout of remotes, and precise positioning of the door. Some of those features may require the esphome firmware (which is still via MQTT!), which also offers auto-discovery and configuration in openHAB as long as you’re on 4.1.0. The only caveat with the esphome firmware is there may be issues disabling the homeassistant portion unless you fully customize and flash the configuration yourself.

In terms of installation, ratgdo requires a usb power source, and then three wires between the device and the opener, all located at the opener itself.

For a Shelly-style integration, you’ll most likely be soldering on to your wall control or an extra remote, and having an additional tilt or contact sensor on the door to give you status, which will be at best “opened” or “closed” - no indication of how far open or close, or if the motor is currently moving (and in which direction). It may be possible to control the light via an additional relay, but no indication of it’s currently on or off.

Esphome is still MQTT? Cause I don’t see any configuration for MQTT with esphome. It’s even stated one or the other.

When I used the esphome one, I had many thing not working with the autodiscovery. That’s why I revert to MQTT. Only thing not working is precise door positioning and motion sensor doesn’t return to clear state

ESPHome can use the Home Assistant native API and/or MQTT. When using MQTT in ESPHome, you could configure openHAB manually, or ESPHome also publishes discovery information in the Home Assistant convention, which openHAB supports to varying degrees.

And yes, with openHAB 4.0, there were discovery issues with the cover component. Those have been fixed in 4.1.

When I get some time, I’ll put together a simple ESPHome config that’s usable with openHAB.

Gotcha, thanks. I used shelly 1’s on my doors with a reed switch which works just fine, no soldering needed and it is hidden on top of the door motors. The reed switch is on the belt so i don’t need to know up/down, just belt position. Correct in that it only shows open/closed and doesn’t integrate lights or motion sensors though. But it also leaves in place safety’s like the beam sensors. And I already have openhab integrated lights and motion detection in the garage from other devices anyway, but it would be nice to know at a glance if the motor is turning.

But the ratgdo definitely seems to have more going on.

Maybe it helps other people :slight_smile: This is my setup now:

Ratgdo-Board: esphome-ratgdo/static/v25iboard.png at main · ratgdo/esphome-ratgdo · GitHub
Firmware: ESPHome with MQTT

If you want to use MQTT in ESPHome, you have to “build” your own FW based on YAML.
YAML configuration: esphome-ratgdo/static/v25iboard.yaml at main · ratgdo/esphome-ratgdo · GitHub

Add MQTT:

e.g

mqtt:
broker: 192.168.x.xx
username: xxx
password: xxx
topic_prefix: garagedoor

Complete YAML:

substitutions:
  id_prefix: ratgdov25i
  friendly_name: "ratgdov2.5i"
  uart_tx_pin: D1
  uart_rx_pin: D2
  input_obst_pin: D7
  status_door_pin: D0
  status_obstruction_pin: D8
  dry_contact_open_pin: D5
  dry_contact_close_pin: D6
  dry_contact_light_pin: D3

web_server:

esphome:
  name: ${id_prefix}
  friendly_name: ${friendly_name}
  name_add_mac_suffix: true
  project:
    name: ratgdo.esphome
    version: "2.5i"

esp8266:
  board: d1_mini
  restore_from_flash: true

dashboard_import:
  package_import_url: github://ratgdo/esphome-ratgdo/v25iboard.yaml@main

packages:
  remote_package:
    url: https://github.com/ratgdo/esphome-ratgdo
    files: [base.yaml]
    refresh: 1s

# Sync time with Home Assistant.
time:
  - platform: homeassistant
    id: homeassistant_time

mqtt:
  broker: 192.168.x.xx 
  username: xxx
  password: xxx
  topic_prefix: garagedoor

ota:

improv_serial:

wifi:
  ap:

logger:T:

Thing and Channels in openHAB

Thing topic garagedoor "MQTT Garagedoor" {
Channels:
	Type rollershutter : garagedoor "Steuerung" [ stateTopic="garagedoor/cover/door/position/state", transformationPattern="JS:invertpercent.js", commandTopic="garagedoor/cover/door/position/command", transformationPatternOut="JS:invertpercent.js" ]
	Type switch : light "Licht" [ stateTopic="garagedoor/light/light/state", transformationPattern="JSONPATH:$.state", commandTopic="garagedoor/light/light/command", formatBeforePublish="{\"state\":\"%s\"}" ]
	Type string : status "Status" [ stateTopic="garagedoor/cover/door/state" ]
	Type string : obstruction "Hindernis" [ stateTopic="garagedoor/binary_sensor/obstruction/state" ]
	Type number : openings "Openings" [ stateTopic="garagedoor/sensor/openings/state" ]
}

invertpercent.js

(function(i)  {
   var percent_esphome = parseInt(i,10);
   var percent_oh = (100.0- percent_esphome);
   return percent_oh.toFixed(0);
})(input)
1 Like

You might be able to help me on that. I’ve read all about that famous yaml file but what do you do with it? Like right now, my ratgdo is installed with mqtt version not esphome. If I flash with esphome, what do I do with the yaml file now?

You can not load the standard Ratgdo-ESPHome Firmware. Instead you need to upload your own Firmware based an a YAML-File. This page should help:

## First uploading

Now you can go ahead and add some more components. Once you feel like you have something you want to upload to your ESP board, simply plug in the device via USB and type the following command (replacing livingroom.yaml with your configuration file):

esphome run livingroom.yaml

I’m also not really an expert and I have uploaded the YAML in Home Assistant to the board. The following YouTub-Video helped me to setup, but it is in German :wink:

But I have setup Home Assistant only to load the Ratgdo and switched off again (another Raspi). Not sure if Ratgdo does need Home Assistant to run properly. At least time sync is with Home Assistant in YAML-File. Maybe I should change this to NTP-Time-Server. But as already mentioned…also beginner :slight_smile: Right now I can control without running Home Assistant.

Update 1: I have changed now time sync in YAML to:

time:
  - platform: sntp
    id: sntp_time
    timezone: Europe/Zurich
    servers:
     - 0.pool.ntp.org
     - 1.pool.ntp.org
     - 2.pool.ntp.org

Did you not have issues with homeassistant.service call at https://github.com/ratgdo/esphome-ratgdo/blob/main/base.yaml#L19 because you don’t have homeassistant configured? I had to copy the whole base configuration, and remove that. I think you can use remove! directive, but I’m not sure how. Alternatively, if you have homeassistant configured, doesn’t your ESP reboot periodically?

Yes, that’s what I need to monitor now. I’ll try restarting the ratgdo device tonight without Home Assistant running. Could be that it won’t start if HA isn’t running. In any case, it would be better to remove the HA part completely. Thanks for the hint.

By the way, I only use ESPHome with openHAB because I had problems with the status (string) message with the pure MQTT version. I haven’t seen this with ESPHome yet. Maybe next weekend I’ll spend some time with the MQTT version again and open an issue.

Weird, I don’t have any problem with the status. Only thing that doesn’t work is the rollershutter in MQTT, always says 0, and the motion detector that doesn’t reset to clear.

Not sure if you could use rollershutter. I only have used command “open”, “close” with switch item. MQTT version does not have the feature to report 0-100%. This is ESPHome only.

This was the setup I used for the pure MQTT version:

Thing topic garagedoor "MQTT Garagedoor" {
Channels:
	Type switch : command "Befehl" [ commandTopic="garage/Ratgdo29a/command/door", on="open", off="close" ]
	Type switch : light "Licht" [ stateTopic="garage/Ratgdo29a/status/light", commandTopic="garage/Ratgdo29a/command/light", on="on", off="off" ]
	Type string : status "Status" [ stateTopic="garage/Ratgdo29a/status/door" ]
	Type string : obstruction "Hindernis" [ stateTopic="garage/Ratgdo29a/status/obstruction" ]
}	

For motion sensor you could make use of “Expiration Timer”:
Item → Metadata → Add Metadata → Expiration Timer

e.g. update item state back to “clear” after 5 minutes:

I think this should work for your setup.

yeah that’s what I did with the expiration for the motion detector. I was only stating the difference between the esphome and mqtt version. I don’t have issue with mine reseting or crashing on mqtt only.

I had an issue where if I did not put in the correct MQTT credentials, the web UI would not load and I would be forced to re-flash the firmware. I tried to open a GitHub issue, but it seemed like issues had been turned off. I emailed the creator about it, but have not heard back.

While I’m typing, the reason I was messing with my MQTT credentials is that I was trying to get ratgdo to connect to my MQTT broker behind a reverse proxy so I could secure the traffic with an SSL certificate. I’m able to get OH and a couple other devices to connect to my broker through my proxy (Traefik), but I’ve been unsuccessful so far with my ratgdo. Anyone have any luck with this or any tips? Or am I unnecessarily worried about having my garage door MQTT messages flying around in plain text? I suppose my entire OH sitemap is available within my LAN without a password (not a feature I care for in OH), so maybe I shouldn’t care about the MQTT traffic.

New question, related to this but possibly a topic outside of the MyQ binding.

I installed Ratgdo on my doors and am so far happy with it. But my two garage door things are still there, and I’m unable to delete them. I’ve removed the binding and all related files (had the latest snapshot installed) and tried removing the things. But the thing state will go to REMOVING and eventually come back as failed. Some reference to the thing is lurking somewhere and will not uninstall. Suggestions?

Use the karaf console (openhab-cli console). Then iirc it’s things remove <thing_uid>.

In state “REMOVING” you can just press remove again and then it asks you “Do you really want to force Remove?”.

I’d not used this console command before and after a few days, they haven’t reappeared. Thanks for the great advice!

are you still on esphome version? I’m still on mqtt and started to have trouble. It will report everything but not do any action when I send on/off command. I would see the light stating he received the command but nothing happen. On reddit, some people are saying they had same problem and had to flash ESPHome. Since ESPHome has yet to work out of the box with openhab, I’m not too interest in using it. Specially since mqtt is just what we need

Yes, I’m using the ESPHome version together with openHAB. But I have removed the part for Home Assistant in code and flashed with command line and not web installer.

But I have another problem with Ratgdo and my Chamberlain. After a while, it loses the connection and no longer reports the status of the garage door. My workaround: A rule that sends a “query status” to Ratgdo every hour. And the query status is available as a switch in openHAB if you use the ESPHome version. I tried the same with MQTT, but it never worked.

I’m having this same issue. Have you found a fix?