ratgdo / esphome-ratgdo

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

Door position control #20

Closed mariusmuja closed 11 months ago

mariusmuja commented 11 months ago

This implements door position control using the time it takes the door to open/close. It's obviously open-loop, since there's no feedback from the GDO until the door hits the fully opened / closed positions, it optimistically syncs the door position in the UI every 0.5s .

However, I find it quite useful, many times I want to open the garage door just a little (10-15%) to let some air in and now I can do it in one step instead of opening&stopping it.

It adds two configuration parameters, opening_duration & closing_duration, probably the same in most cases, but can be different if needed. If these are not configured, it assumes middle position 50% as before.

mariusmuja commented 11 months ago

I added automatic open/close duration calibration. It keeps averaging in time with the current setting in case there's any drift.

I kept the settings for now. Could be useful in case manual reset of the durations is necessary for any reason (missed commands leading to erroneous duration being calculated?). Will see how it works...

I noticed you changed some logging levels from debug to verbose... can we keep them at debug? I don't want to set the global level to verbose (esphome recompiles everything with verbose level), but I pretty much always want to see those messages. You could set the ratgdo level to INFO if you don't want to see them. (I cannot set ratgdo level to VERBOSE while global level is DEBUG).

bdraco commented 11 months ago

I got a crash right away on opening after installing this

mariusmuja commented 11 months ago

Hmmm... I've been playing with it for a while without any crashes. It's likely that you hit a first use bug that I "avoided", can you send a log from before the crash?

bdraco commented 11 months ago

After the crash everything works though so it might be because something was initially populated.

Will wipe a fresh one and try it with a console attached.

bdraco commented 11 months ago

I didn't have the console attached when it crashed (requires a latter and a long usb)

mariusmuja commented 11 months ago

I didn't have the console attached when it crashed (requires a latter and a long usb)

I usually monitor the log over the network (esphome logs gdo.yaml), doesn't catch everything a serial console might, but pretty close.

bdraco commented 11 months ago

I didn't have the console attached when it crashed (requires a latter and a long usb)

I usually monitor the log over the network (esphome logs gdo.yaml), doesn't catch everything a serial console might, but pretty close.

I had that open at the time but it just caught the connection reset not the crash dump.

I reflashed again and can't replicate it.

I think I'm going to have to clear NVS

bdraco commented 11 months ago

Tried setting it to 0 and can't replicate the crash

Will flash the other GDO and have serial attached when I do the first open

Will take a bit to get the ladder setup etc

bdraco commented 11 months ago

I've done 5 erases and it hasn't crashed

bdraco commented 11 months ago

Large garage

Screenshot 2023-06-25 at 5 54 10 PM

Small garage

Screenshot 2023-06-25 at 5 54 10 PM

Both the same height but the large one is slightly heavier

mariusmuja commented 11 months ago

Do those doors have exactly the same times, or did you use the same image twice?

Here's mine, don't know why it's in such a hurry :)

image

bdraco commented 11 months ago

20 clear + flashes and I can't replicate the issue

bdraco commented 11 months ago

Thanks @mariusmuja

This is awesome 🥇