andrewshilliday / garage-door-controller

Software to monitor and control garage doors via a raspberry pi
MIT License
327 stars 127 forks source link

Enhanced email alerts #83

Closed adriangibbons closed 6 years ago

adriangibbons commented 6 years ago

Enhanced email alerts Emails being sent were being marked as Spam by SpamAssassin on my mail server. This was due to missing fields such as the Date and Message-ID. I've added this. And re-formatted the JSON config and added an email subject parameter.

desired_state functionality for another time 👍

Thanks again for this awesome project. Cheers, Adrian.

adriangibbons commented 6 years ago

Just added a couple more commits to enhance email alerts.

andrewshilliday commented 6 years ago

Thanks for the suggested changes. it looks like you're submitted commits for two new features, a fix to the email handling, and a new desired state toggle. Would you mind submitting them as seperate pull requests? I could merge in the email change immediately, but the desired state feature will need to take some thought. The reason that I never implemented something like this to begin with was that the sensors don't provide the controller with perfect information about the state of the doors. In otherwords, given some arbitrary state of the garage door, the controller has no way of knowing whether "pushing the button" will open or close the doors (e.g., the doors could be half way open, and you might want to close them but pushing the button would actually open them all the way). HAve you figured out some way to account for that?

adriangibbons commented 6 years ago

Hi @andrewshilliday - I actually wanted to send two PRs, but Github only seemed to let me add the additional changes to my existing PR. I'll cancel this one and then re-submit just the commits for the enhanced email.

Re: doors being half way open, the way I decided to handle that is to ignore the toggle when doors are in the state 'opening' or 'closing' if state == 'opening' or state == 'closing': (commit c36517e)

Though I guess that it could be made to be a little more sophisticated. I.e.:

What do you think of that? Cheers, Adrian.

adriangibbons commented 6 years ago

Just reversed the commits related to the desired_state functionality. So just email alerts in this PR now! Cheers, Adrian.