Merge pull request #1100 from tt-tom17/main

v4.3.3.25 - Update NSPanel.ts
This commit is contained in:
Armilar
2023-12-22 13:57:08 +01:00
committed by GitHub
2 changed files with 41 additions and 8 deletions

View File

@@ -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 - 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 @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 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 - 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) - 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 - 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: Todo:
- XX.XX.XXXX - v5.0.0 Change the bottomScreensaverEntity (rolling) if more than 6 entries are defined - 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 //-- https://github.com/joBr99/nspanel-lovelace-ui/wiki/NSPanel-Page-%E2%80%90-Typen_How-2_Beispiele
let WlanDaten = <PageQR>
{
'type': 'cardQR',
'heading': 'Gäste WLAN',
'useColor': true,
'items': [<PageItem>{ id: 'alias.0.NSPanel.GuestWifi', hidePassword: true, autoCreateALias: true }]
};
//-- ENDE für eigene Seiten -- z.T. selbstdefinierte Aliase erforderlich ------------------------- //-- ENDE für eigene Seiten -- z.T. selbstdefinierte Aliase erforderlich -------------------------
//-- END for your own pages -- some self-defined aliases required ------------------------ //-- END for your own pages -- some self-defined aliases required ------------------------
@@ -767,6 +776,7 @@ export const config = <Config> {
// Seiteneinteilung / Page division // Seiteneinteilung / Page division
// Hauptseiten / Mainpages // Hauptseiten / Mainpages
pages: [ pages: [
WlanDaten,
NSPanel_Service, //Auto-Alias Service Page NSPanel_Service, //Auto-Alias Service Page
//Unlock_Service //Auto-Alias Service Page (Service Pages used with cardUnlock) //Unlock_Service //Auto-Alias Service Page (Service Pages used with cardUnlock)
], ],
@@ -956,7 +966,7 @@ export const config = <Config> {
// _________________________________ DE: Ab hier keine Konfiguration mehr _____________________________________ // _________________________________ DE: Ab hier keine Konfiguration mehr _____________________________________
// _________________________________ EN: No more configuration from here _____________________________________ // _________________________________ 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 tft_version: string = 'v4.3.3';
const desired_display_firmware_version = 53; const desired_display_firmware_version = 53;
const berry_driver_version = 9; const berry_driver_version = 9;
@@ -5572,9 +5582,11 @@ async function createAutoQRAlias(id:string, dpPath:string) {
if (autoCreateAlias) { if (autoCreateAlias) {
if (isSetOptionActive) { if (isSetOptionActive) {
if (existsState(dpPath + 'Daten') == false) { 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;', <iobJS.StateCommon>{ type: 'string' });
setObject(id, { _id: id, type: 'channel', common: { role: 'info', name: 'QR Page' }, native: {} }); await createStateAsync(dpPath + 'Switch', false, <iobJS.StateCommon>{ type: 'boolean' });
setObject(id, { _id: id, type: 'channel', common: { role: 'switch.mode.wlan', name: 'QR Page' }, native: {} });
await createAliasAsync(id + '.ACTUAL', dpPath + 'Daten', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' }); await createAliasAsync(id + '.ACTUAL', dpPath + 'Daten', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(id + '.SWITCH', dpPath + 'Switch', true, <iobJS.StateCommon>{ type: 'boolean', role: 'state', name: 'SWITCH' });
log('Adjust data for the QR page under ' + dpPath + 'data. Follow the instructions in the wiki.', 'warn'); log('Adjust data for the QR page under ' + dpPath + 'data. Follow the instructions in the wiki.', 'warn');
} }
} }
@@ -5630,16 +5642,21 @@ function GenerateQRPage(page: PageQR): Payload[] {
let type1 = 'text'; let type1 = 'text';
let internalName1 = findLocale('qr', 'ssid'); let internalName1 = findLocale('qr', 'ssid');
let iconId1 = Icons.GetIcon('wifi'); let iconId1 = Icons.GetIcon('wifi');
let iconColor1 = 65535;
let displayName1 = findLocale('qr', 'ssid'); let displayName1 = findLocale('qr', 'ssid');
let type2 = 'text'; let type2 = 'text';
let internalName2 = findLocale('qr', 'password'); let internalName2 = findLocale('qr', 'password');
let iconColor2 = 65535;
let iconId2 = Icons.GetIcon('key'); let iconId2 = Icons.GetIcon('key');
let displayName2 = findLocale('qr', 'password'); let displayName2 = findLocale('qr', 'password');
if (hiddenPWD) { if (hiddenPWD) {
type2 = 'disable'; iconColor1 = getState(page.items[0].id + '.SWITCH').val ? rgb_dec565(colorScale0) : rgb_dec565(colorScale10);
type2 = 'switch';
internalName2 = id
iconId2 = ''; iconId2 = '';
displayName2 = ''; 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;
} }
out_msgs.push({ out_msgs.push({
@@ -5650,13 +5667,13 @@ function GenerateQRPage(page: PageQR): Payload[] {
type1 + '~' + //type type1 + '~' + //type
internalName1 + '~' + //internalName internalName1 + '~' + //internalName
iconId1 + '~' + //iconId iconId1 + '~' + //iconId
65535 + '~' + //iconColor iconColor1 + '~' + //iconColor
displayName1 + '~' + //displayName displayName1 + '~' + //displayName
optionalValue1 + '~' + //optionalValue optionalValue1 + '~' + //optionalValue
type2 + '~' + //type type2 + '~' + //type
internalName2 + '~' + //internalName internalName2 + '~' + //internalName
iconId2 + '~' + //iconId iconId2 + '~' + //iconId
65535 + '~' + //iconColor iconColor2 + '~' + //iconColor
displayName2 + '~' + //displayName displayName2 + '~' + //displayName
optionalValue2 optionalValue2
}); });
@@ -6072,6 +6089,9 @@ function HandleButtonEvent(words: any): void {
if (words[4] == '1') if (words[4] == '1')
action = true; action = true;
let o = getObject(id); let o = getObject(id);
if (Debug) {
log('HandleButtonEvent -> OnOff: ' + words[4] + ' - ' + id + ' - Role - ' + o.common.role, 'info')
}
switch (o.common.role) { switch (o.common.role) {
case 'level.mode.fan': case 'level.mode.fan':
case 'socket': case 'socket':
@@ -6094,6 +6114,11 @@ function HandleButtonEvent(words: any): void {
case 'rgbSingle': case 'rgbSingle':
case 'hue': case 'hue':
setIfExists(id + '.ON_ACTUAL', action); setIfExists(id + '.ON_ACTUAL', action);
break;
case 'switch.mode.wlan':
setIfExists(id + '.SWITCH', action);
GeneratePage(activePage);
break;
} }
} }
break; break;

View File

@@ -2497,6 +2497,14 @@
"vi-VN":"Mật khẩu", "vi-VN":"Mật khẩu",
"zh-CN":"密码", "zh-CN":"密码",
"zh-TW":"密碼" "zh-TW":"密碼"
},
"Wlan enabled":{
"en-US":"Wlan enabled",
"de-DE":"Wlan aktiviert"
},
"Wlan disabled":{
"en-US":"Wlan disabled",
"de-DE":"Wlan deaktiviert"
} }
}, },
"media":{ "media":{