diff --git a/demo/public/api/camera_proxy_stream/camera.backyard b/demo/public/api/camera_proxy_stream/camera.backyard new file mode 100644 index 0000000000..25120b26bf Binary files /dev/null and b/demo/public/api/camera_proxy_stream/camera.backyard differ diff --git a/demo/public/api/camera_proxy_stream/camera.driveway b/demo/public/api/camera_proxy_stream/camera.driveway new file mode 100644 index 0000000000..746c30267e Binary files /dev/null and b/demo/public/api/camera_proxy_stream/camera.driveway differ diff --git a/demo/public/api/camera_proxy_stream/camera.patio b/demo/public/api/camera_proxy_stream/camera.patio new file mode 100644 index 0000000000..746c30267e Binary files /dev/null and b/demo/public/api/camera_proxy_stream/camera.patio differ diff --git a/demo/public/api/camera_proxy_stream/camera.porch b/demo/public/api/camera_proxy_stream/camera.porch new file mode 100644 index 0000000000..3527dc52bf Binary files /dev/null and b/demo/public/api/camera_proxy_stream/camera.porch differ diff --git a/demo/public/index.html b/demo/public/index.html index fae365931d..84b16d37c0 100644 --- a/demo/public/index.html +++ b/demo/public/index.html @@ -2,6 +2,46 @@ + + + + + + + + + + + + + + body { font-family: Roboto, Noto, sans-serif; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + font-weight: 400; + height: 100vh; margin: 0; padding: 0; } + #ha-init-skeleton::before { + display: block; + content: ""; + height: 112px; + background-color: #3fbbf4; + } - + +
+ + diff --git a/demo/public/manifest.json b/demo/public/manifest.json new file mode 100644 index 0000000000..a38462f2e5 --- /dev/null +++ b/demo/public/manifest.json @@ -0,0 +1,33 @@ +{ + "background_color": "#FFFFFF", + "description": "Open-source home automation platform running on Python 3.", + "dir": "ltr", + "display": "standalone", + "icons": [ + { + "src": "/static/icons/favicon-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/static/icons/favicon-384x384.png", + "sizes": "384x384", + "type": "image/png" + }, + { + "src": "/static/icons/favicon-512x512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "/static/icons/favicon-1024x1024.png", + "sizes": "1024x1024", + "type": "image/png" + } + ], + "lang": "en-US", + "name": "Home Assistant Demo", + "short_name": "Assistant Demo", + "start_url": "/?homescreen=1", + "theme_color": "#03A9F4" +} diff --git a/demo/src/configs/arsaboo/lovelace.ts b/demo/src/configs/arsaboo/lovelace.ts index 1d8258574c..5574cc2761 100644 --- a/demo/src/configs/arsaboo/lovelace.ts +++ b/demo/src/configs/arsaboo/lovelace.ts @@ -628,6 +628,55 @@ export const demoLovelaceArsaboo: () => LovelaceConfig = () => ({ }, ], }, + { + icon: "mdi:information-outline", + id: "home-assistant", + title: "Home Assistant", + cards: [ + { + type: "markdown", + content: + "## What is Home Assistant?\nHome Assistant is open source home automation software, that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server.", + }, + { + entities: [ + { + url: "https://www.home-assistant.io/", + type: "weblink", + name: "Home Assistant", + icon: "mdi:home-assistant", + }, + { + url: "https://www.home-assistant.io/getting-started/", + type: "weblink", + name: "Getting Started", + icon: "mdi:download", + }, + { + url: "https://www.home-assistant.io/cookbook/", + type: "weblink", + name: "Configuration Examples", + icon: "mdi:home-heart", + }, + { + url: "https://community.home-assistant.io/", + type: "weblink", + name: "Forum", + icon: "mdi:forum", + }, + { + url: "https://discord.gg/c5DvZ4e", + type: "weblink", + name: "Chat", + icon: "mdi:chat", + }, + ], + show_header_toggle: false, + type: "entities", + title: "Useful Links", + }, + ], + }, // { // icon: "mdi:weather-cloudy", // id: "weather", diff --git a/demo/src/configs/kernehed/entities.ts b/demo/src/configs/kernehed/entities.ts index 2d731fe836..c7138e5ecb 100644 --- a/demo/src/configs/kernehed/entities.ts +++ b/demo/src/configs/kernehed/entities.ts @@ -735,7 +735,7 @@ export const demoEntitiesKernehed: () => Entity[] = () => volume_level: 0.20000000298023224, is_volume_muted: false, media_content_id: - "https://kernehed.duckdns.org:8123/api/tts_proxy/611eb2c473bdbbd00914879aef86ea9cd54924be_sv_-_google.mp3", + "https://mydomain.duckdns.org:8123/api/tts_proxy/611eb2c473bdbbd00914879aef86ea9cd54924be_sv_-_google.mp3", media_duration: 1.848, media_position: 0, media_position_updated_at: "2019-01-18T16:03:15.929413+00:00", @@ -755,7 +755,7 @@ export const demoEntitiesKernehed: () => Entity[] = () => volume_level: 0.20000000298023224, is_volume_muted: false, media_content_id: - "https://kernehed.duckdns.org:8123/api/tts_proxy/611eb2c473bdbbd00914879aef86ea9cd54924be_sv_-_google.mp3", + "https://mydomain.duckdns.org:8123/api/tts_proxy/611eb2c473bdbbd00914879aef86ea9cd54924be_sv_-_google.mp3", media_duration: 1.848, media_position: 0, media_position_updated_at: "2019-01-18T16:03:18.617336+00:00", @@ -3804,8 +3804,6 @@ export const demoEntitiesKernehed: () => Entity[] = () => "standby", ], updateUI: false, - admin_password: - "db8f9bc96a2ab281c7c1cb1d14bb13b1982c0bdcb09b39e1357846667229b215", bwalarm_version: "1.1.3", py_version: [3, 6, 6, "final", 0], users: [ diff --git a/demo/src/entrypoint.ts b/demo/src/entrypoint.ts index 5541311f35..8badcf88f1 100644 --- a/demo/src/entrypoint.ts +++ b/demo/src/entrypoint.ts @@ -15,5 +15,3 @@ setTimeout( import(/* webpackChunkName: "polyfill-web-animations-next" */ "web-animations-js/web-animations-next-lite.min"), 1000 ); - -document.body.appendChild(document.createElement("ha-demo")); diff --git a/demo/webpack.config.js b/demo/webpack.config.js index f3c9d9397d..598e50cdbc 100644 --- a/demo/webpack.config.js +++ b/demo/webpack.config.js @@ -2,6 +2,7 @@ const path = require("path"); const webpack = require("webpack"); const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); const CopyWebpackPlugin = require("copy-webpack-plugin"); +const WorkboxPlugin = require("workbox-webpack-plugin"); const { babelLoaderConfig } = require("../config/babel.js"); const isProd = process.env.NODE_ENV === "production"; @@ -76,6 +77,11 @@ module.exports = { mangle: false, }, }), + // isProd && + new WorkboxPlugin.GenerateSW({ + swDest: "service_worker_es5.js", + importWorkboxFrom: "local", + }), ].filter(Boolean), resolve: { extensions: [".ts", ".js", ".json"], diff --git a/src/panels/lovelace/cards/hui-thermostat-card.ts b/src/panels/lovelace/cards/hui-thermostat-card.ts index 4d63f5f186..4ca24e6eb5 100644 --- a/src/panels/lovelace/cards/hui-thermostat-card.ts +++ b/src/panels/lovelace/cards/hui-thermostat-card.ts @@ -105,6 +105,7 @@ export class HuiThermostatCard extends hassLocalizeLitMixin(LitElement) const stateObj = this.hass.states[this._config.entity] as ClimateEntity; if (!stateObj) { return html` + ${this.renderStyle()}
Entity not available: ${this._config.entity} diff --git a/src/util/register-service-worker.js b/src/util/register-service-worker.js index 89b7d9bc0c..6b1ed8348e 100644 --- a/src/util/register-service-worker.js +++ b/src/util/register-service-worker.js @@ -1,8 +1,8 @@ const serviceWorkerUrl = - __BUILD__ === "latest" ? "/service_worker.js" : "/service_worker_es5"; + __BUILD__ === "latest" ? "/service_worker.js" : "/service_worker_es5.js"; export default () => { - if (!("serviceWorker" in navigator) || __DEMO__) return; + if (!("serviceWorker" in navigator)) return; navigator.serviceWorker.register(serviceWorkerUrl).then((reg) => { reg.addEventListener("updatefound", () => { diff --git a/webpack.config.js b/webpack.config.js index 1b8b359e4f..cb618e61d3 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -167,6 +167,23 @@ function createConfig(isProdBuild, latestBuild) { return zopfli.gzip(input, compressionOptions, callback); }, }), + new HtmlWebpackPlugin({ + inject: false, + template: "./src/html/index.html.template", + // Default templateParameterGenerator code + // https://github.com/jantimon/html-webpack-plugin/blob/master/index.js#L719 + templateParameters: (compilation, assets, option) => ({ + latestBuild, + compatibility: assets.chunks.compatibility.entry, + appJS: assets.chunks.app.entry, + coreJS: assets.chunks.core.entry, + customPanelJS: assets.chunks["custom-panel"].entry, + hassIconsJS: assets.chunks["hass-icons"].entry, + }), + filename: `index.html`, + }), + generateJSPage("onboarding", latestBuild), + generateJSPage("authorize", latestBuild), new WorkboxPlugin.InjectManifest({ swSrc: "./src/entrypoints/service-worker-bootstrap.js", swDest: "service_worker.js", @@ -194,23 +211,6 @@ function createConfig(isProdBuild, latestBuild) { "node_modules/@polymer/font-roboto-local/fonts/roboto/Roboto-Bold.ttf", }, }), - new HtmlWebpackPlugin({ - inject: false, - template: "./src/html/index.html.template", - // Default templateParameterGenerator code - // https://github.com/jantimon/html-webpack-plugin/blob/master/index.js#L719 - templateParameters: (compilation, assets, option) => ({ - latestBuild, - compatibility: assets.chunks.compatibility.entry, - appJS: assets.chunks.app.entry, - coreJS: assets.chunks.core.entry, - customPanelJS: assets.chunks["custom-panel"].entry, - hassIconsJS: assets.chunks["hass-icons"].entry, - }), - filename: `index.html`, - }), - generateJSPage("onboarding", latestBuild), - generateJSPage("authorize", latestBuild), ].filter(Boolean), output: { filename: ({ chunk }) => {