I recently have more time to get back into home automation and would like to upgrade my existing garage door solution.
- Three plainly switch- and proprietary RF-controlled, automatic garage doors shall be integrated into our OpenHAB2-system.
- The resulting software shall feature a TCP/IP-interface (e.g. REST) in order to control the relays and retrieve the states from android/apple devices (car radio, mobiles, …) outside of the LAN (DynDNS is up and running).
- The hardware to achieve this must be compatible with ESP8266 (EasyESP) or RaspberryPi.
- The doors shall shut automatically after a configured period of time to compensate for human error (forgot to close garage door).
- Custom-made django-based HTTP-Service running on RaspberryPi Zero controlling one general-purpose relay (GPIO) to deliver a 1 sec pulse (mimicking the manual switches) to trigger open/close and one simple magnetic door contact sensor to detect whether the door is shut (1).
- Since all these garage doors need 14 sec to completely open/shut, this delta was used to ensure the doors are not stuck or obstructed (trigger -> wait 14s ? sensor is still 0 -> trigger… up to 3 times, since it is uncertain whether the door is opening or closing after a trigger) (important). In case the shutting operation stays unsuccessful, an alert is raised.
- Works very well and efficiently, but not very satisfying in light of OpenHAB2 usage for the rest of our home automation.
- An ESP8266 with an additional ultrasound distance sensor measures the distance of the upper end of the door from the motor unit on it’s mechanical rail with an interval of 1 sec (prototype assembled, tested and installed) in order to determine the position and open/close direction of the door.
- Prototype XTend-implementations for OH2 are already implemented, but due to frequent outliers in the ultrasonic measurements, this solution would require a statistical approach to increase certainty (the rounded mode of cm over say 3-5 sec seems most suited).
Questions to the community
- I did not manage in XTend, so what is the right approach (best practice) to achieve this?
- Do I implement it as a new add-on (would be a first for me, although I have tons of professional OOP- and Java-experience and IntelliJ is already set up to start right away)?
- I need better code inspection and completion, because the last time it was too much trial & error debugging. I used VSCode with OH-Plugin to script the XTend. It was awful to try and include native Java-libraries to achieve this. Is there anything that I missed?
- How would you guys proceed?
I would love your insight and experience to guide me here, so that I won’t invent the wheel anew and waste hours for something so straight-forward.