UNPKG

iobroker.nspanel-lovelace-ui

Version:

NsPanel Lovelace UI is a Firmware for the nextion screen inside of NSPanel in the Design of Lovelace UI Design.

1,368 lines (1,258 loc) 261 kB
async function configuration (): Promise<void> { const overrideConfig: Partial<ScriptConfig.Config> = { // hier kann man die Werte von unten überschreiben bzw nicht ewig im Skript suchen wo nochmal die Farbe steht :) // pages und subpages geht hier nicht, weil die Seiten ja erst später angelegt werden. Bei const gehts nach Reihenfolge. // panelTopic: 'nspanel/ns_panel4', weatherEntity: 'pirate-weather.0.', defaultOffColor: Off, defaultOnColor: On, // weatherAddDefaultItems: // - true => alle Standard-Wetterelemente hinzufügen // - false => keine hinzufügen // - { ... } => selektiv per Schlüssel aktivieren: // sunriseSet, forecastDay1, forecastDay2, forecastDay3, forecastDay4, forecastDay5, forecastDay6, // windSpeed, windGust, windDirection, uvIndex, solar // Hinweis: Die einzelnen Schlüssel funktionieren nur, wenn der gewählte Wetteranbieter // die entsprechenden Daten liefert und diese im Adapter vorbereitet wurden "weatherAddDefaultItems": false } /************************************************************************************** ** ** ** https://github.com/ticaki/ioBroker.nspanel-lovelace-ui/wiki/Adapter-Installation ** ** ** *************************************************************************************/ /*********************************************************************** ** ** ** Page Configuration ** ** ** ***********************************************************************/ // Beispiel Hauptseite / Mainpage // Diese Seite ist die Hauptseite, sie wird immer als erstes angezeigt und hat den uniqueName 'main'. // uniqueName 'main' muß mindestens einmal vorkommen, damit die Navigation funktioniert. const Hauptseite: ScriptConfig.PageGrid = { type: 'cardGrid', uniqueName: 'main', heading: 'Die Leere', items: [] }; // Diese Konfiguration für den Fahrplan ist ein Beispiel was die interne Adapterkonfiguration benutzt, diese // ist recht komplex und wird nicht weiter erläutert. Da gibts später fertige Templates die man hier verwenden kann. // wie am Fahrplan Beispiel zu sehen ist. /* const fahrplan: any = { heading: 'Fahrplan Script', native: { card: 'cardEntities', dpInit: 'fahrplan.0.0', uniqueID: 'fahrplanrouten', template: 'entities.fahrplan.routes', } }; */ // Konfiguration findet im Admin statt, uniqueName muß gleich dem namen in der Adminkonfiguration sein. /* const qrCode: ScriptConfig.PageQR = { type: 'cardQR', uniqueName: 'qrCode' }; */ // Konfiguration findet im Admin statt, uniqueName muß gleich dem namen in der Adminkonfiguration sein. /* const chartHeizung: ScriptConfig.PageChart = { type: 'cardChart', uniqueName: 'temperatur' }; */ // Ein Beispiel für eine Gridseite mit verschiedenen Farbskalen /* const irgendeinName: ScriptConfig.PageGrid = { type: 'cardGrid', uniqueName: 'main', heading: 'Wohnzimmer', items: [ {id: 'alias.0.Temperatur', name: 'standard', onColor: Red, offColor: Blue, colorScale: {'val_min': 0, 'val_max': 40}}, {id: 'alias.0.Temperatur', name: 'hue', onColor: Red, offColor: Blue, colorScale: {'val_min': 0, 'val_max': 40, mode: 'hue'}}, {id: 'alias.0.Temperatur', name: 'cie', onColor: Red, offColor: Blue, colorScale: {'val_min': 0, 'val_max': 40, mode: 'cie'}}, {id: 'alias.0.Temperatur', name: 'standard log min', onColor: Red, offColor: Blue, colorScale: {'val_min': 0, 'val_max': 40, log10: 'min'}}, {id: 'alias.0.Temperatur', name: 'hue log min', onColor: Red, offColor: Blue, colorScale: {'val_min': 0, 'val_max': 40, mode: 'hue', log10: 'min'}}, {id: 'alias.0.Temperatur', name: 'cie log min', onColor: Red, offColor: Blue, colorScale: {'val_min': 0, 'val_max': 40, mode: 'cie', log10: 'min'}}, {id: 'alias.0.Temperatur', name: 'standard', onColor: Red, offColor: Blue, colorScale: {'val_min': 0, 'val_max': 40}}, {id: 'alias.0.Temperatur', name: 'hue', onColor: Red, offColor: Blue, colorScale: {'val_min': 0, 'val_max': 40, mode: 'hue'}}, {id: 'alias.0.Temperatur', name: 'cie', onColor: Red, offColor: Blue, colorScale: {'val_min': 0, 'val_max': 40, mode: 'cie'}}, {id: 'alias.0.Temperatur', name: 'standard log max', onColor: Red, offColor: Blue, colorScale: {'val_min': 0, 'val_max': 40, log10: 'max'}}, {id: 'alias.0.Temperatur', name: 'hue log max', onColor: Red, offColor: Blue, colorScale: {'val_min': 0, 'val_max': 40, mode: 'hue', log10: 'max'}}, {id: 'alias.0.Temperatur', name: 'cie log max', onColor: Red, offColor: Blue, colorScale: {'val_min': 0, 'val_max': 40, mode: 'cie', log10: 'max'}}, ] }; */ /* const grid1: ScriptConfig.PageGrid = { uniqueName: 'grid1', // keine Navigation, am besten uniqueName von config.ts übernehmen heading: 'Grid 1', items: [ {id: 'alias.0.Licht.lights.Gerät_1'}, {id: 'alias.0.Licht.lights.Gerät_2'}, {id: '0_userdata.0.Einzelne_Geräte.dimmer'}, {id: 'alias.0.NSPanel.allgemein.hue', }, {navigate: true, targetPage: 'fahrplanrouten'}, {id: 'alias.0.NSPanel.allgemein.shutter'} ], type: 'cardGrid', } */ const config: ScriptConfig.Config = { panelTopic: 'topic', weatherEntity: 'pirate-weather.0.', defaultOffColor: Off, defaultOnColor: On, defaultBackgroundColor: HMIDark, weatherAddDefaultItems: false, // Als Gedankenstütze, die Hauptseite muß main heißen! //panelName: 'NSPanel', //unique name for the panel // Seiteneinteilung / Page division // Hauptseiten / Mainpages pages: [ Hauptseite //irgendeinName, //grid1, //qrCode, //chartHeizung, ], // Unterseiten / Subpages subPages: [ //fahrplan ], /*********************************************************************** ** ** ** Screensaver Configuration ** ** ** ***********************************************************************/ favoritScreensaverEntity: [ { type: 'template', template: 'text.pirate-weather.favorit', dpInit: `/^pirate-weather\\.0\\.weather\\.currently\\./`, modeScr: 'favorit', } ], alternateScreensaverEntity: [ // only used with alternate Screensaver ], indicatorScreensaverEntity: [ // indicatorScreensaverEntity 1 (only Advanced Screensaver) { type: 'script', ScreensaverEntity: 'alias.0.NSPanel.allgemein.Status_offene_Fenster.ACTUAL', ScreensaverEntityFactor: 1, ScreensaverEntityDecimalPlaces: 0, ScreensaverEntityIconOn: 'window-open-variant', ScreensaverEntityIconOff: 'window-closed-variant', ScreensaverEntityText: 'Fenster', ScreensaverEntityUnitText: '%', ScreensaverEntityIconColor: {val_min: 0, val_max: 1}, }, // indicatorScreensaverEntity 2 (only Advanced Screensaver) { type: 'script', ScreensaverEntity: 'alias.0.NSPanel.allgemein.Status_offene_Tuer.ACTUAL', ScreensaverEntityFactor: 1, ScreensaverEntityDecimalPlaces: 0, ScreensaverEntityIconOn: 'door-open', ScreensaverEntityIconOff: 'door-closed', ScreensaverEntityText: 'Tür', ScreensaverEntityUnitText: '', ScreensaverEntityIconColor: {val_min: 0, val_max: 1}, }, // indicatorScreensaverEntity 3 (only Advanced Screensaver) { type: 'script', ScreensaverEntity: 'alias.0.NSPanel.allgemein.Status_Licht_An.ACTUAL', ScreensaverEntityFactor: 1, ScreensaverEntityDecimalPlaces: 0, ScreensaverEntityIconOn: 'lightbulb', ScreensaverEntityIconOff: null, ScreensaverEntityText: 'Licht', ScreensaverEntityUnitText: '', ScreensaverEntityIconColor: {val_min: 0, val_max: 1}, }, // indicatorScreensaverEntity 4 (only Advanced Screensaver) { type: 'script', ScreensaverEntity: 'alias.0.Türschloss.ACTUAL', ScreensaverEntityFactor: 1, ScreensaverEntityDecimalPlaces: 0, ScreensaverEntityIconOn: 'lock', ScreensaverEntityIconOff: 'lock-open', ScreensaverEntityText: 'Türschloss', ScreensaverEntityUnitText: '', ScreensaverEntityIconColor: {val_min: 0, val_max: 1, val_best: 1}, }, // indicatorScreensaverEntity 5 (only Advanced Screensaver) { type: 'script', ScreensaverEntity: 'alias.0.NSPanel.allgemein.Auto.Safety.ACTUAL', ScreensaverEntityFactor: 1, ScreensaverEntityDecimalPlaces: 0, ScreensaverEntityIconOn: 'car-key', ScreensaverEntityIconOff: null, ScreensaverEntityText: 'Auto', ScreensaverEntityUnitText: '', ScreensaverEntityIconColor: {val_min: 0, val_max: 1, val_best: 1}, }, ], bottomScreensaverEntity: [ // bottomScreensaverEntity 1 { type: 'template', template: 'text.pirate-weather.sunriseset', dpInit: `/^pirate-weather\\.0\\.weather\\.daily\\.00.+/`, modeScr: 'bottom', }, // bottomScreensaverEntity 2 /*{ type: 'template', template: 'text.hmip.windcombo', dpInit: 'hmip.0.devices.3014G71HA0001XXXXXXXXXX', modeScr: 'bottom', //readOptions: {directionOfPanel: 81} },*/ { type: 'script', ScreensaverEntity: 'pirate-weather.0.weather.currently.windSpeed', ScreensaverEntityFactor: 1, ScreensaverEntityDecimalPlaces: 1, ScreensaverEntityIconOn: 'weather-windy', ScreensaverEntityIconOff: null, ScreensaverEntityText: "Wind", ScreensaverEntityUnitText: 'm/s', ScreensaverEntityIconColor: {'val_min': 0, 'val_max': 120} }, // bottomScreensaverEntity 3 { type: 'script', ScreensaverEntity: 'pirate-weather.0.weather.currently.windGust', ScreensaverEntityFactor: 1, ScreensaverEntityDecimalPlaces: 1, ScreensaverEntityIconOn: 'weather-tornado', ScreensaverEntityIconOff: null, ScreensaverEntityText: 'Böen', ScreensaverEntityUnitText: 'm/s', ScreensaverEntityIconColor: {'val_min': 0, 'val_max': 120} }, // bottomScreensaverEntity 4 { type: 'template', template: 'text.pirate-weather.winddirection', dpInit: `/^pirate-weather\\.0\\.weather\\.currently./`, modeScr: 'bottom', }, // bottomScreensaverEntity 5 (Advanced Screensaver) { type: 'script', ScreensaverEntity: 'pirate-weather.0.weather.currently.humidity', ScreensaverEntityFactor: 1, ScreensaverEntityDecimalPlaces: 0, ScreensaverEntityIconOn: 'water-percent', ScreensaverEntityIconOff: null, ScreensaverEntityText: 'Feuchte', ScreensaverEntityUnitText: '%', ScreensaverEntityIconColor: {'val_min': 0, 'val_max': 100, 'val_best': 60} }, // bottomScreensaverEntity 6 (for Advanced Screensaver) { type: 'template', template: 'text.pirate-weather.uvindex', dpInit: `/^pirate-weather\\.0\\.weather\\.currently./`, modeScr: 'bottom', } // Examples for Advanced-Screensaver: https://github.com/joBr99/nspanel-lovelace-ui/wiki/ioBroker-Config-Screensaver#entity-status-icons-ab-v400 // Some templates for the screensaver uncomment the lines to use them // If u use an other instance for the weather data, change the instance in the following lines // If you want to have them all, set weatherAddDefaultItems=true in the config and leave the following lines as they are! // zum nutzen der Vorlagen für den Bildschirmschoner die Zeilen auskommentieren, um sie zu verwenden // Wenn du eine andere Instanz für die Wetterdaten verwendest, ändere die Instanz in den folgenden Zeilen // Wenn du sie alle haben willst, setze weatherAddDefaultItems=true in der Konfiguration ganz oben und lass die folgenden Zeilen so wie sie sind! /* OPENWEATHERMAP // Bottom 1 - sunrise/set { type: 'template', template: 'text.openweathermap.favorit', dpInit: `/^openweathermap\\.0.+/`, modeScr: 'favorit', }, // Bottom 2 - Forecast Day 1 { type: 'template', template: 'text.openweathermap.bot2values', dpInit: `/^openweathermap\\.0.+?day0/`, modeScr: 'bottom', }, // Bottom 3 - Forecast Day 2 { type: 'template', template: 'text.openweathermap.bot2values', dpInit: `/^openweathermap\\.0.+?day1/`, modeScr: 'bottom', }, // Bottom 4 - Forecast Day 3 { type: 'template', template: 'text.openweathermap.bot2values', dpInit: `/^openweathermap\\.0.+?day2/`, modeScr: 'bottom', }, // Bottom 5 - Forecast Day 4 { type: 'template', template: 'text.openweathermap.bot2values', dpInit: `/^openweathermap\\.0.+?day3/`, modeScr: 'bottom', }, // Bottom 6 - Forecast Day 5 { type: 'template', template: 'text.openweathermap.bot2values', dpInit: `/^openweathermap\\.0.+?day4/`, modeScr: 'bottom', }, // Bottom 7 - Forecast Day 6 { type: 'template', template: 'text.openweathermap.bot2values', dpInit: `/^openweathermap\\.0.+?day5/`, modeScr: 'bottom', }, // Bottom 8 - Windgeschwindigkeit { type: 'template', template: 'text.openweathermap.windspeed', dpInit: `/^openweathermap\\.0./`, modeScr: 'bottom', }, // Bottom 9 - Böen { type: 'template', template: 'text.openweathermap.windgust', dpInit: `/^openweathermap\\.0./`, modeScr: 'bottom', }, // Bottom 10 - Windrichtung { type: 'template', template: 'text.openweathermap.winddirection', dpInit: `/^openweathermap\\.0./`, modeScr: 'bottom', }, // Bottom 11 - UV-Index { type: 'template', template: 'text.accuweather.uvindex', dpInit: `/^accuweather\\.0./`, modeScr: 'bottom', }, */ /* PIRATE-WEATHER // Bottom 1 - sunrise/set { type: 'template', template: 'text.pirate-weather.sunriseset', dpInit: `/^pirate-weather\\.0\\.weather\\.daily\\.00.+/`, modeScr: 'bottom', }, // Bottom 2 - Forecast Day 1 { type: 'template', template: 'text.pirate-weather.bot2values', dpInit: `/^pirate-weather\\.0.+?\\.daily\\.01/`, modeScr: 'bottom', }, // Bottom 3 - Forecast Day 2 { type: 'template', template: 'text.pirate-weather.bot2values', dpInit: `/^pirate-weather\\.0.+?\\.daily\\.02/`, modeScr: 'bottom', }, // Bottom 4 - Forecast Day 3 { type: 'template', template: 'text.pirate-weather.bot2values', dpInit: `/^pirate-weather\\.0.+?\\.daily\\.03/`, modeScr: 'bottom', }, // Bottom 5 - Forecast Day 4 { type: 'template', template: 'text.pirate-weather.bot2values', dpInit: `/^pirate-weather\\.0.+?\\.daily\\.04/`, modeScr: 'bottom', }, // Bottom 6 - Forecast Day 5 { type: 'template', template: 'text.pirate-weather.bot2values', dpInit: `/^pirate-weather\\.0.+?\\.daily\\.05/`, modeScr: 'bottom', }, // Bottom 7 - Forecast Day 6 { type: 'template', template: 'text.pirate-weather.bot2values', dpInit: `/^pirate-weather\\.0.+?\\.daily\\.06/`, modeScr: 'bottom', }, // Bottom 8 - Windgeschwindigkeit { type: 'template', template: 'text.pirate-weather.windspeed', dpInit: `/^pirate-weather\\.0\\.weather\\.currently./`, modeScr: 'bottom', }, // Bottom 9 - Böen { type: 'template', template: 'text.pirate-weather.windgust', dpInit: `/^pirate-weather\\.0\\.weather\\.currently./`, modeScr: 'bottom', }, // Bottom 10 - Windrichtung { type: 'template', template: 'text.pirate-weather.winddirection', dpInit: `/^pirate-weather\\.0\\.weather\\.currently./`, modeScr: 'bottom', }, // Bottom 11 - UV-Index { type: 'template', template: 'text.pirate-weather.uvindex', dpInit: `/^pirate-weather\\.0\\.weather\\.currently./`, modeScr: 'bottom', }, // hier kann man dann eine Stundenübersicht erzeugen durch anpassen der 02 bzw. 04 // die sind nicht in addDefaultWeather enthalten. { type: 'template', template: 'text.pirate-weather.hourlyweather', dpInit: `/^pirate-weather\\.0.+?\\.hourly\\.02/`, modeScr: 'bottom', }, { type: 'template', template: 'text.pirate-weather.hourlyweather', dpInit: `/^pirate-weather\\.0.+?\\.hourly\\.04/`, modeScr: 'bottom', }, */ /* Bright Sky { type: 'template', template: 'text.brightsky.sunriseset', dpInit: `/^brightsky\\.0\\.daily\\.00.+/`, modeScr: 'bottom', }, // Bottom 2 - brightsky.0. Forecast Day 1 { type: 'template', template: 'text.brightsky.bot2values', dpInit: `/^brightsky\\.0\\.daily\\.01/`, modeScr: 'bottom', }, // Bottom 3 - brightsky.0. Forecast Day 2 { type: 'template', template: 'text.brightsky.bot2values', dpInit: `/^brightsky\\.0\\.daily\\.02/`, modeScr: 'bottom', }, // Bottom 4 - brightsky.0. Forecast Day 3 { type: 'template', template: 'text.brightsky.bot2values', dpInit: `/^brightsky\\.0\\.daily\\.03/`, modeScr: 'bottom', }, // Bottom 5 - brightsky.0. Forecast Day 4 { type: 'template', template: 'text.brightsky.bot2values', dpInit: `/^brightsky\\.0\\.daily\\.04/`, modeScr: 'bottom', }, // Bottom 6 - brightsky.0. Forecast Day 5 { type: 'template', template: 'text.brightsky.bot2values', dpInit: `/^brightsky\\.0\\.daily\\.05/`, modeScr: 'bottom', }, // Bottom 7 - brightsky.0. Forecast Day 6 { type: 'template', template: 'text.brightsky.bot2values', dpInit: `/^brightsky\\.0\\.daily\\.06/`, modeScr: 'bottom', }, // Bottom 8 - Windgeschwindigkeit { type: 'template', template: 'text.brightsky.windspeed', dpInit: `/^brightsky\\.0\\.current./`, modeScr: 'bottom', }, // Bottom 9 - Böen { template: 'text.brightsky.windgust', dpInit: `/^brightsky\\.0\\.current./`, modeScr: 'bottom', }, // Bottom 10 - Windrichtung { type: 'template', template: 'text.brightsky.winddirection', dpInit: `/^brightsky\\.0\\.current./`, modeScr: 'bottom', }, // Bottom 10 - Solar { type: 'template', template: 'text.brightsky.solar', dpInit: `/^brightsky\\.0\\.current./`, modeScr: 'bottom', }, */ ], leftScreensaverEntity: [ // leftScreensaverEntity 1 (only Advanced Screensaver) { type: 'script', ScreensaverEntity: 'alias.0.NSPanel.Flur.Sensor.ANALOG.Temperature.ACTUAL', ScreensaverEntityFactor: 1, ScreensaverEntityDecimalPlaces: 1, ScreensaverEntityIconOn: 'thermometer', ScreensaverEntityIconOff: null, ScreensaverEntityText: 'Temperatur', ScreensaverEntityUnitText: '°C', ScreensaverEntityIconColor: {val_min: 0, val_max: 35, val_best: 22}, }, // leftScreensaverEntity 2 (only Advanced Screensaver) { type: 'script', ScreensaverEntity: 'alias.0.Heizung.WärmeTagesVerbrauch.ACTUAL', ScreensaverEntityFactor: 1, ScreensaverEntityDecimalPlaces: 1, ScreensaverEntityIconOn: 'counter', ScreensaverEntityIconOff: null, ScreensaverEntityText: 'Wärme', ScreensaverEntityUnitText: ' kWh', ScreensaverEntityIconColor: MSYellow, //{'val_min': 0, 'val_max': 5000} }, // leftScreensaverEntity 3 (only Advanced Screensaver) { type: 'script', ScreensaverEntity: 'alias.0.NSPanel.allgemein.Abfall.event1.INFO', ScreensaverEntityFactor: 1, ScreensaverEntityDecimalPlaces: 0, ScreensaverEntityDateFormat: {year: 'numeric', month: '2-digit', day: '2-digit'}, ScreensaverEntityIconOn: 'trash-can', ScreensaverEntityIconOff: null, ScreensaverEntityText: 'Abfall', ScreensaverEntityUnitText: '', ScreensaverEntityIconColor: '0_userdata.0.Abfallkalender.1.color', }, ], // Status Icon mrIcon1ScreensaverEntity: { type: 'script', ScreensaverEntity: 'Relay.1', ScreensaverEntityIconOn: 'lightbulb', ScreensaverEntityIconOff: null, ScreensaverEntityValue: null, ScreensaverEntityValueDecimalPlace: 0, ScreensaverEntityValueUnit: null, ScreensaverEntityOnColor: On, ScreensaverEntityOffColor: HMIOff }, mrIcon2ScreensaverEntity: { type: 'script', ScreensaverEntity: 'Relay.2', ScreensaverEntityIconOn: 'lightbulb', ScreensaverEntityIconOff: null, ScreensaverEntityValue: null, ScreensaverEntityValueDecimalPlace: 0, ScreensaverEntityValueUnit: null, ScreensaverEntityOnColor: On, ScreensaverEntityOffColor: HMIOff }, // ------ DE: Ende der Screensaver Einstellungen -------------------- // ------ EN: End of screensaver settings --------------------------- // DE: Konfiguration des linken Schalters des NSPanels // EN: Configuration of the left switch of the NSPanel buttonLeft: { mode: 'page', page: 'main', }, // DE: Konfiguration des rechten Schalters des NSPanels // EN: Configuration of the right switch of the NSPanel buttonRight: null/*{ mode: 'toggle', page: '0_userdata.0.example', }*/, }; /** ******************************************************************************** ******************************************************************************** ******************************************************************************** ******************************************************************************** ******************************************************************************** ******************************************************************************** ******************************************************************************** * END STOP END STOP END - No more configuration - END STOP END STOP END * ******************************************************************************** * For a update copy and paste the code below from orginal file. * * ****************************************************************************** ******************************************************************************** ******************************************************************************** ******************************************************************************** ******************************************************************************** ******************************************************************************** ******************************************************************************** */ try { log(await sendToAsync('nspanel-lovelace-ui.0', 'ScriptConfig', Object.assign({...config, version}, overrideConfig), {timeout: 30_000})); } catch (e) { log(`Error in sendTo ScriptConfig: ${e}! This usually means that the adapter is not working!`, 'error'); } stopScript(scriptName, undefined) } const version = '0.15.0'; const HMIOff = {red: 68, green: 115, blue: 158}; // Blue-Off - Original Entity Off const HMIOn = {red: 3, green: 169, blue: 244}; // Blue-On const HMIDark = {red: 29, green: 29, blue: 29}; // Original Background Color const Off = {red: 253, green: 128, blue: 0}; // Orange-Off - nicer color transitions const On = {red: 253, green: 216, blue: 53}; const MSRed = {red: 251, green: 105, blue: 98}; const MSYellow = {red: 255, green: 235, blue: 156}; const MSGreen = {red: 121, green: 222, blue: 121}; const Red = {red: 255, green: 0, blue: 0}; const White = {red: 255, green: 255, blue: 255}; const Yellow = {red: 255, green: 255, blue: 0}; const Green = {red: 0, green: 255, blue: 0}; const Blue = {red: 0, green: 0, blue: 255}; const DarkBlue = {red: 0, green: 0, blue: 136}; const Gray = {red: 136, green: 136, blue: 136}; const Black = {red: 0, green: 0, blue: 0}; const Cyan = {red: 0, green: 255, blue: 255}; const Magenta = {red: 255, green: 0, blue: 255}; const colorSpotify = {red: 30, green: 215, blue: 96}; const colorAlexa = {red: 49, green: 196, blue: 243}; const colorSonos = {red: 216, green: 161, blue: 88}; const colorRadio = {red: 255, green: 127, blue: 0}; const BatteryFull = {red: 96, green: 176, blue: 62}; const BatteryEmpty = {red: 179, green: 45, blue: 25}; //Menu Icon Colors const Menu = {red: 150, green: 150, blue: 100}; const MenuLowInd = {red: 255, green: 235, blue: 156}; const MenuHighInd = {red: 251, green: 105, blue: 98}; //Dynamische Indikatoren (Abstufung grün nach gelb nach rot) const colorScale0 = {red: 99, green: 190, blue: 123}; const colorScale1 = {red: 129, green: 199, blue: 126}; const colorScale2 = {red: 161, green: 208, blue: 127}; const colorScale3 = {red: 129, green: 217, blue: 126}; const colorScale4 = {red: 222, green: 226, blue: 131}; const colorScale5 = {red: 254, green: 235, blue: 132}; const colorScale6 = {red: 255, green: 210, blue: 129}; const colorScale7 = {red: 251, green: 185, blue: 124}; const colorScale8 = {red: 251, green: 158, blue: 117}; const colorScale9 = {red: 248, green: 131, blue: 111}; const colorScale10 = {red: 248, green: 105, blue: 107}; //Screensaver Default Theme Colors const scbackground = {red: 0, green: 0, blue: 0}; const scbackgroundInd1 = {red: 255, green: 0, blue: 0}; const scbackgroundInd2 = {red: 121, green: 222, blue: 121}; const scbackgroundInd3 = {red: 255, green: 255, blue: 0}; const sctime = {red: 255, green: 255, blue: 255}; const sctimeAMPM = {red: 255, green: 255, blue: 255}; const scdate = {red: 255, green: 255, blue: 255}; const sctMainIcon = {red: 255, green: 255, blue: 255}; const sctMainText = {red: 255, green: 255, blue: 255}; const sctForecast1 = {red: 255, green: 255, blue: 255}; const sctForecast2 = {red: 255, green: 255, blue: 255}; const sctForecast3 = {red: 255, green: 255, blue: 255}; const sctForecast4 = {red: 255, green: 255, blue: 255}; const sctF1Icon = {red: 255, green: 235, blue: 156}; const sctF2Icon = {red: 255, green: 235, blue: 156}; const sctF3Icon = {red: 255, green: 235, blue: 156}; const sctF4Icon = {red: 255, green: 235, blue: 156}; const sctForecast1Val = {red: 255, green: 255, blue: 255}; const sctForecast2Val = {red: 255, green: 255, blue: 255}; const sctForecast3Val = {red: 255, green: 255, blue: 255}; const sctForecast4Val = {red: 255, green: 255, blue: 255}; const scbar = {red: 255, green: 255, blue: 255}; const sctMainIconAlt = {red: 255, green: 255, blue: 255}; const sctMainTextAlt = {red: 255, green: 255, blue: 255}; const sctTimeAdd = {red: 255, green: 255, blue: 255}; //Auto-Weather-Colors const swClearNight = {red: 150, green: 150, blue: 100}; const swCloudy = {red: 75, green: 75, blue: 75}; const swExceptional = {red: 255, green: 50, blue: 50}; const swFog = {red: 150, green: 150, blue: 150}; const swHail = {red: 200, green: 200, blue: 200}; const swLightning = {red: 200, green: 200, blue: 0}; const swLightningRainy = {red: 200, green: 200, blue: 150}; const swPartlycloudy = {red: 150, green: 150, blue: 150}; const swPouring = {red: 50, green: 50, blue: 255}; const swRainy = {red: 100, green: 100, blue: 255}; const swSnowy = {red: 150, green: 150, blue: 150}; const swSnowyRainy = {red: 150, green: 150, blue: 255}; const swSunny = {red: 255, green: 255, blue: 0}; const swWindy = {red: 150, green: 150, blue: 150}; type PageType = ScriptConfig.PageType; type Config = ScriptConfig.Config; type PageBaseType = ScriptConfig.PageBaseType; type PageItem = ScriptConfig.PageItem; type PageBaseItem = ScriptConfig.PageBaseItem; type PageMediaItem = ScriptConfig.PageMediaItem; type PageThermoItem = ScriptConfig.PageThermoItem; type PageThermo2Item = ScriptConfig.PageThermo2Item; type PageEntities = ScriptConfig.PageEntities; type PageGrid = ScriptConfig.PageGrid; type PageGrid2 = ScriptConfig.PageGrid2; type PageGrid3 = ScriptConfig.PageGrid3; type PageThermo = ScriptConfig.PageThermo; type PageThermo2 = ScriptConfig.PageThermo2; type PageMedia = ScriptConfig.PageMedia; type PageAlarm = ScriptConfig.PageAlarm; type PageUnlock = ScriptConfig.PageUnlock; type PageQR = ScriptConfig.PageQR; type PagePower = ScriptConfig.PagePower; type PageChart = ScriptConfig.PageChart; type PagetypeType = ScriptConfig.PagetypeType; type NavigationItemConfig = ScriptConfig.NavigationItemConfig; declare namespace ScriptConfig { export type PopupType = | 'popupFan' | 'popupInSel' | 'popupLight' | 'popupLightNew' | 'popupNotify' | 'popupShutter' | 'popupThermo' | 'popupTimer'; export type EventMethod = | 'startup' | 'sleepReached' | 'pageOpenDetail' | 'buttonPress2' | 'buttonPress3' | 'renderCurrentPage' | 'button1' | 'button2'; export type panelRecvType = { event: 'event'; method: EventMethod; }; export type NavigationItemConfig = { name: string; left?: { single?: string; double?: string; }; right?: { single?: string; double?: string; }; page: string; optional?: never; } | null; export type SerialType = 'button' | 'light' | 'shutter' | 'text' | 'input_sel' | 'timer' | 'number' | 'fan'; /** * Defines the possible roles for entities in the NSPanel. * * This type represents the various roles that entities can have within the NSPanel system. * */ export type roles = | 'light' | 'socket' | 'dimmer' | 'hue' | 'rgb' | 'rgbSingle' | 'ct' | 'blind' | 'door' | 'window' | 'volumeGroup' | 'volume' | 'info' | 'humidity' | 'temperature' | 'value.temperature' | 'value.humidity' | 'thermostat' | 'warning' | 'cie' | 'gate' | 'motion' | 'buttonSensor' | 'button' | 'value.time' | 'level.timer' | 'value.alarmtime' | 'level.mode.fan' | 'lock' | 'slider' | 'switch.mode.wlan' | 'media' | 'timeTable' | 'airCondition'; export type ButtonActionType = | 'bExit' | 'bUp' | 'bNext' | 'bSubNext' | 'bPrev' | 'bSubPrev' | 'bHome' | 'notifyAction' | 'OnOff' | 'button' | 'up' | 'stop' | 'down' | 'positionSlider' | 'tiltOpen' | 'tiltStop' | 'tiltSlider' | 'tiltClose' | 'brightnessSlider' | 'colorTempSlider' | 'colorWheel' | 'tempUpd' | 'tempUpdHighLow' | 'media-back' | 'media-pause' | 'media-next' | 'media-shuffle' | 'volumeSlider' | 'mode-speakerlist' | 'mode-playlist' | 'mode-tracklist' | 'mode-repeat' | 'mode-equalizer' | 'mode-seek' | 'mode-crossfade' | 'mode-favorites' | 'mode-insel' | 'media-OnOff' | 'timer-start' | 'timer-pause' | 'timer-cancle' | 'timer-finish' | 'hvac_action' | 'mode-modus1' | 'mode-modus2' | 'mode-modus3' | 'number-set' | 'mode-preset_modes' | 'A1' | 'A2' | 'A3' | 'A4' | 'D1' | 'U1' | 'f1Icon' | 'f2Icon' | 'f3Icon' | 'f4Icon' | 'f5Icon'; export type RGB = { red: number; green: number; blue: number; }; export type Payload = { payload: string; }; export type PageBaseType = { type: PagetypeType; uniqueName: string; heading: string; items: PageItem[]; useColor?: boolean; subPage?: boolean; parent?: string; // icon and color not work here parentIcon?: string; parentIconColor?: RGB; prev?: string; prevIcon?: string; prevIconColor?: RGB; next?: string; nextIcon?: string; nextIconColor?: RGB; home?: string; homeIcon?: string; homeIconColor?: RGB; hiddenByTrigger?: boolean; alwaysOnDisplay?: boolean | 'action' | null; }; export type PagetypeType = | 'cardChart' | 'cardLChart' | 'cardEntities' | 'cardSchedule' | 'cardGrid' | 'cardGrid2' | 'cardGrid3' | 'cardThermo' | 'cardThermo2' | 'cardMedia' | 'cardUnlock' | 'cardQR' | 'cardAlarm' | 'cardPower'; //| 'cardBurnRec' export type globalPagesConfig = { version?: string; type: 'globalConfig'; subPages: PageTypeGlobal[]; nativePageItems?: any[]; navigation?: NavigationItemConfig[]; maxNavigationAdjustRuns?: number; }; export type PageTypeGlobal = | PageChart | PageEntities | PageSchedule | PageGrid | PageGrid2 | PageGrid3 | PageThermo | PageThermo2 | PageMedia | PageUnlock | PageQR | PageAlarm | PagePower | PageNative; export type PageType = | PageTypeGlobal | PageLink; export type PageLink = { heading?: string; globalLink: string; } & Pick<PageBaseType, 'prev' | 'next' | 'home' | 'parent'>; export type PageNative = { type: undefined; heading?: string; native: any; } & Pick<PageBaseType, 'uniqueName' | 'prev' | 'next' | 'home' | 'parent'>; export type PageEntities = { type: 'cardEntities'; items: PageItem[]; //4 } & PageBaseType & PageMenuBaseConfig; export type PageSchedule = { type: 'cardSchedule'; items: PageItem[]; //5 } & PageBaseType & PageMenuBaseConfig; export type PageGrid = { type: 'cardGrid'; items: PageItem[]; // 6 } & PageBaseType & PageMenuBaseConfig; export type PageGrid2 = { type: 'cardGrid2'; items: PageItem[]; // 8 } & PageBaseType & PageMenuBaseConfig; export type PageGrid3 = { type: 'cardGrid3'; items: PageItem[]; //4 } & PageBaseType & PageMenuBaseConfig; export type PageThermo = { type: 'cardThermo'; items: [PageThermoItem]; } & Omit<PageBaseType, 'useColor'>; export type PageThermo2 = { type: 'cardThermo2'; thermoItems: PageThermo2Item[]; items: PageThermo2PageItems[]; sortOrder?: 'H' | 'V' | 'HM' | 'VM' | 'HB' | 'VB'; } & Omit<PageBaseType, 'useColor'> & PageMenuBaseConfig; export type PageMedia = { type: 'cardMedia'; media: PageMediaItem; items: PageItem[]; } & Omit<PageBaseType, 'useColor' | 'autoCreateAlias'> & PageMenuBaseConfig; export type PageAlarm = { type: 'cardAlarm'; items: [PageItem]; } & PageBaseType; export type PageUnlock = { type: 'cardUnlock'; items: [PageItem]; } & PageBaseType; export type PageQR = { type: 'cardQR'; } & Omit<PageBaseType, 'useColor' | 'heading' | 'items'>; export type PagePower = { type: 'cardPower'; } & Omit<PageBaseType, 'useColor' | 'heading' | 'items'>; export type PageChart = { type: 'cardChart' | 'cardLChart'; } & Omit<PageBaseType, 'useColor' | 'heading' | 'items'>; export type PageItem = PageBaseItem | PageThermoItem | PageBaseCustomItem; /** * Base configuration for page menus. * Controls scroll behavior, filtering and presentation mode. */ type PageMenuBaseConfig = { /** * Defines how many items are scrolled at once. * - `"page"`: Scroll by a full page (all visible items). * - `"half"`: Scroll by half a page (only supported by certain card types). */ scrollType?: 'page' | 'half'; /** * Filters which items are shown. * - `"true"`: Show only items whose primary entity resolves to `true`. * - `"false"`: Show only items whose primary entity resolves to `false`. * - `number`: Show only items matching the given numeric filter value. */ filterType?: 'true' | 'false' | number; } & ( /** * Standard scroll presentations. * - `"classic"`: Windowed paging with optional `"half"`/`"page"` stride. * - `"arrow"`: Fixed number of slots, last slot can show a paging arrow. * Defaults to `"classic"`. */ {scrollPresentation?: 'classic' | 'arrow'} | { /** * Special mode that behaves like `"classic"`, * including `"half"`/`"page"` support. * Pages automatically advance after a fixed interval. */ scrollPresentation: 'auto'; /** * Interval (in seconds) to automatically advance to the next page. * Always required in `"auto"` mode. * Defaults to `15` seconds if not specified. */ scrollAutoTiming: number; } ); export type PageMediaItem = { /** * The media dp to use, most a folder, device or channel. Not a state. */ id: string; name?: string; mediaDevice?: string; //??? colorMediaIcon?: RGB; colorMediaArtist?: RGB; colorMediaTitle?: RGB; speakerList?: string[]; /** * Optional list of predefined volume presets. * Each entry must be a string formatted as "name?value", * e.g. ["quiet?5", "loud?95"]. * * - `name`: Label shown in the UI. * - `value`: Volume level (as stringified number). * * Notes: * - The effective volume will be clamped to `minValue` and `maxValue`. * For example, with minValue = 40 and maxValue = 60, * "loud?100" will result in volume = 60. */ volumePresets?: string[]; /** * List of favorite playlists (whitelist). * - If present and non-empty, only the playlists in this list are shown. * - If empty or undefined, all available playlists are shown. */ favoriteList?: string[]; /** * List of available playlists. * - Alexa & Spotify: contains the playlists provided by the adapter. * - Sonos: contains user-defined playlists, since Sonos playlists cannot be read by the adapter. */ playList?: string[]; equalizerList?: string[]; repeatList?: string[]; globalTracklist?: string[]; /* Volume */ minValue?: number; /* Volume */ maxValue?: number; /** detailed configuration */ itemsColorOn?: { trackList?: RGB; speakerList?: RGB; repeat?: RGB; equalizer?: RGB; playList?: RGB; online?: RGB; reminder?: RGB; crossfade?: RGB; favoriteList?: RGB; volumePresets?: RGB; }; itemsColorOff?: { trackList?: RGB; speakerList?: RGB; repeat?: RGB; equalizer?: RGB; playList?: RGB; online?: RGB; reminder?: RGB; crossfade?: RGB; favoriteList?: RGB; volumePresets?: RGB; }; deactivateDefaultItems?: { trackList?: boolean; speakerList?: boolean; repeat?: boolean; equalizer?: boolean; playList?: boolean; online?: boolean; reminder?: boolean; clock?: boolean; favoriteList?: boolean; crossfade?: boolean; }; }; export type PageThermoItem = { popupThermoMode1?: string[]; popupThermoMode2?: string[]; popupThermoMode3?: string[]; popUpThermoName?: string[]; setThermoAlias?: string[]; setThermoDestTemp2?: string; } & PageBaseItem; export type PageThermo2PageItems = { heatCycleIndex?: number; } & PageBaseItem; export type PageThermo2Item = ( | { // temperature data point thermoId1: string; // humidity data point thermoId2?: string; // mode data point (common.states) modeId?: string; // set data point (writeable) set: string; } | { //channel with all data id: string; // for cooling part of a airCondition name2?: string; iconHeatCycle2?: AllIcons | ''; iconHeatCycleOnColor2?: RGB; iconHeatCycleOffColor2?: RGB; } ) & { // icon id icon?: AllIcons | ''; // icon for id2 icon2?: AllIcons | ''; // icon for the pageitem iconHeatCycle?: AllIcons | ''; iconHeatCycleOnColor?: RGB; iconHeatCycleOffColor?: RGB; // headline name?: string; // 100 === 10.0 minValue?: number; maxValue?: number; stepValue?: number; /** * The unit of the 2. line. can string, icon or state */ power?: string; unit2?: string; onColor2?: RGB; unit?: string; onColor?: RGB; // array of stings for mode modeList?: string[]; } // mean string start with getState(' and end with ').val type getStateID = string; export type PageBaseCustomItem = { type: 'custom'; id: string; navigate?: boolean | null | undefined; targetPage?: string | null | undefined; targetPageLongPress?: string | null | undefined; icon?: string; icon2?: string; name?: string; onColor?: RGB | string; offColor?: RGB | string; colorScale?: IconScaleElement; buttonText?: string; }; export type PageBaseItem = | ({ /** * Native configuration no validation */ native: any; } & ({navigate: boolean; targetPage: string} | {navigate?: undefined; targetPage?: undefined})) | (( | { navigate: true; targetPage: string; /** * The data point with the data to be used. */ id?: string | null; } | { /** * The data point with the data to be used. */ id: string; navigate?: false | null | undefined; targetPage?: string | null | undefined; } ) & { type?: undefined | null; uniqueName?: string; role?: string; targetPageLongPress?: string | null | undefined; /** * The icon that is used in the standard case or if ID is true */ icon?: AllIcons; /** * The icon that is used when id is false */ icon2?: AllIcons; /** * Used with blinds for partially open. */ icon3?: AllIcons; /** * The color that is used in the standard case or if ID is true */ onColor?: RGB | string; /** * The color that is used when id is false */ offColor?: RGB | string; useColor?: boolean; /** * Interpolate the icon colour by ID */ interpolateColor?: boolean; minValueBrightness?: number; maxValueBrightness?: number; minValueColorTemp?: number; maxValueColorTemp?: number; minValueLevel?: number; maxValueLevel?: number;