The Let’s Encrypt add-on appears to not detect the certificate is due for renewal. Anyone else seeing this?
Starting the add-on…
[15:17:17] INFO: Selected DNS Provider: dns-cloudflare
[15:17:17] INFO: Use propagation seconds: 60
[15:17:18] INFO: Use CloudFlare token
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator dns-cloudflare, Installer None
Cert not yet due for renewal
Keeping the existing certificate
I had similar issues before when renewing certificates. I think the issue is that Google Chrome will cache the certificate, so it doesn’t need to download it every time. Since the old certificate has still not expired, Chrome will use the old cached version. Try clearing the browser cache, since I think this is where these are cached.
(You can check if this is the issue first by opening it in an Incognito window and see if the correct certificate is shown).
Greatly appreciate the insight into how to build a sensor and automation for this, it’s bitten me a few times. Wanted to point out that there is an error in the value_template. An unmatched double-quote that passes a configuration check, but doesn’t work. The value_template should be:
This isn’t working for me - I can’t manually call, call via automation or select in the the UI a core_nginx_proxy.
I also tried to set up the cert expiry integration but can’t get it to see the host; tried localhost, 127.0.0.1, the actual IP, the external IP, the DNS name, ports 80, 443, 8123.
Not sure I have the same problem now, but a host restart does fix it. Mine worked flawlessly (a good couple of years now) but started giving me trouble lately. I’m not sure if it’s always been an issue though as I’m less active now than I was. Could be that I just always happened to restart the host inside the 90 days so never noticed the problem.
@mrrodge If you aren’t using Nginx (I am not), you can just call service “Home Assistant Core Integration: Restart”, which will restart HA completely and achieve the result of presenting the new cert. I schedule this for the middle of the night and I am sure that all my MQTT devices us appropriate retain flags so that HA is always properly informed of state (never assume a reboot won’t happen).
One other update, I was having problems with the sensor template getting an actual value as the latter half of the value template wasn’t returning a numeric value (was returning None). Instead, I replaced to subtract current date/time from cert expiration, which yields the desired result (the number of days the cert has left).
Full sensor code from configuration.yaml is as follows: