MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    How to disable SSL check in python Request

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    1 Posts 1 Posters 1.2k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      Bruno
      last edited by

      Hi, guys.
      Hope i’m posting this on the right place.

      I’ll try to be as clear as possible.

      I have a Home Assistant on the same raspberry pi as my Magic Mirror. And I use MMM-HASS module (https://github.com/aserramonner/MMM-HASS) to see the state of a few sensor on my Home Assistant (light, temperature, etc).

      I use my Home Assistant with a DuckDNS dns (xxxxx.duckdns.org) with Lets Encrypt SSL and everything worked fine, until I changed my router.

      My new router doesnt support a feature called NAT Loopback, that is:
      If I am outside my LAN (for example acessing from may phone 4G) I can access my home assistant with xxx.duckdns.org.
      But if I am INSIDE my LAN (for example from my PC) I can’t access with xxx.duckdns.org. I can only access it with the raspberry pi IP itself: 192.168.X.X.

      The thing is, these modules that integrate with home assistant with magic mirror (like MMM-HASS and MMM-homeassistant-sensors) expect a “host” variable.

      Since the MagicMirror is inside my LAN I have to access it with 192.168.X.X, but since I have a SSL encryption for xxx.duckdns.org, the magic mirror module get the connection error: “Hostname/IP does not match certificate’s altnames: IP: 192.168.X.X is not in the cert’s list:”

      With my old router I set the “host” variable to xxx.duckdns.org. But since my new router doesn’t have this “NAT Loopback” thing, I have to set my LAN IP.

      The solution is: I have to set these modules so they doesnt check the SSL. The Python “Request” has this option: verify=False, as I saw here: https://stackoverflow.com/questions/15445981/how-do-i-disable-the-security-certificate-check-in-python-requests

      But my knowledge in Python is null. So, can anyone help me setting this “verify=False” parameter in the PYthon HTTP Request?

      I tried editing this file “~/MagicMirror/modules/MMM-HASS/node_helper.js”, but I couldnt edit it the right way. I assume it is around these lines of code:

      request(get_options, function(error, response, body) {
                completed_requests++;
                if(config.debuglogging) {
                  console.log(error);
                  console.log(body);
                }
                outDevice[body.entity_id] = body.state;
                if (completed_requests == urls.length) {
                  // All requests done for the device, process responses array
                  // to retrieve all the states
                  outDevice.label = device.deviceLabel;
                  console.log(outDevice);
                  callback(outDevice);
                }
              });
      

      but I couldnt get it right.
      I tried changing the “get_options” var from

      var get_options = {
                url: urls[i],
                json: true
              };
      

      to

      var get_options = {
                url: urls[i],
                json: true,
                verify: false
              };
      

      but no success either.

      Hope I made myself clear, and thanks in advance!

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • 1 / 1
      • First post
        Last post
      Enjoying MagicMirror? Please consider a donation!
      MagicMirror created by Michael Teeuw.
      Forum managed by Sam, technical setup by Karsten.
      This forum is using NodeBB as its core | Contributors
      Contact | Privacy Policy