ratgdo / esphome-ratgdo

ratgdo for ESPHome
GNU General Public License v2.0
310 stars 79 forks source link

ETA on Esphome version for dry contact #130

Closed AdrianGarside closed 1 month ago

AdrianGarside commented 6 months ago

Just got my 2 ratgdos and didn't realize the support for dry contact wasn't present in the esphome version yet (my fault, didn't do enough reading). Is there an ETA for adding support for that to esphome? Since I installed/wired one before I realized this I'm wondering I should go ahead and take it down so I can reflash with the mqtt version of the firmware. Or if it might be coming soon enough that I can just table the setup for a week or tow.

rlowens commented 6 months ago

I think dry contact configuration for ESPHome would be pretty simple, since it doesn't need any custom code at all. See this example I just googled up https://github.com/athom-tech/athom-configs/blob/main/athom-garage-door.yaml (though that uses a single reed switch for closed and you probably have both "fully open" and "fully closed" switches connected, so you could get more info there instead of just assuming "not fully closed = open").

And as far as switching to the mqtt version: you should be able to just flash it OTA via the browser page. Download the firmware .bin file from https://github.com/PaulWieland/ratgdo/tree/main/docs/flasher (probably https://github.com/PaulWieland/ratgdo/blob/main/docs/flasher/ratgdo_esp8266_hV25_sV2.51.bin since you just got it) Click the "Visit" button in the ESPHome addon or open the IP of the ratgdo in a browser, then use the OTA Update option at the bottom.

AdrianGarside commented 6 months ago

Thanks. I clearly have some learnings ahead as I didn’t realize/know I could achieve it purely through generic esphome configuration yaml.

I discovered the existing mqtt firmware for dry contact currently requires 2 reed switches. I already have wireless tilt sensors installed and didn’t plan on the extra work to install wired reed switches on my two doors. So I suspect I want even simpler than the example config you pointed me at - I really just want to treat it as a simple momentary connect switch to toggle the door. I only bought ratgdo to reward Paul for his work to free everyone from the tyranny of myq and leave open the option to use it more fully later.

mariusmuja commented 6 months ago

Dry contact support is present in the configuration:

https://github.com/ratgdo/esphome-ratgdo/blob/main/base.yaml#L95

rlowens commented 6 months ago

Dry contact support is present in the configuration:

https://github.com/ratgdo/esphome-ratgdo/blob/main/base.yaml#L95

That's dry contact input to the ratgdo, which is controlling the GDO via Security+ 2.0. This issue is about having the ratgdo control non-Security+ GDOs which respond to dry contact inputs. Like this : image

Which is listed on the ratgdo feature matrix as "coming soon" for the esphome-ratgdo and homekit-ratgdo firmwares.

rlowens commented 6 months ago

Thanks. I clearly have some learnings ahead as I didn’t realize/know I could achieve it purely through generic esphome configuration yaml.

I discovered the existing mqtt firmware for dry contact currently requires 2 reed switches. I already have wireless tilt sensors installed and didn’t plan on the extra work to install wired reed switches on my two doors. So I suspect I want even simpler than the example config you pointed me at - I really just want to treat it as a simple momentary connect switch to toggle the door. I only bought ratgdo to reward Paul for his work to free everyone from the tyranny of myq and leave open the option to use it more fully later.

Ah, are those tilt sensors already available in Home Assistant? If so, you could use them in ESPHome if you want to have the "cover" device working. If you just want the binary switch only, yes that is very simple to set up in ESPHome.

AdrianGarside commented 6 months ago

Thanks. I clearly have some learnings ahead as I didn’t realize/know I could achieve it purely through generic esphome configuration yaml. I discovered the existing mqtt firmware for dry contact currently requires 2 reed switches. I already have wireless tilt sensors installed and didn’t plan on the extra work to install wired reed switches on my two doors. So I suspect I want even simpler than the example config you pointed me at - I really just want to treat it as a simple momentary connect switch to toggle the door. I only bought ratgdo to reward Paul for his work to free everyone from the tyranny of myq and leave open the option to use it more fully later.

Ah, are those tilt sensors already available in Home Assistant? If so, you could use them in ESPHome if you want to have the "cover" device working. If you just want the binary switch only, yes that is very simple to set up in ESPHome.

Yes, they're already in home assistant. The cover sounds perfect. So far, I haven't gotten very far in understanding what's possible in an esphome config. I can pull a pin down to ground momentarily and I think that's sufficient to make the GDO activate (vs explicitly connecting pins). I haven't yet worked out which pin is the one that's got the GDO open wire connected to it.

AdrianGarside commented 6 months ago

Looks like I need something like to create the momentary switch. Still no idea which GPIO(s) are connected to the GDO switch. Does anyone know - the PCB on the real device doesn't make that clear and the open-source reverse engineered schematics don't really help either. Does anyone know which GPIO the gdo dry contact switch is connected to?

image

And then I know I can create a template cover device outside of esphome in HA using the tilt sensor. But is it also possible define and reference external HS sensors from within the esphome config so that the esphome config is the full source of the cover sensor?

kmalinich commented 6 months ago

If your opener is truly compatible with dry contacts, I think you could just use a normal relay, like a Shelly 1 or something.

Another idea to consider: I originally operated my garage door opener with ESPHome by sacrificing a remote I had programmed. I traced the power and button inputs on the remote's PCB and after determining it was 3.3v tolerant, I connected 3.3v power, ground, and a gpio output to an ESP32 and used a similar configuration to what you posted, with the template cover and the 500ms click timing. It worked great, minus the lack of door state reporting (which could mostly be added with a simple magnetic reed switch)

AdrianGarside commented 6 months ago

"If your opener is truly compatible with dry contacts, I think you could just use a normal relay, like a Shelly 1 or something. " - I absolutely could but I bought two ratgdo so now I want to use them :)

