Homeassistant Certification Check and Notification
I want to monitor certificates of my websites. They should automatically update with acme.sh but this occasionally breaks. To monitor certificates in Homeassistant there is an integration: Certificate Expiry. This is very easy to setup by adding a domain and a port per entry. The information logged is the domain expiration date.
The next step is to notify me when the certificate is actually nearly expired. First we need a way to notify -- I chose pushover, but there are a lot of other ways (filter by notifications). Pushover needs an app -- this app can with a link in the pushover integrations docs. Then add the API key of the app and the user key to the Homeassistant integration. I installed the Android app on my phone and tested the push via the pushover site by selecting the Homeassistant app profile.
Now we need automations to trigger the notifications.
I used a blueprint from an Homeassistant forum post that provides a blueprint to not only select the certificate but the days before expiry and the type of action.
The blueprint is saved in the homeassistant folder, i.e. .homeassistant/blueprints/automation/custom/certification-expiration.yaml
.
Here is a screenshot of an automation generated based on the blueprint by clicking on new automation and selecting the blueprint:
To test the feature I selected a certificate that will expire in next 40 days (most of them will trigger) and selected a time to trigger in the next minutes. The message looks like this on my Android phone:
So the whole setup works. I created automations for my most valuable domains and hope I will never get a push notification. :)