v4.2.0.1 - Update NsPanelTs_without_Examples.ts

* v4.2.0    Upgrade TFT 52 / 4.2.0
 * v4.2.0    Add new alias state for iconcolor and buttontext for icon for subpages
* v4.2.0.1  Add iconArray to Alias "Klimaanlage" (airCondition)
This commit is contained in:
Armilar
2023-08-22 15:19:27 +02:00
committed by GitHub
parent b3b24d4b8d
commit d2695d993e

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
TypeScript v4.2.0 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @Sternmiere / @Britzelpuf / @ravenS0ne TypeScript v4.2.0.1 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @Sternmiere / @Britzelpuf / @ravenS0ne
- abgestimmt auf TFT 52 / v4.2.0 / BerryDriver 8 / Tasmota 13.1.0 - abgestimmt auf TFT 52 / v4.2.0 / BerryDriver 8 / Tasmota 13.1.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
@@ -151,7 +151,7 @@ ReleaseNotes:
- 13.08.2023 - v4.1.4.4 Add Parameter inSel_ChoiceState to InSel to show/hide Focus - 13.08.2023 - v4.1.4.4 Add Parameter inSel_ChoiceState to InSel to show/hide Focus
- 21.08.2023 - v4.2.0 Upgrade TFT 52 / 4.2.0 - 21.08.2023 - v4.2.0 Upgrade TFT 52 / 4.2.0
- 21.08.2023 - v4.2.0 Add new alias state for iconcolor and buttontext for icon for subpages - 21.08.2023 - v4.2.0 Add new alias state for iconcolor and buttontext for icon for subpages
- 22.08.2023 - v4.2.0.1 Add iconArray to Alias "Klimaanlage" (airCondition)
*********************************************************************************************************** ***********************************************************************************************************
* Für die Erstellung der Aliase durch das Skript, muss in der JavaScript Instanz "setObect" gesetzt sein! * * Für die Erstellung der Aliase durch das Skript, muss in der JavaScript Instanz "setObect" gesetzt sein! *
@@ -2847,9 +2847,9 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
iconColor = GetIconColor(pageItem, false, useColors); iconColor = GetIconColor(pageItem, false, useColors);
} else { } else {
iconColor = GetIconColor(pageItem, true, useColors); iconColor = GetIconColor(pageItem, true, useColors);
}; }
}; }
if (val === true || val === 'true') { iconId = iconId2; }; if (val === true || val === 'true') { iconId = iconId2 };
break; break;
case 'blind': case 'blind':
@@ -2871,9 +2871,9 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
iconColor = GetIconColor(pageItem, false, useColors); iconColor = GetIconColor(pageItem, false, useColors);
} else { } else {
iconColor = GetIconColor(pageItem, true, useColors); iconColor = GetIconColor(pageItem, true, useColors);
}; }
}; }
if (val === true || val === 'true') { iconId = iconId2; } if (val === true || val === 'true') { iconId = iconId2 }
break; break;
case 'info': case 'info':
@@ -2888,9 +2888,9 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
iconColor = GetIconColor(pageItem, false, useColors); iconColor = GetIconColor(pageItem, false, useColors);
} else { } else {
iconColor = GetIconColor(pageItem, true, useColors); iconColor = GetIconColor(pageItem, true, useColors);
}; }
}; }
if (val === true || val === 'true') { iconId = iconId2; } if (val === true || val === 'true') { iconId = iconId2 }
break; break;
case 'warning': case 'warning':
@@ -3487,7 +3487,7 @@ function GenerateThermoPage(page: PageThermo): Payload[] {
let id = page.items[0].id let id = page.items[0].id
let out_msgs: Array<Payload> = []; let out_msgs: Array<Payload> = [];
out_msgs.push({ payload: 'pageType~cardThermo' }); out_msgs.push({ payload: 'pageType~cardThermo' });
// ioBroker // ioBroker
if (existsObject(id)) { if (existsObject(id)) {
let o = getObject(id); let o = getObject(id);
@@ -3524,6 +3524,9 @@ function GenerateThermoPage(page: PageThermo): Payload[] {
//Attribute hinzufügen, wenn im Alias definiert //Attribute hinzufügen, wenn im Alias definiert
let i_list = Array.prototype.slice.apply($('[state.id="' + id + '.*"]')); let i_list = Array.prototype.slice.apply($('[state.id="' + id + '.*"]'));
let bt = ['~~~~', '~~~~', '~~~~', '~~~~', '~~~~', '~~~~', '~~~~', '~~~~', '~~~~']; let bt = ['~~~~', '~~~~', '~~~~', '~~~~', '~~~~', '~~~~', '~~~~', '~~~~', '~~~~'];
let tempIcon: string = '';
if ((i_list.length - 3) != 0) { if ((i_list.length - 3) != 0) {
let i = 0; let i = 0;
@@ -3677,47 +3680,78 @@ function GenerateThermoPage(page: PageThermo): Payload[] {
if(stateKeyNumber == Mode) { if(stateKeyNumber == Mode) {
statusStr = stateName.replace('_', ' '); statusStr = stateName.replace('_', ' ');
} }
switch(stateName) { switch(stateName) {
case 'AUTO': case 'AUTO':
if(stateKeyNumber == Mode) { if (page.items[0].iconArray !== undefined && page.items[0].iconArray[1] !== '') {
bt[iconIndex] = Icons.GetIcon('air-conditioner') + '~1024~1~' + 'AUTO' + '~'; tempIcon = page.items[0].iconArray[1];
} else { } else {
bt[iconIndex] = Icons.GetIcon('air-conditioner') + '~35921~0~' + 'AUTO' + '~'; tempIcon = 'air-conditioner';
}
if(stateKeyNumber == Mode) {
bt[iconIndex] = Icons.GetIcon(tempIcon) + '~1024~1~' + 'AUTO' + '~';
} else {
bt[iconIndex] = Icons.GetIcon(tempIcon) + '~35921~0~' + 'AUTO' + '~';
} }
break; break;
case 'COOL': case 'COOL':
if(stateKeyNumber == Mode) { if (page.items[0].iconArray !== undefined && page.items[0].iconArray[2] !== '') {
bt[iconIndex] = Icons.GetIcon('snowflake') + '~11487~1~' + 'COOL' + '~'; tempIcon = page.items[0].iconArray[2];
} else { } else {
bt[iconIndex] = Icons.GetIcon('snowflake') + '~35921~0~' + 'COOL' + '~'; tempIcon = 'snowflake';
}
if(stateKeyNumber == Mode) {
bt[iconIndex] = Icons.GetIcon(tempIcon) + '~11487~1~' + 'COOL' + '~';
} else {
bt[iconIndex] = Icons.GetIcon(tempIcon) + '~35921~0~' + 'COOL' + '~';
} }
break; break;
case 'HEAT': case 'HEAT':
if(stateKeyNumber == Mode) { if (page.items[0].iconArray !== undefined && page.items[0].iconArray[3] !== '') {
bt[iconIndex] = Icons.GetIcon('fire') + '~64512~1~' + 'HEAT' + '~'; tempIcon = page.items[0].iconArray[3];
} else { } else {
bt[iconIndex] = Icons.GetIcon('fire') + '~35921~0~' + 'HEAT' + '~'; tempIcon = 'fire';
}
if(stateKeyNumber == Mode) {
bt[iconIndex] = Icons.GetIcon(tempIcon) + '~64512~1~' + 'HEAT' + '~';
} else {
bt[iconIndex] = Icons.GetIcon(tempIcon) + '~35921~0~' + 'HEAT' + '~';
} }
break; break;
case 'ECO': case 'ECO':
if(stateKeyNumber == Mode) { if (page.items[0].iconArray !== undefined && page.items[0].iconArray[4] !== '') {
bt[iconIndex] = Icons.GetIcon('alpha-e-circle-outline') + '~2016~1~' + 'ECO' + '~'; tempIcon = page.items[0].iconArray[4];
} else { } else {
bt[iconIndex] = Icons.GetIcon('alpha-e-circle-outline') + '~35921~0~' + 'ECO' + '~'; tempIcon = 'alpha-e-circle-outline';
}
if(stateKeyNumber == Mode) {
bt[iconIndex] = Icons.GetIcon(tempIcon) + '~2016~1~' + 'ECO' + '~';
} else {
bt[iconIndex] = Icons.GetIcon(tempIcon) + '~35921~0~' + 'ECO' + '~';
} }
break; break;
case 'FAN_ONLY': case 'FAN_ONLY':
if(stateKeyNumber == Mode) { if (page.items[0].iconArray !== undefined && page.items[0].iconArray[5] !== '') {
bt[iconIndex] = Icons.GetIcon('fan') + '~11487~1~' + 'FAN_ONLY' + '~'; tempIcon = page.items[0].iconArray[5];
} else { } else {
bt[iconIndex] = Icons.GetIcon('fan') + '~35921~0~' + 'FAN_ONLY' + '~'; tempIcon = 'fan';
}
if(stateKeyNumber == Mode) {
bt[iconIndex] = Icons.GetIcon(tempIcon) + '~11487~1~' + 'FAN_ONLY' + '~';
} else {
bt[iconIndex] = Icons.GetIcon(tempIcon) + '~35921~0~' + 'FAN_ONLY' + '~';
} }
break; break;
case 'DRY': case 'DRY':
if(stateKeyNumber == Mode) { if (page.items[0].iconArray !== undefined && page.items[0].iconArray[6] !== '') {
bt[iconIndex] = Icons.GetIcon('water-percent') + '~60897~1~' + 'DRY' + '~'; tempIcon = page.items[0].iconArray[6];
} else { } else {
bt[iconIndex] = Icons.GetIcon('water-percent') + '~35921~0~' + 'DRY' + '~'; tempIcon = 'water-percent';
}
if(stateKeyNumber == Mode) {
bt[iconIndex] = Icons.GetIcon(tempIcon) + '~60897~1~' + 'DRY' + '~';
} else {
bt[iconIndex] = Icons.GetIcon(tempIcon) + '~35921~0~' + 'DRY' + '~';
} }
break; break;
} }
@@ -3725,32 +3759,47 @@ function GenerateThermoPage(page: PageThermo): Payload[] {
} }
if (iconIndex <= 7 && existsState(id + '.ECO') && getState(id + '.ECO').val != null) { if (iconIndex <= 7 && existsState(id + '.ECO') && getState(id + '.ECO').val != null) {
if (page.items[0].iconArray !== undefined && page.items[0].iconArray[4] !== '') {
tempIcon = page.items[0].iconArray[4];
} else {
tempIcon = 'alpha-e-circle-outline';
}
if (getState(id + '.ECO').val && getState(id + '.ECO').val == 1) { if (getState(id + '.ECO').val && getState(id + '.ECO').val == 1) {
bt[iconIndex] = Icons.GetIcon('alpha-e-circle-outline') + '~2016~1~' + 'ECO' + '~'; bt[iconIndex] = Icons.GetIcon(tempIcon) + '~2016~1~' + 'ECO' + '~';
statusStr = 'ECO'; statusStr = 'ECO';
} else { } else {
bt[iconIndex] = Icons.GetIcon('alpha-e-circle-outline') + '~35921~0~' + 'ECO' + '~'; bt[iconIndex] = Icons.GetIcon(tempIcon) + '~35921~0~' + 'ECO' + '~';
} }
iconIndex++; iconIndex++;
} }
if (iconIndex <= 7 && existsState(id + '.SWING') && getState(id + '.SWING').val != null) { if (iconIndex <= 7 && existsState(id + '.SWING') && getState(id + '.SWING').val != null) {
if (getState(id + '.POWER').val && getState(id + '.SWING').val == 1) { //0=ON oder .SWING = true if (page.items[0].iconArray !== undefined && page.items[0].iconArray[7] !== '') {
bt[7] = Icons.GetIcon('swap-vertical-bold') + '~2016~1~' + 'SWING' + '~'; tempIcon = page.items[0].iconArray[7];
} else { } else {
bt[7] = Icons.GetIcon('swap-vertical-bold') + '~35921~0~' + 'SWING' + '~'; tempIcon = 'swap-vertical-bold';
}
if (getState(id + '.POWER').val && getState(id + '.SWING').val == 1) { //0=ON oder .SWING = true
bt[7] = Icons.GetIcon(tempIcon) + '~2016~1~' + 'SWING' + '~';
} else {
bt[7] = Icons.GetIcon(tempIcon) + '~35921~0~' + 'SWING' + '~';
} }
iconIndex++; iconIndex++;
} }
// Power Icon zuletzt pruefen, damit der Mode ggf. mit OFF ueberschrieben werden kann // Power Icon zuletzt pruefen, damit der Mode ggf. mit OFF ueberschrieben werden kann
if (existsState(id + '.POWER') && getState(id + '.POWER').val != null) { if (existsState(id + '.POWER') && getState(id + '.POWER').val != null) {
if (page.items[0].iconArray !== undefined && page.items[0].iconArray[0] !== '') {
tempIcon = page.items[0].iconArray[0];
} else {
tempIcon = 'power-standby';
}
if (States[Mode] == 'OFF' || !getState(id + '.POWER').val) { if (States[Mode] == 'OFF' || !getState(id + '.POWER').val) {
bt[0] = Icons.GetIcon('power-standby') + '~35921~0~' + 'POWER' + '~'; bt[0] = Icons.GetIcon(tempIcon) + '~35921~0~' + 'POWER' + '~';
statusStr = 'OFF'; statusStr = 'OFF';
} }
else { else {
bt[0] = Icons.GetIcon('power-standby') + '~2016~1~' + 'POWER' + '~'; bt[0] = Icons.GetIcon(tempIcon) + '~2016~1~' + 'POWER' + '~';
} }
} }
} }
@@ -3783,10 +3832,10 @@ function GenerateThermoPage(page: PageThermo): Payload[] {
+ minTemp + '~' // Thermostat Min-Temperatur + minTemp + '~' // Thermostat Min-Temperatur
+ maxTemp + '~' // Thermostat Max-Temperatur + maxTemp + '~' // Thermostat Max-Temperatur
+ stepTemp + '~' // Schritte für Soll (5°C) + stepTemp + '~' // Schritte für Soll (5°C)
+ icon_res // Icons Status + icon_res // Icons Status
+ findLocale('thermostat', 'Currently') + '~' // Bezeichner vor Aktueller Raumtemperatur + findLocale('thermostat', 'Currently') + '~' // Bezeichner vor Aktueller Raumtemperatur
+ findLocale('thermostat', 'State') + '~~' // Bezeichner vor State + findLocale('thermostat', 'State') + '~~' // Bezeichner vor State
+ temperatureUnit + '~' // iconTemperature dstTempTwoTempMode + temperatureUnit + '~' // iconTemperature dstTempTwoTempMode
+ destTemp2 + '~' // dstTempTwoTempMode --> Wenn Wert, dann 2 Temp + destTemp2 + '~' // dstTempTwoTempMode --> Wenn Wert, dann 2 Temp
+ thermoPopup // PopUp + thermoPopup // PopUp
@@ -7838,8 +7887,9 @@ type PageItem = {
popupType: (string | undefined), popupType: (string | undefined),
popupOptions: (string[] | undefined), popupOptions: (string[] | undefined),
useValue: (boolean | undefined), useValue: (boolean | undefined),
monobutton: (boolean | undefined) monobutton: (boolean | undefined),
inSel_ChoiceState: (boolean | undefined) inSel_ChoiceState: (boolean | undefined),
iconArray: (string[] | undefined)
} }
type DimMode = { type DimMode = {