ratgdo / esphome-ratgdo

ratgdo for ESPHome
GNU General Public License v2.0
351 stars 104 forks source link

Dry contact toggle does not toggle door #318

Closed cbuckley closed 4 weeks ago

cbuckley commented 2 months ago

Using the new open/close dry contacts toggle feature merged in https://github.com/ratgdo/esphome-ratgdo/pull/307 I can see that the two contacts are marked as ON in the UI and the toggle debug message is displayed but the door never moves and the position stays at 0%

This works sometimes, usually after a reboot but not after every reboot. I have tried also hitting up/down and toggle in the UI and this still works even when the dry contact toggle is broken.

Screenshot 2024-08-04 at 6 41 00 PM
DrkCorners commented 1 month ago

I have this same issue. I have the Sec 2.0 ESPhome firmware loaded and have verfied that the open and closed contacts close together for 1 sec and nothing happens. the "toggle door" button does work just fine so it must be something in the config that is ignoring the dry contact input.

DrkCorners commented 1 month ago

image here is the log of pressing the dry contacts

PaulWieland commented 1 month ago

You can see in both logs that it is triggering the toggle command:

image

Followed by the rolling code counter being incremented which indicates that its transmitting the command to the GDO.

image

Given that, I'm not sure what the issue could be. Does the door respond to the discrete open or close commands? Does it respond to the toggle button in the web ui?

evil-chimera commented 1 month ago

So I was having this same problem a while back, this appears to be an issue with the logic that was pushed back in #307. For whatever reason the ratgdo appears to be defaulting to sending the close command after (in my case) the first open close cycle. I looked back at attempts to implement dry contact toggle in the past and found #284, and forked and re-implemented his version of the dry contact logic. I have been running on this slightly modified version of the dry contact toggle logic since I forked it and I have not had any issues. I am new to github and this specifically is the first project I have had any reason to contribute to so I am not familiar with the correct way of submitting this for a proper fix. I have also adjusted some of the delays for my own personal use case. If you would like me to submit this as a pr please let me know. Thanks!

https://github.com/evil-chimera/esphome-ratgdo/commit/fa9852bd1a1d94a6ee5626bfad8ee350338e1ae4

PaulWieland commented 1 month ago

What makes you think it's sending a close command and not a toggle command?

evil-chimera commented 1 month ago

In my testing, I triggered the toggle from web ui and it worked normaly however when I trigger it using the dry contacts and the door is in a closed state I get the same log output as is listed above, when triggered in open state door just closes it will not reopen. All buttons in web gui and homeassistant work as expected.

PaulWieland commented 1 month ago

Ok, I will try and replicate your test with some some additional logging to see what value is being transmitted.

DrkCorners commented 1 month ago

I did not try the dry contacts with the door open before but I just did now. I can confirm that the dry contacts would not open the door but would close it. I could not find a way to capture the log once it move out of the window but I did a screen recording if that is helpful. Let me know.

DrkCorners commented 1 month ago

On a side note I have a 8500 I will be setting up (hopefully) this weekend (Sec 1.0) and I can see if it has the same issue.

PaulWieland commented 1 month ago

The fundamental issue here is that close and toggle are being triggered simultaneously on the leading edge. That's causing two commands to be sent (Close and Toggle), one of which is ignored.

To fix this, a delay has to be added before evaluating the GPIO's states.

PaulWieland commented 1 month ago

Fix is here. Requires a little more testing before being merged.

DrkCorners commented 4 weeks ago

Do I just upload the base.yaml to the ratgdo using the OTA field? I am just not sure how to apply this branch.

PaulWieland commented 4 weeks ago

No, the OTA requires you to upload a compiled firmware file. Unfortunately the github build process which compiles the firmware is currently broken and needs to be fixed.

The only way to run this branch right now is rather convoluted as you would have to clone the repo and build locally and then upload with the esphome cli or ota button. To make matters worse, the yaml files refer to the main branch of the repo, so you have to also know how to deal with that.

As soon as I'm able to figure out how to fix the github build process, I'll merge the change.

EDIT: the build process seems to have been a temporary issue with docker.io authentication. It appears to have been resolved

PaulWieland commented 4 weeks ago

The automated build process seems to be fixed and the PR was merged into the main branch.

DrkCorners commented 2 weeks ago

After re-flashing with the new firmware everything seems to be working now

turbo2ltr commented 1 week ago

It would be useful if this was added to the wiring diagram. Not knowing this was a feature, I set up an automation in HA but was unhappy with the delay. I couldn't believe that there wasn't method to add a simple button closure without having HA in the middle. But apparently there is! Going to rewire now. I actually thought the "Wall mounted button" in the wiring diagram was for the simple dry contact button until I saw a picture and realized it was for the "smart" button which I don't have...which is 1/2 the reason I bought the board. (HA integration was the other half)

turbo2ltr commented 1 week ago

Ok the hardware solution is no better than the HA solution, if not a little worse. Why do I have to hold the button down so long? Surely you can debounce in less than a second.