From f27eb078271165ccfb3b999e2c2898cf6d89c5ba Mon Sep 17 00:00:00 2001 From: Thomas <101348966+tt-tom17@users.noreply.github.com> Date: Thu, 21 Dec 2023 12:25:58 +0100 Subject: [PATCH 1/3] v4.3.3.25 - Update NSPanel.ts Add switch of cardQR by hidePassword: true --- ioBroker/NsPanelTs.ts | 34 +++++++++++++++++++++----- ioBroker/ioBroker_NSPanel_locales.json | 4 +++ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/ioBroker/NsPanelTs.ts b/ioBroker/NsPanelTs.ts index f5c4e983..211f8c6f 100644 --- a/ioBroker/NsPanelTs.ts +++ b/ioBroker/NsPanelTs.ts @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------- -TypeScript v4.3.3.24 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @Sternmiere / @Britzelpuf / @ravenS0ne +TypeScript v4.3.3.25 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @Sternmiere / @Britzelpuf / @ravenS0ne - abgestimmt auf TFT 53 / v4.3.3 / BerryDriver 9 / Tasmota 13.3.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 @@ -81,6 +81,7 @@ ReleaseNotes: - 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 Todo: - XX.XX.XXXX - v5.0.0 Change the bottomScreensaverEntity (rolling) if more than 6 entries are defined @@ -356,6 +357,14 @@ let Debug: boolean = false; //-- https://github.com/joBr99/nspanel-lovelace-ui/wiki/NSPanel-Page-%E2%80%90-Typen_How-2_Beispiele +let WlanDaten = + { + 'type': 'cardQR', + 'heading': 'Gäste WLAN', + 'useColor': true, + 'items': [{ id: 'alias.0.NSPanel.GuestWifi', hidePassword: true, autoCreateALias: true }] + }; + //-- ENDE für eigene Seiten -- z.T. selbstdefinierte Aliase erforderlich ------------------------- //-- END for your own pages -- some self-defined aliases required ------------------------ @@ -767,6 +776,7 @@ export const config = { // Seiteneinteilung / Page division // Hauptseiten / Mainpages pages: [ + WlanDaten, NSPanel_Service, //Auto-Alias Service Page //Unlock_Service //Auto-Alias Service Page (Service Pages used with cardUnlock) ], @@ -956,7 +966,7 @@ export const config = { // _________________________________ DE: Ab hier keine Konfiguration mehr _____________________________________ // _________________________________ EN: No more configuration from here _____________________________________ -const scriptVersion: string = 'v4.3.3.24'; +const scriptVersion: string = 'v4.3.3.25'; const tft_version: string = 'v4.3.3'; const desired_display_firmware_version = 53; const berry_driver_version = 9; @@ -5572,9 +5582,11 @@ async function createAutoQRAlias(id:string, dpPath:string) { if (autoCreateAlias) { if (isSetOptionActive) { if (existsState(dpPath + 'Daten') == false) { - await createStateAsync(dpPath + 'Daten', 'WIFI:T:undefined;S:undefined;P:undefined;H:undefined;', { type: 'string' }); + await createStateAsync(dpPath + 'Daten', 'WIFI:T:undefined;S:undefined;P:undefined;H:undefined;', { type: 'string' }); + await createStateAsync(dpPath + 'Switch', false, { type: 'boolean' }); setObject(id, { _id: id, type: 'channel', common: { role: 'info', name: 'QR Page' }, native: {} }); await createAliasAsync(id + '.ACTUAL', dpPath + 'Daten', true, { type: 'string', role: 'state', name: 'ACTUAL' }); + await createAliasAsync(id + '.SWITCH', dpPath + 'Switch', true, { type: 'boolean', role: 'state', name: 'SWITCH' }); log('Adjust data for the QR page under ' + dpPath + 'data. Follow the instructions in the wiki.', 'warn'); } } @@ -5630,6 +5642,7 @@ function GenerateQRPage(page: PageQR): Payload[] { let type1 = 'text'; let internalName1 = findLocale('qr', 'ssid'); let iconId1 = Icons.GetIcon('wifi'); + let iconColor1 = getState(page.items[0].id + '.SWITCH').val ? rgb_dec565(colorScale0) : rgb_dec565(colorScale10); let displayName1 = findLocale('qr', 'ssid'); let type2 = 'text'; let internalName2 = findLocale('qr', 'password'); @@ -5637,9 +5650,11 @@ function GenerateQRPage(page: PageQR): Payload[] { let displayName2 = findLocale('qr', 'password'); if (hiddenPWD) { - type2 = 'disable'; + type2 = 'switch'; + internalName2 = id iconId2 = ''; - displayName2 = ''; + displayName2 = findLocale('qr', 'Wlan enabled'); + optionalValue2 = getState(page.items[0].id + '.SWITCH').val ? 1 : 0; } out_msgs.push({ @@ -5650,7 +5665,7 @@ function GenerateQRPage(page: PageQR): Payload[] { type1 + '~' + //type internalName1 + '~' + //internalName iconId1 + '~' + //iconId - 65535 + '~' + //iconColor + iconColor1 + '~' + //iconColor displayName1 + '~' + //displayName optionalValue1 + '~' + //optionalValue type2 + '~' + //type @@ -6072,6 +6087,9 @@ function HandleButtonEvent(words: any): void { if (words[4] == '1') action = true; let o = getObject(id); + if (Debug) { + log('HandleButtonEvent -> OnOff: ' + words[4] + ' - ' + id + ' - Role - ' + o.common.role, 'info') + } switch (o.common.role) { case 'level.mode.fan': case 'socket': @@ -6094,6 +6112,10 @@ function HandleButtonEvent(words: any): void { case 'rgbSingle': case 'hue': setIfExists(id + '.ON_ACTUAL', action); + break; + case 'switch.mode.wlan': + setIfExists(id + '.SWITCH', action); + break; } } break; diff --git a/ioBroker/ioBroker_NSPanel_locales.json b/ioBroker/ioBroker_NSPanel_locales.json index ed25192e..78d015af 100644 --- a/ioBroker/ioBroker_NSPanel_locales.json +++ b/ioBroker/ioBroker_NSPanel_locales.json @@ -2497,6 +2497,10 @@ "vi-VN":"Mật khẩu", "zh-CN":"密码", "zh-TW":"密碼" + }, + "Wlan enabled":{ + "en-US":"Wlan enabled", + "de-DE":"Wlan aktiviert" } }, "media":{ From 774c9205912cabeae9ae656d8d08be7d1af6a5c4 Mon Sep 17 00:00:00 2001 From: Thomas <101348966+tt-tom17@users.noreply.github.com> Date: Fri, 22 Dec 2023 13:25:56 +0100 Subject: [PATCH 2/3] v4.3.3.25 - Update NSPanel.ts Add switch of cardQR by hidePassword: true --- ioBroker/NsPanelTs.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ioBroker/NsPanelTs.ts b/ioBroker/NsPanelTs.ts index 211f8c6f..709a996c 100644 --- a/ioBroker/NsPanelTs.ts +++ b/ioBroker/NsPanelTs.ts @@ -5584,7 +5584,7 @@ async function createAutoQRAlias(id:string, dpPath:string) { if (existsState(dpPath + 'Daten') == false) { await createStateAsync(dpPath + 'Daten', 'WIFI:T:undefined;S:undefined;P:undefined;H:undefined;', { type: 'string' }); await createStateAsync(dpPath + 'Switch', false, { type: 'boolean' }); - setObject(id, { _id: id, type: 'channel', common: { role: 'info', name: 'QR Page' }, native: {} }); + setObject(id, { _id: id, type: 'channel', common: { role: 'switch.mode.wlan', name: 'QR Page' }, native: {} }); await createAliasAsync(id + '.ACTUAL', dpPath + 'Daten', true, { type: 'string', role: 'state', name: 'ACTUAL' }); await createAliasAsync(id + '.SWITCH', dpPath + 'Switch', true, { type: 'boolean', role: 'state', name: 'SWITCH' }); log('Adjust data for the QR page under ' + dpPath + 'data. Follow the instructions in the wiki.', 'warn'); @@ -5642,18 +5642,20 @@ function GenerateQRPage(page: PageQR): Payload[] { let type1 = 'text'; let internalName1 = findLocale('qr', 'ssid'); let iconId1 = Icons.GetIcon('wifi'); - let iconColor1 = getState(page.items[0].id + '.SWITCH').val ? rgb_dec565(colorScale0) : rgb_dec565(colorScale10); + let iconColor1 = 65535; let displayName1 = findLocale('qr', 'ssid'); let type2 = 'text'; let internalName2 = findLocale('qr', 'password'); + let iconColor2 = 65535; let iconId2 = Icons.GetIcon('key'); let displayName2 = findLocale('qr', 'password'); if (hiddenPWD) { + iconColor1 = getState(page.items[0].id + '.SWITCH').val ? rgb_dec565(colorScale0) : rgb_dec565(colorScale10); type2 = 'switch'; internalName2 = id iconId2 = ''; - displayName2 = findLocale('qr', 'Wlan enabled'); + displayName2 = getState(page.items[0].id + '.SWITCH').val ? findLocale('qr', 'Wlan enabled') : findLocale('qr', 'Wlan disabled'); optionalValue2 = getState(page.items[0].id + '.SWITCH').val ? 1 : 0; } @@ -5671,7 +5673,7 @@ function GenerateQRPage(page: PageQR): Payload[] { type2 + '~' + //type internalName2 + '~' + //internalName iconId2 + '~' + //iconId - 65535 + '~' + //iconColor + iconColor2 + '~' + //iconColor displayName2 + '~' + //displayName optionalValue2 }); @@ -6115,6 +6117,7 @@ function HandleButtonEvent(words: any): void { break; case 'switch.mode.wlan': setIfExists(id + '.SWITCH', action); + GeneratePage(activePage); break; } } From 46ffff7eea162f6e9b8ee622578a4dfa27616da8 Mon Sep 17 00:00:00 2001 From: Thomas <101348966+tt-tom17@users.noreply.github.com> Date: Fri, 22 Dec 2023 13:28:10 +0100 Subject: [PATCH 3/3] Update ioBroker_NSPanel_locales.json Tag "qr" supplemented --- ioBroker/ioBroker_NSPanel_locales.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ioBroker/ioBroker_NSPanel_locales.json b/ioBroker/ioBroker_NSPanel_locales.json index 78d015af..329ef998 100644 --- a/ioBroker/ioBroker_NSPanel_locales.json +++ b/ioBroker/ioBroker_NSPanel_locales.json @@ -2501,6 +2501,10 @@ "Wlan enabled":{ "en-US":"Wlan enabled", "de-DE":"Wlan aktiviert" + }, + "Wlan disabled":{ + "en-US":"Wlan disabled", + "de-DE":"Wlan deaktiviert" } }, "media":{