Unable to connect to Octoprint because of a self signed SSL certificate

Hi all,

I’m pretty new to HassOS but I’ve been 3D printing with Octoprint for a while now.

I’m currently trying to add the usual cards to Lovelace using the octoprint module and I’m getting a connection error because my Octoprint setup uses a Self Signed Certificate that is forwarded to the web using a custom port of 5010 but HASS doesn’t like that I’m using a self signed cert and therefore won’t connect to my Octopi.

Copy of the logs:

Failed to connect to Octoprint server. Error: HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url: //*MY_DOMAIN*.com:5010/api/printer (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fa1eaeb20>: Failed to establish a new connection: [Errno -3] Try again'))
__ __ __ __ __ __ __

Error getting new camera image from OctoPrint: Cannot connect to host *MY_DOMAIN*.com:5010 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1129)')]

Copy of relevant configuration.yaml section:

octoprint:
  - host: *my_domain*.com
    port: 5010
    api_key: Correct_API_Key
    ssl: true
    bed: true
    name: Anycubic Mega Zero
    number_of_tools: 1
    sensors:
      monitored_conditions:
        - 'Current State'
        - 'Job Percentage'
        - 'Temperatures'
        - 'Time Remaining'
        
camera:
  - platform: mjpeg
    name: OctoPrint
    still_image_url: 'https://MY_DOMAIN.com:5010/webcam/?action=snapshot'
    mjpeg_url: 'https://MY_DOMAIN.com:5010/webcam/?action=stream'

I would really appreciate any help!

That won’t work, as the “octopus” integration doesn’t allow to disable SSL verification.
You have 2 choices:

Thank you for the suggestion!

I’m not going to lie, the tricky option looks very confusing for a beginner like me so I’ll probably give the easy option a go

Thank you!