From 109f5fae77a93c909e18e135ae6cec6aeec8f79d Mon Sep 17 00:00:00 2001 From: Florian Brinker Date: Sat, 19 Oct 2019 17:28:39 +0200 Subject: [PATCH] Outsource tileboard module, add tileboard config files --- .gitignore | 6 +- .gitmodules | 3 - tileboard/config.js | 342 ++++++++++++++++++++++++++++++++++++++ tileboard/secrets.js.skel | 3 + www/tileboard | 1 - 5 files changed, 349 insertions(+), 6 deletions(-) delete mode 100644 .gitmodules create mode 100644 tileboard/config.js create mode 100644 tileboard/secrets.js.skel delete mode 160000 www/tileboard diff --git a/.gitignore b/.gitignore index 843cff7..7583652 100644 --- a/.gitignore +++ b/.gitignore @@ -10,9 +10,10 @@ !*.skel !/automations/ !/lovelace-views/ -!/sensors/ -!/www/ !/scripts/ +!/sensors/ +!/tileboard/ +!/www/ # "Force" Disallow .storage/ @@ -21,4 +22,5 @@ ssh-key/ ip_bans.yaml secrets.yaml +secrets.js known_devices.yaml diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 15434f4..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "www/tileboard"] - path = www/tileboard - url = https://github.com/resoai/TileBoard.git diff --git a/tileboard/config.js b/tileboard/config.js new file mode 100644 index 0000000..c258c03 --- /dev/null +++ b/tileboard/config.js @@ -0,0 +1,342 @@ +(function(url) { + var req = new XMLHttpRequest(); + req.open('GET', url + '?cache=' + Math.random(), false); + req.onreadystatechange = function(){ + if (req.readyState === 4) { + var s = document.createElement('script'); + s.appendChild(document.createTextNode(req.responseText)); + document.head.appendChild(s); + } + }; + req.send(null); +})("includes/config/secrets.js" ); + +var CONFIG = { + customTheme: [CUSTOM_THEMES.TRANSPARENT], + transition: TRANSITIONS.ANIMATED_GPU, + entitySize: ENTITY_SIZES.SMALL, + + serverUrl: "http://" + CONFIG_SECRETS.homeAssistantHost, + wsUrl: "ws://" + CONFIG_SECRETS.homeAssistantHost + "/api/websocket", + authToken: null, // nope, don't use that... + debug: false, + pingConnection: true, + + tileSize: 150, + tileMargin: 10, + groupMarginCss: '20px 40px', + + events: [], + timeFormat: 24, + menuPosition: MENU_POSITIONS.BOTTOM, + hideScrollbar: true, + groupsAlign: GROUP_ALIGNS.HORIZONTALLY, + + // https://github.com/resoai/TileBoard/wiki/Header-configuration + header: { + styles: { + padding: '10px 20px 0', + fontSize: '22px' + }, + right: [ + { + type: HEADER_ITEMS.TIME, + } + ], + }, + + // https://github.com/resoai/TileBoard/wiki/Screensaver-configuration + /*screensaver: { + timeout: 300, // after 5 mins of inactive + slidesTimeout: 10, // 10s for one slide + styles: { fontSize: '40px' }, + leftBottom: [{ type: SCREENSAVER_ITEMS.DATETIME }], // put datetime to the left-bottom of screensaver + slides: [ + { bg: 'images/bg1.jpeg' }, + { + bg: 'images/bg2.png', + rightTop: [ // put text to the 2nd slide + { + type: SCREENSAVER_ITEMS.CUSTOM_HTML, + html: 'Welcome to the TileBoard', + styles: { fontSize: '40px' } + } + ] + }, + { bg: 'images/bg3.jpg' } + ] + },*/ + + pages: [ + +// Page: Overview + + { + title: 'Übersicht', + bg: 'images/bg1.jpeg', + icon: 'mdi-home-outline', + groups: [ + { + title: 'Licht', + width: 2, + height: 2, + items: [ + { + position: [0, 0], + title: 'Theke', + subtitle: 'Küche', + id: 'light.kuchen_theke', + type: TYPES.LIGHT, + states: { + on: "An", + off: "Aus" + }, + icons: { + on: "mdi-lightbulb-on", + off: "mdi-lightbulb", + }, + sliders: [ + { + title: 'Helligkeit', + field: 'brightness', + max: 255, + min: 0, + step: 50, + request: { + type: "call_service", + domain: "light", + service: "turn_on", + field: "brightness" + } + }, + ], + }, + { + position: [1, 0], + title: 'Esstisch', + subtitle: 'Wohnzimmer', + id: 'light.esstisch', + type: TYPES.LIGHT, + states: { + on: "An", + off: "Aus" + }, + icons: { + on: "mdi-lightbulb-on", + off: "mdi-lightbulb", + }, + sliders: [ + { + title: 'Helligkeit', + field: 'brightness', + max: 255, + min: 0, + step: 50, + request: { + type: "call_service", + domain: "light", + service: "turn_on", + field: "brightness" + } + }, + ], + }, + { + position: [0, 1], + title: 'Stimmungslicht', + subtitle: 'Wohnzimmer', + id: 'light.stimmungslicht', + type: TYPES.LIGHT, + states: { + on: "An", + off: "Aus" + }, + icons: { + on: "mdi-lightbulb-on", + off: "mdi-lightbulb", + }, + }, + { + position: [1, 1], + title: 'Ambilight', + subtitle: 'Wohnzimmer', + id: 'light.ambilight', + type: TYPES.LIGHT, + states: { + on: "An", + off: "Aus" + }, + icons: { + on: "mdi-lightbulb-on", + off: "mdi-lightbulb", + }, + sliders: [ + { + title: 'Farbe', + field: 'color_temp', + max: 588, + min: 153, + step: 15, + request: { + type: "call_service", + domain: "light", + service: "turn_on", + field: "color_temp" + } + } + ], + colorpicker: true + } + ] + }, + + { + title: 'Wohnzimmer', + width: 2, + height: 2, + items: [ + { + position: [0, 0], + type: TYPES.SENSOR, + title: 'Temperatur', + id: 'sensor.temperature_3', + unit: 'C', + state: false, + filter: function (value) { // optional + var num = parseFloat(value); + return num && !isNaN(num) ? num.toFixed(1) : value; + } + }, + { + position: [1, 0], + type: TYPES.SENSOR, + title: 'Luftfeuchtigkeit', + id: 'sensor.humidity_4', + unit: '%', + state: false, + filter: function (value) { // optional + var num = parseFloat(value); + return num && !isNaN(num) ? num.toFixed(1) : value; + } + }, + { + position: [0, 1], + id: 'media_player.spotify', + type: TYPES.MEDIA_PLAYER, + width: 2, + hideSource: false, + hideMuteButton: false, + state: false, + subtitle: '@attributes.media_title', + bgSuffix: '@attributes.entity_picture', + }, + ] + }, + + { + title: 'Sonstige', + width: 1, + height: 2, + items: [ + { + position: [0, 0], + height: 1, + classes: ['-compact'], + type: TYPES.WEATHER, + title: 'Wetter', + id: 'weather.openweathermap', + state: '&weather.openweathermap.state', + icon: '&weather.openweathermap.state', + icons: { + 'sunny': 'sunny', + 'clear-day': 'clear', + 'clear-night': 'nt-clear', + 'cloudy': 'cloudy', + 'rain': 'rain', + 'sleet': 'sleet', + 'snow': 'snow', + 'wind': 'hazy', + 'fog': 'fog', + 'partly-cloudy-day': 'partlycloudy', + 'partly-cloudy-night': 'nt-partlycloudy' + }, + fields: { + summary: '&weather.openweathermap.state', + temperature: '&weather.openweathermap.attributes.temperature', + temperatureUnit: '°C', + humidity: '&weather.openweathermap.attributes.humidity', + humidityUnit: '%', + windSpeed: '&weather.openweathermap.attributes.wind_speed', + windSpeedUnit: 'km/h', + } + }, + { + position: [0, 1], + type: TYPES.ALARM, + id: "alarm_control_panel.home_alarm", + title: 'Alarm', + icons: { + disarmed: 'mdi-bell-off', + pending: 'mdi-bell', + armed_away: 'mdi-bell', + armed_night: 'mdi-bell', + triggered: 'mdi-bell-ring' + }, + states: { + disarmed: 'Ausgeschaltet', + pending: 'Wartet...', + armed_away: 'Aktiviert', + armed_night: 'Nachtmodus', + triggered: 'Ausgelöst' + } + } + ] + } + ] + }, + +// Page: Humidity + + { + title: 'Luftfeuchtigkeit', + bg: 'images/bg2.png', + icon: 'mdi-water-percent', + groups: [ + + ] + }, + +// Page: CCTV + + { + title: 'CCTV', + bg: 'images/bg2.png', + icon: 'mdi-cctv', + groups: [ + { + title: 'Kameras', + width: 2, + height: 2, + items: [ + { + position: [0, 0], + id: 'camera.office', + type: TYPES.CAMERA_THUMBNAIL, + bgSize: 'cover', + width: 2, + state: false, + fullscreen: { + type: TYPES.CAMERA, + refresh: 1500, + bgSize: 'contain' + }, + } + ] + } + ] + }, + +// End + + ], +} diff --git a/tileboard/secrets.js.skel b/tileboard/secrets.js.skel new file mode 100644 index 0000000..0629445 --- /dev/null +++ b/tileboard/secrets.js.skel @@ -0,0 +1,3 @@ +var CONFIG_SECRETS = { + homeAssistantHost: "...:8123" +} diff --git a/www/tileboard b/www/tileboard deleted file mode 160000 index d48bddd..0000000 --- a/www/tileboard +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d48bdddac7399e70d1ffd7069aaf54cee38ae371