jerrod-lankford / GarageQTPi

An MQTT server for a raspberry pi garage door opener. Most commonly used as a HomeAssistant cover component.
MIT License
75 stars 36 forks source link

Mqtt availability #46

Open craigInTx opened 3 years ago

craigInTx commented 3 years ago

This pull request adds the usage of MQTT availability topics. This greatly enhances the security of the sensor by indicating when the remote sensor is no longer connected. Upon initial connection, it sets a Last Will statement to set the availability to "offline" in the event the MQTT server doesn't receive any communication within the 60 seconds defined on the connect command. Once connection is re-established, the availability is set to "online" and all currently configured sensor states are updated.

The attached image shows two Garage Doors in Home-Assistant (separate pi zeros). The unit controlling the Double Garage Door was disconnected from the network. After 60 seconds, Home-Assistant recognized the offline status. Once I reconnected it to the network, the status was seamlessly updated and everything returned to full operation. Garage_Doors

bg1000 commented 3 years ago

@craigInTx I don't think this repo is actively maintained. I had a conversation with the author after waiting quite a while on a pull request. He indicated that he moved and no longer uses the application. I use it and am maintaining a fork here. It includes availability and few other enhancements which are listed in the top of the read me. I am open to other pull requests.

craigInTx commented 3 years ago

Thank you bg1000. Moments after submitting this pull request, I found your fork. I'm in the process of converting to your newer fork, and hope to contribute where necessary.

I only wish I had found yours sooner. Would have saved me some development. :)

bg1000 commented 3 years ago

@craigInTx Feel free to open and issue or reach out if you have any trouble. You can reach me me on the home assistant community forum or discord under the same user name (bg1000).