Merge pull request #2542 from home-assistant/dev

Demo update
This commit is contained in:
Paulus Schoutsen 2019-01-23 10:36:22 -08:00 committed by GitHub
commit d5728579e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 174 additions and 26 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -2,6 +2,46 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
<link rel="icon" href="/static/icons/favicon.ico" />
<link rel="mask-icon" href="/static/icons/mask-icon.svg" color="#3fbbf4" />
<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
/>
<link
rel="apple-touch-icon"
sizes="180x180"
href="/static/icons/favicon-apple-180x180.png"
/>
<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="#3fbbf4ff" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="referrer" content="same-origin" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
@ -40,10 +80,33 @@
<style>
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;
}
</style>
</head>
<body></body>
<body>
<ha-demo><div id="ha-init-skeleton"></div></ha-demo>
<script>
var _gaq = [["_setAccount", "UA-57927901-5"], ["_trackPageview"]];
(function(d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.src =
("https:" == location.protocol ? "//ssl" : "//www") +
".google-analytics.com/ga.js";
s.parentNode.insertBefore(g, s);
})(document, "script");
</script>
</body>
</html>

33
demo/public/manifest.json Normal file
View File

@ -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"
}

View File

@ -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",

View File

@ -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: [

View File

@ -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"));

View File

@ -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"],

View File

@ -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()}
<ha-card>
<div class="not-found">
Entity not available: ${this._config.entity}

View File

@ -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", () => {

View File

@ -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 }) => {