rlowens commented 6 months ago

Looks like I need something like to create the momentary switch. Still no idea which GPIO(s) are connected to the GDO switch. Does anyone know - the PCB on the real device doesn't make that clear and the open-source reverse engineered schematics don't really help either. Does anyone know which GPIO the gdo dry contact switch is connected to?

From https://github.com/ratgdo/esphome-ratgdo/blob/main/static/v25board_esp8266_d1_mini_lite.yaml :

  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

In dry contact interface configuration, you are using uart_tx_pin (D1=GPIO5) for toggling the red wire to ground, so that's the pin you need for this. I'm not sure if you need it inverted or not, etc.

And then I know I can create a template cover device outside of esphome in HA using the tilt sensor. But is it also possible define and reference external HS sensors from within the esphome config so that the esphome config is the full source of the cover sensor?

Yes! You want to use https://esphome.io/components/binary_sensor/homeassistant.html

AdrianGarside commented 5 months ago

Tried D1 but no luck yet. I'll do some more testing later to see it's a problem with the inverted/output/open_drain settings.

That was this thread: https://www.reddit.com/r/Esphome/comments/11xnjcj/turning_a_gpio_pin_into_ground/

AdrianGarside commented 5 months ago

Changing it to: image

works. On the very first boot with those changes, it opened the garage door by itself, but I wasn't able to reproduce that with subsequent no-change updates to the config.

Next, I'll get the cover sensor up and running on top of this.

rlowens commented 5 months ago

You might want to add:

esp8266:
  early_pin_init: false

Ref https://esphome.io/components/esp8266.html#configuration-variables

early_pin_init (Optional, boolean): Specifies whether pins should be initialised as early as possible to known values. Recommended value is false where switches are involved, as these will toggle when updating the firmware or when restarting the device. Defaults to true.

My smart plugs and switches often toggle for a moment on reboot/update without that. I don't really know why it is even defaulted to true.

AdrianGarside commented 5 months ago

Changing it to: image

works. On the very first boot with those changes, it opened the garage door by itself, but I wasn't able to reproduce that with subsequent no-change updates to the config.

Next, I'll get the cover sensor up and running on top of this.

Unfortunately those settings break the wall switch.

AdrianGarside commented 5 months ago

All those extra settings weren't necessary and were causing problems: Working settings are just: image

Now to set up the cover sensor instead.

AdrianGarside commented 5 months ago

Working version with cover template:

image

kernelpanic85 commented 5 months ago

Working version with cover template:

image

Thanks for this! To be clear, are we removing the package import yaml that pulls ratgdo code from Github and replacing with this or can we add this in addition?

And is there obstruction sensor code?

AdrianGarside commented 5 months ago

My Genie GDO obstruction sensor voltage is incompatible with ratgdo as best I can tell so I haven't tried to hook that up.

Having lived with this exposed as a cover sensor for a while I am planning to try and switch it to some kind of simple door open/close sensor and a single action on press. Since there's no knowledge of door state exposing it as a cover sensor where all actions (open/close/stop) are all the same button press is more misleading than helpful IMO.

spitcool commented 3 months ago

Bumping for an update. We are an integrator that is doing a LOT of gates and the full dry contact features would be very helpful for us. Understanding the Shelly can do some of this, we like to be able to track open and closed status as well for obvious reasons. Any ETA on being able to flash dry contact support via esphome?

kramttocs commented 2 months ago

Any updates on this?

jimski427 commented 1 month ago

Wondering if there is an update on this? i have one old garage door opener that i really wouldn't like to have to replace in order to use it.

dmzimmerman commented 1 month ago

It looks as though some work is actively going on on the https://github.com/ratgdo/esphome-ratgdo/commits/trigger-dry-contact-door-toggle/ branch toward this; I, also, would very much like to install the ESPHome firmware on a couple of dry contact/limit switch setups I have.

mariusmuja commented 1 month ago

It's implemented on this branch: https://github.com/ratgdo/esphome-ratgdo/commits/dry_contact_with_sensors

jimski427 commented 1 month ago

Ok cool. I was using this: https://ratgdo.github.io/esphome-ratgdo/ and it said it was coming soon. Forgive me, I'm very new to these and trying to figure it all out. But I'm hoping to finally be able to trash my MyQ

dmzimmerman commented 1 month ago

It's implemented on this branch: https://github.com/ratgdo/esphome-ratgdo/commits/dry_contact_with_sensors

Is there anything special to do with the configuration, or just flash and then select the appropriate protocol in the web interface? (it looks like it's been there since late January... it's a bit disappointing that it was never mentioned here or elsewhere, as far as I recall).

dmzimmerman commented 1 month ago

Any further info on how to deploy the firmware on that branch to a ratgdo and have it configured for dry contact operation? There doesn't seem to be a dry contact YAML file in that branch, and I'd rather not do it by trial and error if somebody knows how it's supposed to work.

PaulWieland commented 1 month ago

258

saschawj commented 1 month ago

Does this dry contact fix the toggle issue for dry contacts aswell?

bwenger9 commented 3 weeks ago

So this is now officially implemented/supported on the main branch? Based on #258 it seems so, but I just want to confirm before I wipe my current firmware. According to the feature matrix the support is still at "implementation is possible" but the web installer seems to now show support.

https://paulwieland.github.io/ratgdo/01_features.html

Awesome project. Can't wait to get my dry contact opener on the full feature set.

dmzimmerman commented 3 weeks ago

It is implemented, I have a couple of doors on which it's been running for a couple of weeks now.