Considering Moving to Docker - some questions

Soul, this is what I did to get the days:

  • platform: template
    sensors:
    ssl_cert_expiry:
    friendly_name: “SSL Cert Expiry”
    value_template: ‘{{ 91 - (( as_timestamp(now()) - as_timestamp(strptime(states.sensor.ssl_cert_issued.state, “%Y-%m-%d”)) )/ (3600*24)) | round(0) }}’
    unit_of_measurement: DAYS
  • platform: command_line
    name: SSL Cert Issued
    unit_of_measurement: “”
    scan_interval: 5
    command: stat -c ‘%y’ /certs/live/mydomain.duckdns.org/cert.pem | awk ‘FNR==1 {print $1}’

The command sensor looks at when the file was created/changed and the template subtracts the time from 90 days.

Juan, can’t you just use the ssl_expiry sensor:

sensor:
  - platform: cert_expiry
    host: your.domain.com
    port: 443
    name: SSL Cert Expires
 

Thanks Steve
I’ll try that

How do you get the rpi version of dockermon?

This is the link to the rpi dock
https://hub.docker.com/r/tribunex/ha-dockermon-pi/

1 Like

Can you share an example of how this could be done. I’m using docker compose, and I have a command that I want to run for LIRC, and I’m having major issues getting keypairs working.

I took a simple approach on this - created a directory on the docker server with shell scripts in, pulled from source control, then I bind mount that directory into the HA docker on startup.

I ended up running all my scripts outside of the docker and communicate with HA via MQTT.
One of the main reasons was that there were several python libraries that are not in the HA docker and I did not want to mess about with it.
In addition for some reason some of my python scripts run on 2.7 and don’t work on python3 and back then I did not have the time to update the code to make it python 3 compatible…