Doesn't work offline (<urlopen error [Errno -3] Try again>)
See original GitHub issueHello,
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>
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (6 by maintainers)
That’s simply a design decision I have made. The configurator is completly contained within one single (~5000 lines of code) Python script for easy installation. No dependencies, no complex directory structures, and a simple embedded webserver.
When I started with the configurator I just wanted users to do a
wget https...blablabla...configurator.py
and then they’re done. Having to fetch additional libraries, placing them in the correct directories and making sure all permissions are set correctly would be too much for average users to handle. Hence external dependencies that always work (when online).Therefore: working as designed. And this will not change, because including all those libraries (and even images) in that one script will make the script even more huge and bloated. That’s just not worth the effort. 😉
hi @danielperna84 thank’s for the feedback. The whole log I see in the hassio addon page is in the issue. I don’t have more logs. Is there any special location to get logs or traceback from hass-configurator (I’m in a hassio offline environment)?
Problem is that not only the server (hass[io] with hass-configurator) is offline but also the client due to no network connections available at all.
Thomas Rientjes suggested, _https://git.synz.io/Synzvato/decentraleyes/issues/345#note_4281_
But thru lack of skills (and network connections) this is sadly not possible for me.
Would it be possible to have a option in hass-configurator to serve the libraries locally instead via CDN? So that it would work like now for anybody with internet connections but have a option (which would be activated manually) to store the libraries on the (hass[io]) server and serve them to the clients?