Skip to content

Doesn't work offline (<urlopen error [Errno -3] Try again>) #145

Closed
@rradar

Description

@rradar

Hello,

I just read this one here on github:

And all the fancy JavaScript libraries are loaded from CDN (which means this does not work when you are offline).

Before I wrote this one here on a true home assistant offline environment.

Can't get this addon showing anything. The side asks for credentials - when entered it loads very long and doesn't show much (nothing rendered in browser - source code see down in this issue).

I think it's related to dependencies which are stored in the world wide web. (see hassio addon log line with '<urlopen error [Errno -3] Try again>')

Is there any way to include all dependencies that this addon doesn't need internet? I don't see any reason that this would be necessary at all... maybe for phony home calls.. but... seriously? These libraries should be very static... and home assistant works great offline - the configurator should so too! 😃 👍

Bonus: serving the used libraries locally does speed up the page loading in any case (compared to cdn stored libraries) 🌟

Source code for empty site:

<!doctype html>
<html lang="en">
  <head>
    <link rel='preload' href='/frontend_es5/core-02537159.js' as='script'/>
    <link rel='preload' href='/static/fonts/roboto/Roboto-Regular.ttf' as='font' crossorigin />
    <link rel='preload' href='/static/fonts/roboto/Roboto-Medium.ttf' as='font' crossorigin />
    <meta charset="utf-8">
<link rel='manifest' href='/manifest.json' crossorigin="use-credentials">
<link rel='icon' href='/static/icons/favicon.ico'>
<meta name='viewport' content='width=device-width, user-scalable=no'>
<style>
  body {
    font-family: Roboto, sans-serif;
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-smoothing: antialiased;
    font-weight: 400;
    margin: 0;
    padding: 0;
    height: 100vh;
  }
</style>

    <title>Home Assistant</title>
    <link rel='apple-touch-icon' sizes='180x180'
          href='/static/icons/favicon-apple-180x180.png'>
    <link rel="mask-icon" href="/static/icons/mask-icon.svg" color="#03a9f4">
    <meta name='apple-mobile-web-app-capable' content='yes'>
    <meta name="msapplication-square70x70logo" content="/static/icons/tile-win-70x70.png"/>
    <meta name="msapplication-square150x150logo" content="/static/icons/tile-win-150x150.png"/>
    <meta name="msapplication-wide310x150logo" content="/static/icons/tile-win-310x150.png"/>
    <meta name="msapplication-square310x310logo" content="/static/icons/tile-win-310x310.png"/>
    <meta name="msapplication-TileColor" content="#03a9f4ff"/>
    <meta name='mobile-web-app-capable' content='yes'>
    <meta name='referrer' content='same-origin'>
    <meta name='theme-color' content='#03A9F4'>
    <style>
      #ha-init-skeleton::before {
        display: block;
        content: "";
        height: 112px;
        background-color: #03A9F4;
      }
    </style>
    <script>
      window.customPanelJS = '/frontend_es5/custom-panel-44491550.js';
      window.noAuth = '1';
      window.useOAuth = '1'
      window.Polymer = {
        lazyRegister: true,
        useNativeCSSProperties: true,
        dom: 'shadow',
        suppressTemplateNotifications: true,
        suppressBindingNotifications: true,
      };
    </script>
  </head>
  <body>
    <home-assistant>
      <div id='ha-init-skeleton'></div>
    </home-assistant>
    
      <script src="/static/custom-elements-es5-adapter.js"></script>
      <script src="/frontend_es5/compatibility-7e9ba135.js"></script>
    
    <script>
      var webComponentsSupported = (
        'customElements' in window &&
        'content' in document.createElement('template'));
      if (!webComponentsSupported) {
        (function() {
          var e = document.createElement('script');
          e.src = '/static/webcomponents-bundle.js';
          document.write(e.outerHTML);
        }());
      }
    </script>
    <script src='/frontend_es5/core-02537159.js'></script>
    <script src='/frontend_es5/app-1bf2cc89.js'></script>
    <script src='/frontend_es5/hass-icons-e5fe103b.js' async></script>
    </body>
</html>

And tha hassio addon log:

INFO:2019-02-18 14:21:06,164:__main__:Requesting authorization
INFO:2019-02-18 14:21:06,166:__main__:192.168.0.xxx - "GET / HTTP/1.1" 401 -
INFO:2019-02-18 14:21:09,185:__main__:192.168.0.xxx - "GET / HTTP/1.1" 200 -
WARNING:2019-02-18 14:21:14,564:__main__:Exception getting release
WARNING:2019-02-18 14:21:14,565:__main__:<urlopen error [Errno -3] Try again>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions