diff --git a/ioBroker/NsPanelTs.ts b/ioBroker/NsPanelTs.ts index e71163ae..603ed73b 100644 --- a/ioBroker/NsPanelTs.ts +++ b/ioBroker/NsPanelTs.ts @@ -1,6 +1,6 @@ /*----------------------------------------------------------------------- -TypeScript v4.6.0.1 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @ticaki / @Britzelpuf / @Sternmiere / @ravenS0ne -- abgestimmt auf TFT 55 / v4.6.0 / BerryDriver 9 / Tasmota 14.5.0 +TypeScript v4.6.2.1 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @ticaki / @Britzelpuf / @Sternmiere / @ravenS0ne +- abgestimmt auf TFT 55 / v4.6.2 / BerryDriver 9 / Tasmota 14.5.0 @joBr99 Projekt: https://github.com/joBr99/nspanel-lovelace-ui/tree/main/ioBroker NsPanelTs.ts (dieses TypeScript in ioBroker) Stable: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/NsPanelTs.ts icon_mapping.ts: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/icon_mapping.ts (TypeScript muss in global liegen) @@ -33,112 +33,6 @@ ReleaseNotes: Bugfixes und Erweiterungen: See ChangeLog all Release Notes: https://github.com/joBr99/nspanel-lovelace-ui/wiki/Release-Notes - - 08.11.2023 - v4.3.3 Upgrade TFT 53 / 4.3.3 - - 11.11.2023 - v4.3.3.1 Fix for Issues #1020 HandleHardwareButton buttonConfig.mode -> 'toggle' and 'set' - - 12.11.2023 - v4.3.3.2 Add autoCreateALias to cardUnlock - - 12.11.2023 - v4.3.3.2 Change NodeJS to at least v18.X.X - - 13.11.2023 - v4.3.3.3 if setOption = false, do not create autoAlias (Functional/Servicemenu) and Datapoints - - 15.11.2023 - v4.3.3.4 New Service Page -> ioBroker Info - - 16.11.2023 - v4.3.3.5 Add Multilingualism to Service Menu (39 languages) - - 17.11.2023 - v4.3.3.5 Add Multilingualism to cardUnlock, cardQR, popupFan, popupTimer (39 languages) - - 18.11.2023 - v4.3.3.6 Add autoCreateALias to PageAlarm - - 20.11.2023 - v4.3.3.6 Add actionStringArray to PageAlarm - - 20.11.2023 - v4.3.3.6 Add Multilingualism to cardAlarm (39 languages) - - 20.11.2023 - v4.3.3.7 Add Multilingualism to cardMedia (39 languages) - - 20.11.2023 - v4.3.3.8 Add Method dayjs (Multilingualism) - - 20.11.2023 - v4.3.3.9 Add ScreensaverEntityOnColor, ...OffColor, ...OnText, ...OffText - - 23.11.2023 - v4.3.3.10 Code Optimization in Config Area - - 24.11.2023 - v4.3.3.11 Add autoCreateALias to PageQR - - 24.11.2023 - v4.3.3.12 Separation of page creation and page updates in cardPower - - 24.11.2023 - v4.3.3.12 Add alwaysOnDisplay to cardPower - Leave display on if the alwaysOnDisplay parameter is "true" - - 25.11.2023 - v4.3.3.13 Separation of page creation and page updates in cardMedia - - 25.11.2023 - v4.3.3.13 Add alwaysOnDisplay to cardMedia - Leave display on if the alwaysOnDisplay parameter is "true" - - 25.11.2023 - v4.3.3.13 Fix Sonos Repeat/Shuffle - - 25.11.2023 - v4.3.3.14 Refactoring Sonos-Player (with Playlist, Tracklist, Favorites, Eqalizer (if no Favorites)) - - 29.11.2023 - v4.3.3.15 Fix cardMedia Volume-Slider / Add Init Release to Startup - - 30.11.2023 - v4.3.3.16 Beautification of the Sonos player Strings / Add Duration & Elapsed - - 01.12.2023 - v4.3.3.16 Fix Datapoints with Value null - - 02.12.2023 - v4.3.3.16 Request replaced by Axios - - 04.12.2023 - v4.3.3.17 Add SEEK and CROSSFADE to Sonos cardMedia - - 05.12.2023 - v4.3.3.18 Add (ELAPSED/DURATION) to v2Adapter alexa2 - - 06.12.2023 - v4.3.3.18 Replace missing Type console.log --> log(message, 'serverity') - - 07.12.2023 - v4.3.3.19 Fix Trigger activeDimmodeBrightness if Dimmode = -1 - - 08.12.2023 - v4.3.3.20 add Role AlarmTime for Alarm Clock - - 09.12.2023 - v4.3.3.21 Add createAutoAlias to popupTimer only for Time - - 14.12.2023 - v4.3.3.22 Add UpdateMessage => disable the update messages - - 14.12.2023 - v4.3.3.22 Fix name by static Navi Icon - - 17.12.2023 - v4.3.3.23 Optimization of the blind control (enable or disable Up/Stop/Down) - - 18.12.2023 - v4.3.3.24 Hotfix Update Message / Add Icon Colors to Entity Button - - 21.12.2023 - v4.3.3.25 Add switch of cardQR by hidePassword: true - - 26.12.2023 - v4.3.3.26 Fix Log output payload -> Json.stringify - - 28.12.2023 - v4.3.3.27 Fix Payload (pageItem.id -> placeId) by Function CreateEntity - - 28.12.2023 - v4.3.3.27 Fix Fallback PageItem.name by Function CreateEntity --> Many Bugs - - 30.12.2023 - v4.3.3.28 Fix short ID's in v4.3.3.27 - - 30.12.2023 - v4.3.3.28 Fix window Icons in CreateEntity - - 30.12.2023 - v4.3.3.28 Add MQTT-Client Check - - 02.01.2024 - v4.3.3.29 Add Tasmota Buzzer for NotifyPage - - 02.02.2024 - v4.3.3.29 Fix ThermoPage -> UnSubScribsWatcher - - 02.02.2024 - v4.3.3.30 Add stronger config type checks - - 03.02.2024 - v4.3.3.31 Remove: autoCreateAlias from cardMedia - - 03.02.2024 - v4.3.3.31 Remove: adapterPlayerInstance from every card except cardMedia - - 03.02.2024 - v4.3.3.31 [dev]: optional with type - cardMedia has adapterPlayerInstance all other not - - 03.02.2024 - v4.3.3.31 [dev]: add PlayerType some more work to do - - 03.02.2024 - v4.3.3.31 changed: adapterPlayerInstance instance 0-9 allowed. Always require a '.' at the end. - - 04.01.2024 - v4.3.3.32 Hotfix Spotify - - 04.01.2024 - v4.3.3.32 [DEV] Add Types see commits - - 04.01.2024 - v4.3.3.32 Add more details to types for: leftScreensaverEntity, indicatorScreensaverEntity, PageThermo, PageMedia - - 04.01.2024 - v4.3.3.32 Remove not uses propertys from PageItem - - 05.01.2024 - v4.3.3.32 Add Body for BoseSoundtouch-Player - - 05.01.2024 - v4.3.3.33 Add BoseSoundtouch Functions - - 05.01.2024 - v4.3.3.33 Screensaver Fix max Number of indicatorScreensaverEntity - - 07.01.2024 - v4.3.3.33 Fix BoseSoundtouch Proto - - 08.01.2024 - v4.3.3.34 Fix: Disabled Icon Status while bug in updating data points in ioBroker (reason unknown) - - 08.01.2024 - v4.3.3.35 Add: relay.1/relay.2 show the confirmed status - - 09.01.2024 - v4.3.3.36 Fix: change ScreensaverTimeout and activeBrightness - - 09.01.2024 - v4.3.3.36 Fix: schedule SendTime - - 09.01.2024 - v4.3.3.36 Fix: Function _schedule SummerTime/WinterTime - - 15.01.2024 - v4.3.3.37 Change: Allow data points to be flushed for popUpNotify. Activate screensaver with one click. - - 16.01.2024 - v4.3.3.38 Fix: joBr99#1098 - - 16.01.2024 - v4.3.3.38 Types: Number of PageItems defined & HandleScreensaverStatusIcons rewritten - - 16.01.2024 - v4.3.3.38 Optimate: function SendTime() - - 17.01.2024 - v4.3.3.38 Add: ScreensaverEntityIconSelect for MRIcons is like common.states for states. - - 17.01.2024 - v4.3.3.38 Add: Changing the ScreensaverEntityValue value updates the screensaver. - - 19.01.2024 - v4.3.3.38 Change: yAxisTicks parameter is not required in cardLChart PageItem - - 20.01.2024 - v4.3.3.38 Add: click on indicatorIcon navigate to Page - - 23.01.2024 - v4.3.3.39 Add: Optional setOn & setOff for HW button with mode 'set' - - 28.01.2024 - v4.3.3.39 Fix: ack for read-only state - - 03.02.2024 - v4.3.3.40 Fix: RGB maxValueColorTemp - - 05.02.2024 - v4.3.3.40 Fix: SqueezeboxRPC-Media-Player and add some Functions - - 06.02.2024 - v4.3.3.41 Fix: activeBrightness -> null - - 06.02.2024 - v4.3.3.41 Fix: bHome -> corrected PageId - - 07.02.2024 - v4.3.3.42 Minor Fixes - - 09.02.2024 - v4.3.3.42 Change pageId with Alias in Communication with HMI - - 09.02.2024 - v4.3.3.42 Spotify Media-Player: Dynamic loading of the speaker list, playlist, tracklist, fix repeat, add seek, add elapsed/duration - - 10.02.2024 - v4.3.3.42 Spotify Minor Fixes; Add miValue / maxValue to Volume-Slider - - 10.02.2024 - v4.3.3.43 Fix: cardGrid2 => 9 Entities for Layout 'us-p' issue #1167 - - 11.02.2024 - v4.3.3.43 Fix VolumeSlider - - 05.05.2024 - v4.3.3.44 Fix MQTT-Port-check - - 13.05.2024 - v4.4.0.0 TFT 54 / 4.4.0 - - 19.05.2024 - v4.4.0.1 TFT 53 / 4.4.0 - - 13.06.2024 - v4.4.0.2 Calculated energy consumption in relation to dimming mode and relay state (not the energy consumption of the outputs) - - 13.06.2024 - v4.4.0.3 Check prefix '.tele.' in config.NSPanelReceiveTopic - - 13.09.2024 - v4.4.0.4 New Feature: Hidden Carts - - 18.09.2024 - v4.4.0.5 Remove day.JS - - 19.09.2024 - v4.4.0.6 Check Ports with mqtt.X and mqtt-client.X - - 27.09.2024 - v4.4.0.6 Fix: Using MQTT adapter or MQTT-CLIENT adapter / Minor Fix by wolwin - - 09.10.2024 - v4.4.0.7 Fix: first start and initialisation with new NSPanel device - Fix by wolwin - - 25.10.2024 - v4.4.0.8 Fix: InitDimmode => timeDimMode Day / timeDimMode Night - - 25.10.2024 - v4.4.0.8 Add Always On Display (AOD) to cardTHermo - - 25.10.2024 - v4.4.0.8 Add Hide Buttons at Power Off to cardThermo (Climate Alias Channel) - - 26.10.2024 - v4.4.0.8 Add Custom Icon Object to cartdThermo (Climate Alias Channel - - 31.10.2024 - v4.4.0.9 Fix: del 'HandleMessage()' in Trigger 'activeDimmodeBrightness' - - 22.11.2024 - v4.4.0.10 Fix: Bug #1266 trigger timeoutScreensaver - - 22.11.2024 - v4.4.0.11 Add new value 'PopupNotify' to ActivePage - - 07.12.2024 - v4.4.0.12 Add JSDocs and some small fixes - - 11.01.2025 - v4.4.0.13 Error due to an empty character string when subscribing to icon IDs - - 20.01.2025 - v4.4.0.14 Add Screensaver3 and cardGrid3 - - 20.01.2025 - v4.4.0.14 Added Easy-View Screensaver states handling - - 20.01.2025 - v4.4.0.14 icon3 added for use in blind for the state between 0-100 - 21.01.2025 - v4.5.0 TFT 54 / 4.5.0 - 23.01.2025 - v4.5.0.1 Change TFT URLs - 23.01.2025 - v4.5.0.2 fix handleScreensaverUpdate => leftscreensaverEntity; fix Type leftscreensaverentitiy @@ -147,16 +41,19 @@ ReleaseNotes: - 30.01.2025 - v4.5.0.4 fix DetermineDimBrightness (function returns undefined, because wrong DP check) - 03.02.2025 - v4.5.0.5 Bugfix InitDimmode by Gargano - 14.03.2025 - v4.5.2 Fix Bugs in HUE-Light, Fix Icon-Colors with interpolateColors (Color, ColorTemp, Brightness), Fix ON instead of ON_ACTUAL for writing DP - - 15.03.2025 - v4.5.2.1 Add Functions to Calculate Colors of Icons (Darken and CT (Kelvin)) - - 15.03.2025 - v4.5.2.1 Remove New Sliders (popupLightNew), Fix TFT-Pictures in TFT --> with v4.6.0 + - 15.03.2025 - v4.5.2.1 Add Functions to Calculate Colors of HUE Icons (Darken and CT (Kelvin/Mired)) + - 15.03.2025 - v4.5.2.1 Remove New Sliders (popupLightNew), Fix TFT-Pictures in TFT --> with v4.6.0 / TFT 55 - 16.03.2025 - v4.6.0 Fix Bugs in Channels Light and RGBsingle-Light, Fix Icon-Colors with interpolateColors (Color, ColorTemp, Brightness), Fix ON instead of ON_ACTUAL for writing DP - 16.03.2025 - v4.6.0.1 Add Functions to Calculate Colors of RGBsingle Icons (Darken and CT (Kelvin/Mired)) - 16.03.2025 - v4.6.0.1 Fix Light-Icons if Color-Temperature uses Mired instead of Kelvin (500 Mired - 153 Mired = 2000 K - 6536 K) - 16.03.2025 - v4.6.0.1 Add icon2 to Lights + - 17.03.2025 - v4.6.0.1 Add CIE Channel to Lights - 17.03.2025 - v4.6.0.1 Add Functions to Calculate Colors of RGB and CT Icons (Darken and CT (Kelvin/Mired)) - - 17.03.2025 - v4.6.0.1 Add function cie_to_rgb, Add CIE Channel to Lights - 18.03.2025 - v4.6.0.1 Add hidden Entity2 (Password/Switch) to cardQR (PageItem-Parameter "hideEntity2" true/false) - + - 01.04.2025 - v4.6.1 TFT 55 / 4.6.1 - Add Some Adapter Functions + - 01.04.2025 - v4.6.2 TFT 55 / 4.6.2 - Add cardSchedule + - 01.04.2025 - v4.6.2.1 Add startup TFT-Release directly from NSPanel-TFT, Comparison between version number and release removed + Todo: - XX.12.2024 - v5.0.0 ioBroker Adapter @@ -175,17 +72,21 @@ Tasmota Konsole: Mögliche Seiten-Ansichten: screensaver Page - wird nach definiertem Zeitraum (config) mit Dimm-Modus aktiv (Uhrzeit, Datum, Aktuelle Temperatur mit Symbol) (die 4 kleineren Icons können als Wetter-Vorschau + 4Tage (Symbol + Höchsttemperatur) oder zur Anzeige definierter Infos konfiguriert werden) + - weitere Screensaver wie Advanced, Easyview und Alternativ cardEntities Page - 4 vertikale angeordnete Steuerelemente - auch als Subpage + 5 vertikale angeordnete Steuerelemente - auch als Subpage beim US-Modell im Portrait-Modus + cardSchedule Page - 6 vertikale angeordnete Text-Steuerelemente - auch als Subpage cardGrid Page - 6 horizontal angeordnete Steuerelemente in 2 Reihen a 3 Steuerelemente - auch als Subpage - cardGrid2 Page - 8 horizontal angeordnete Steuerelemente in 2 Reihen a 4 Steuerelemente bzw. beim US-Modell im Portrait-Modus - 9 horizontal angeordnete Steuerelemente in 3 Reihen a 3 Steuerelemente - auch als Subpage - cardGrid3 Page - 4 horizontal angeordnete Steuerelemente in 2 Reihen a 2 Steuerelemente + cardGrid2 Page - 8 horizontal angeordnete Steuerelemente in 2 Reihen a 4 Steuerelemente - auch als Subpage + 9 horizontal angeordnete Steuerelemente in 3 Reihen a 3 Steuerelemente - auch als Subpage - beim US-Modell im Portrait-Modus + cardGrid3 Page - 4 horizontal angeordnete Steuerelemente in 2 Reihen a 2 Steuerelemente - auch als Subpage cardThermo Page - Thermostat mit Solltemperatur, Isttemperatur, Mode - Weitere Eigenschaften können im Alias definiert werden cardMedia Page - Mediaplayer - Ausnahme: Alias sollte mit Alias-Manager automatisch über Alexa-Verzeichnis Player angelegt werden cardAlarm Page - Alarmseite mit Zustand und Tastenfeld cardPower Page - Energiefluss cardChart Page - Balken-Diagramme aus History, SQL oder InfluxDB cardLChart Page - Linien-Diagramme aus History, SQL oder InfluxDB + cardQR Page - QR Code für Bereitstellung Gäste-WLAN Vollständige Liste zur Einrichtung unter: https://github.com/joBr99/nspanel-lovelace-ui/wiki/ioBroker-Card-Definitionen-(Seiten) @@ -206,6 +107,7 @@ Mögliche Aliase: (Vorzugsweise mit ioBroker-Adapter "Geräte verwalten" konfigu Steckdose - An/Aus (Schalter) Dimmer - An/Aus, Brightness Farbtemperatur - An/Aus, Farbtemperatur und Brightness + CIE-Licht - Zum Schalten von Color-Leuchtmitteln über CIE-Wert [x,y] - Array, Brightness, Farbtemperatur, An/Aus HUE-Licht - Zum Schalten von Color-Leuchtmitteln über HUE-Wert, Brightness, Farbtemperatur, An/Aus (HUE kann auch fehlen) RGB-Licht - RGB-Leuchtmitteln/Stripes welche Rot/Grün/ und Blau separat benötigen (Tasmota, WifiLight, etc.) + Brightness, Farbtemperatur RGB-Licht-einzeln - RGB-Leuchtmitteln/Stripes welche HEX-Farbwerte benötigen (Tasmota, WifiLight, etc.) + Brightness, Farbtemperatur @@ -253,14 +155,13 @@ Install/Upgrades in Konsole: Tasmota BerryDriver Install: Backlog UrlFetch https://raw.githubusercontent.com/joBr99/nspanel-lovelace-ui/main/tasmota/autoexec.be; Restart 1 Tasmota BerryDriver Update: Backlog UpdateDriverVersion https://raw.githubusercontent.com/joBr99/nspanel-lovelace-ui/main/tasmota/autoexec.be; Restart 1 - TFT EU STABLE Version: FlashNextion http://nspanel.de/nspanel-v4.6.0.tft + TFT EU STABLE Version: FlashNextion http://nspanel.de/nspanel-v4.6.2.tft - TFT US-L STABLE Version: FlashNextion http://nspanel.de/nspanel-us-l-v4.5.0.tft - TFT US-P STABLE Version: FlashNextion http://nspanel.de/nspanel-us-p-v4.5.0.tft + TFT US-L STABLE Version: FlashNextion http://nspanel.de/nspanel-us-l-v4.6.0.tft + TFT US-P STABLE Version: FlashNextion http://nspanel.de/nspanel-us-p-v4.6.0.tft --------------------------------------------------------------------------------------- */ - /******************************* Begin CONFIG Parameter *******************************/ // DE: liefert bei true detailliertere Meldundgen im Log. @@ -1040,8 +941,8 @@ export const config: Config = { // _________________________________ DE: Ab hier keine Konfiguration mehr _____________________________________ // _________________________________ EN: No more configuration from here _____________________________________ -const scriptVersion: string = 'v4.6.0.1'; -const tft_version: string = 'v4.6.0'; +const scriptVersion: string = 'v4.6.2.1'; +const tft_version: string = 'v4.6.2'; const desired_display_firmware_version = 55; const berry_driver_version = 9; @@ -1353,15 +1254,11 @@ CheckMQTTPorts(); * @since 4.4.0 */ async function Init_Release () { - const FWVersion = [ 0, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56]; - const FWRelease = ['0', '3.3.1', '3.4.0', '3.5.0', '3.5.X', '3.6.0', '3.7.3', '3.8.0', '3.8.3', '3.9.4', '4.0.5', '4.1.4', '4.2.1', '4.4.0', '4.5.0', '4.6.0', '4.7.0']; try { if (existsObject(NSPanel_Path + 'Display_Firmware.desiredVersion') == false) { await createStateAsync(NSPanel_Path + 'Display_Firmware.desiredVersion', desired_display_firmware_version, {type: 'number', write: false}); - // if 'desiredVersion' as a string: await createStateAsync(NSPanel_Path + 'Display_Firmware.desiredVersion', String(desired_display_firmware_version), { type: 'string', write: false }); } else { await setStateAsync(NSPanel_Path + 'Display_Firmware.desiredVersion', desired_display_firmware_version, true); - // if 'desiredVersion' as a string: await setStateAsync(NSPanel_Path + 'Display_Firmware.desiredVersion', String(desired_display_firmware_version), true); } if (existsObject(NSPanel_Path + 'Config.Update.activ') == false) { @@ -1370,19 +1267,21 @@ async function Init_Release () { await setStateAsync(NSPanel_Path + 'Config.Update.activ', 0, true); } - let currentFW = 0; + let currentFWV = 0; + let currentFWR = '0.0.0' let findFWIndex = 0; log('Desired TFT Firmware: ' + desired_display_firmware_version + ' / ' + tft_version, 'info'); - if (existsObject(NSPanel_Path + 'Display_Firmware.currentVersion')) { - currentFW = parseInt(getState(NSPanel_Path + 'Display_Firmware.currentVersion').val); - findFWIndex = FWVersion.indexOf(currentFW); - log('Installed TFT Firmware: ' + currentFW + ' / v' + FWRelease[findFWIndex], 'info'); + + if (existsObject(NSPanel_Path + 'Display_Firmware.currentRelease')) { + currentFWV = parseInt(getState(NSPanel_Path + 'Display_Firmware.currentVersion').val); + currentFWR = getState(NSPanel_Path + 'Display_Firmware.currentRelease').val; + log('Installed TFT Firmware: ' + currentFWV + ' / v' + currentFWR, 'info'); } //Create Long Term if (existsObject(NSPanel_Path + 'Display_Firmware.TFT.desiredVersion') == false) { //Create TFT DP's if (isSetOptionActive) { - await createStateAsync(NSPanel_Path + 'Display_Firmware.TFT.currentVersion', currentFW + ' / v' + FWRelease[findFWIndex], {type: 'string', write: false}); + await createStateAsync(NSPanel_Path + 'Display_Firmware.TFT.currentVersion', currentFWV + ' / v' + currentFWR, {type: 'string', write: false}); await createStateAsync(NSPanel_Path + 'Display_Firmware.TFT.desiredVersion', String(desired_display_firmware_version), {type: 'string', write: false}); setObject(AliasPath + 'Display_Firmware.TFT.currentVersion', {type: 'channel', common: {role: 'info', name: 'current TFT-Version'}, native: {}}); setObject(AliasPath + 'Display_Firmware.TFT.desiredVersion', {type: 'channel', common: {role: 'info', name: 'desired TFT-Version'}, native: {}}); @@ -1399,7 +1298,7 @@ async function Init_Release () { } } else { //Create TFT DP's - await setStateAsync(NSPanel_Path + 'Display_Firmware.TFT.currentVersion', currentFW + ' / v' + FWRelease[findFWIndex], true); + await setStateAsync(NSPanel_Path + 'Display_Firmware.TFT.currentVersion', currentFWV + ' / v' + currentFWR, true); await setStateAsync(NSPanel_Path + 'Display_Firmware.TFT.desiredVersion', String(desired_display_firmware_version) + ' / ' + tft_version, true); } } catch (err: any) { @@ -1581,8 +1480,6 @@ on({id: [NSPanel_Path + 'Config.hiddenCards'], change: 'ne'}, async function (ob } }); - - /** * This function is triggered when the state of `id: [NSPanel_Path + 'Config.ScripgtDebugStatus']` changes. * It logs a message indicating whether debug mode is activated or disabled. @@ -1683,7 +1580,6 @@ on({id: [NSPanel_Path + 'Config.localeNumber', NSPanel_Path + 'Config.temperatur } }); - /** * Creates the state for the screensaver advanced switch if it does not exist. * This switch is used to switch between two different screensaver layouts. @@ -1714,9 +1610,6 @@ function CheckEnableSetObject () { return enableSetObject; } - - - /** * Creates the states for the current active page if they do not exist. * These states are used to store the heading, type and id0 of the active page. @@ -2649,7 +2542,6 @@ function ScreensaverDimmode (timeDimMode: NSPanel.DimMode) { } } - /** * Initializes the weather forecast states if they do not exist. * This function creates a new state for weatherForecast, weatherForecastTimer and entityChangeTime with a default value if they are not already present. @@ -2845,7 +2737,6 @@ function addDimTime (strTime) { return d; } - /** * Checks if the current time is within the given range. * The range is defined by two strings in the format HH:MM:SS. @@ -2891,7 +2782,6 @@ async function Calc_Consumption (Brightness: number, Relays: number | undefined) } } - /** * Counts the number of Relays that are currently on in the given Path. * @param {string} Path - The path to the Relays states. @@ -2980,7 +2870,6 @@ async function DetermineScreensaverDimmode (timeDimMode: NSPanel.DimMode): Promi return 100 } - /** * Initializes the mean power consumption of the NSPanel. * @@ -4274,19 +4163,27 @@ on({id: config.panelRecvTopic}, async (obj) => { if (isSetOptionActive) { if (split[0] == 'event' && split[1] == 'startup') { await createStateAsync(NSPanel_Path + 'Display_Firmware.currentVersion', {type: 'string', write: false}); + await createStateAsync(NSPanel_Path + 'Display_Firmware.currentRelease', {type: 'string', write: false}); await createStateAsync(NSPanel_Path + 'NSPanel_Version', {type: 'string', write: false}); await setStateAsync(NSPanel_Path + 'Display_Firmware.currentVersion', {val: split[2], ack: true}); + await setStateAsync(NSPanel_Path + 'Display_Firmware.currentRelease', {val: split[4], ack: true}); await setStateAsync(NSPanel_Path + 'NSPanel_Version', {val: split[3], ack: true}); if (autoCreateAlias) { setObject(AliasPath + 'Display.TFTVersion', {type: 'channel', common: {role: 'info', name: 'Display.TFTVersion'}, native: {}}); + setObject(AliasPath + 'Display.TFTRelease', {type: 'channel', common: {role: 'info', name: 'Display.TFTRelease'}, native: {}}); setObject(AliasPath + 'Display.Model', {type: 'channel', common: {role: 'info', name: 'Display.Model'}, native: {}}); await createAliasAsync(AliasPath + 'Display.TFTVersion.ACTUAL', NSPanel_Path + 'Display_Firmware.currentVersion', true, { type: 'string', role: 'state', name: 'ACTUAL', }); + await createAliasAsync(AliasPath + 'Display.TFTRelease.ACTUAL', NSPanel_Path + 'Display_Firmware.currentRelease', true, { + type: 'string', + role: 'state', + name: 'ACTUAL', + }); await createAliasAsync(AliasPath + 'Display.Model.ACTUAL', NSPanel_Path + 'NSPanel_Version', true, {type: 'string', role: 'state', name: 'ACTUAL'}); } } @@ -4668,6 +4565,9 @@ function GeneratePage (page: PageType): void { case 'cardEntities': SendToPanel(GenerateEntitiesPage(page)); break; + case 'cardSchedule': + SendToPanel(GenerateSchedulePage(page)); + break; case 'cardThermo': SendToPanel(GenerateThermoPage(page)); break; @@ -4852,6 +4752,27 @@ function GenerateEntitiesPage (page: NSPanel.PageEntities): NSPanel.Payload[] { } } +/** + * Generates the payload for an Schedule page on the NSPanel. + * + * This function creates and returns the payload required to display an schedule page on the NSPanel. + * + * @function GenerateSchedulePage + * @param {NSPanel.PageSchedule} page - The entities page configuration. + * @returns {NSPanel.Payload[]} The payload array for the schedule page. + */ +function GenerateSchedulePage (page: NSPanel.PageSchedule): NSPanel.Payload[] { + try { + let out_msgs: NSPanel.Payload[]; + out_msgs = [{payload: 'pageType~cardSchedule'}]; + out_msgs.push({payload: GeneratePageElements(page)}); + return out_msgs; + } catch (err: any) { + log('error at function GenerateSchedulePage: ' + err.message, 'warn'); + return []; + } +} + /** * Generates the payload for a grid page on the NSPanel. * @@ -4958,6 +4879,9 @@ function GeneratePageElements (page: PageType): string { maxItems = 4; } break; + case 'cardSchedule': + maxItems = 6; + break; case 'cardGrid': maxItems = 6; break; @@ -12661,6 +12585,22 @@ function rgb_to_cie (red: number, green: number, blue: number): string { return cie; } +function perc2color(percent: number) { + let red: number = 0; + let green: number = 0; + let blue: number = 0; + if(percent < 50) { + red = 255; + green = Math.round(5.1 * percent); + } + else { + green = 255; + red = Math.round(510 - 5.10 * percent); + } + var h = red * 0x10000 + green * 0x100 + blue * 0x1; + return '#' + ('000000' + h.toString(16)).slice(-6); +} + function cie_to_rgb(x: number, y: number, brightness: number): RGB { //Set to maximum brightness if no custom value was given (Not the slick ECMAScript 6 way for compatibility reasons) if (brightness === undefined) { @@ -12845,11 +12785,13 @@ type PageItem = NSPanel.PageItem; type PageType = NSPanel.PageType; type Config = NSPanel.Config; type PageEntities = NSPanel.PageEntities; +type PageSchedule = NSPanel.PageSchedule; type PageChart = NSPanel.PageChart; type PagePower = NSPanel.PagePower; type PageGrid = NSPanel.PageGrid; -type PageQR = NSPanel.PageQR; type PageGrid2 = NSPanel.PageGrid2; +type PageGrid3 = NSPanel.PageGrid3; +type PageQR = NSPanel.PageQR; type PageMedia = NSPanel.PageMedia; type PageThermo = NSPanel.PageThermo; type PageUnlock = NSPanel.PageUnlock; @@ -13183,15 +13125,20 @@ namespace NSPanel { hiddenByTrigger?: boolean; }; - export type PagetypeType = 'cardChart' | 'cardLChart' | 'cardEntities' | 'cardGrid' | 'cardGrid2' | 'cardGrid3' | 'cardThermo' | 'cardMedia' | 'cardUnlock' | 'cardQR' | 'cardAlarm' | 'cardPower'; //| 'cardBurnRec' + export type PagetypeType = 'cardChart' | 'cardLChart' | 'cardEntities' | 'cardSchedule' | 'cardGrid' | 'cardGrid2' | 'cardGrid3' | 'cardThermo' | 'cardMedia' | 'cardUnlock' | 'cardQR' | 'cardAlarm' | 'cardPower'; //| 'cardBurnRec' - export type PageType = PageChart | PageEntities | PageGrid | PageGrid2 | PageGrid3 | PageThermo | PageMedia | PageUnlock | PageQR | PageAlarm | PagePower; + export type PageType = PageChart | PageEntities | PageSchedule | PageGrid | PageGrid2 | PageGrid3 | PageThermo | PageMedia | PageUnlock | PageQR | PageAlarm | PagePower; export type PageEntities = { type: 'cardEntities'; items: [PageItem?, PageItem?, PageItem?, PageItem?, PageItem?]; } & PageBaseType; + export type PageSchedule = { + type: 'cardSchedule'; + items: [PageItem?, PageItem?, PageItem?, PageItem?, PageItem?, PageItem?]; + } & PageBaseType; + export type PageGrid = { type: 'cardGrid'; items: [PageItem?, PageItem?, PageItem?, PageItem?, PageItem?, PageItem?]; @@ -13361,7 +13308,7 @@ namespace NSPanel { export type ConfigButtonFunction = { mode: 'page' | 'toggle' | 'set' | null; - page: PageThermo | PageMedia | PageAlarm | PageQR | PageEntities | PageGrid | PageGrid2 | PagePower | PageChart | PageUnlock | null; + page: PageThermo | PageMedia | PageAlarm | PageQR | PageEntities | PageSchedule | PageGrid | PageGrid2 | PageGrid3 | PagePower | PageChart | PageUnlock | null; entity: string | null; setValue: string | number | boolean | null; setOn?: {dp: string; val: iobJS.StateValue};