There is a integration called Certifcate Expiry you can install:
Then run an automation that will update the cert when it is within 30 days for expiration:
alias: Renew Let's Encrypt if Cert Expiry less than 30 Days
description: ""
triggers:
- trigger: time
at: "01:00:00"
conditions:
- condition: template
value_template: >-
{{
(as_timestamp(states('sensor.YOURINTEGRATIONHERE_expiry'))
- now().timestamp()) / 86400 < 30}}
actions:
- action: hassio.addon_start
data:
addon: core_letsencrypt
mode: single
There could be a problem on system reboot that this runs before your webserver is up, so restart the Certificate Expiry after two minutes from reboot:
alias: Reload Certificate Expiry After NGINX Start
description: ""
triggers:
- trigger: homeassistant
event: start
conditions: []
actions:
- delay:
hours: 0
minutes: 2
seconds: 0
milliseconds: 0
- action: homeassistant.reload_config_entry
metadata: {}
data:
entry_id: 01J__YOURENTRYIDHERE_FD
mode: single
