Merge pull request #1086 from tt-tom17/main

v4.3.3.20 - Update NSPanel.ts
This commit is contained in:
Armilar
2023-12-08 22:27:04 +01:00
committed by GitHub

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
TypeScript v4.3.3.19 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @Sternmiere / @Britzelpuf / @ravenS0ne TypeScript v4.3.3.20 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.2.0 - abgestimmt auf TFT 53 / v4.3.3 / BerryDriver 9 / Tasmota 13.2.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
@@ -75,6 +75,7 @@ ReleaseNotes:
- 05.12.2023 - v4.3.3.18 Add (ELAPSED/DURATION) to v2Adapter alexa2 - 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') - 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 - 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
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
@@ -758,7 +759,6 @@ export const config = <Config> {
// Seiteneinteilung / Page division // Seiteneinteilung / Page division
// Hauptseiten / Mainpages // Hauptseiten / Mainpages
pages: [ pages: [
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)
], ],
@@ -948,7 +948,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.19'; const scriptVersion: string = 'v4.3.3.20';
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;
@@ -3786,9 +3786,27 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
RegisterEntityWatcher(pageItem.id + '.STATE'); RegisterEntityWatcher(pageItem.id + '.STATE');
} }
if (Debug) log('CreateEntity Icon role level.timeer ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + timerText, 'info'); if (Debug) log('CreateEntity Icon role level.timer ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + timerText, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + timerText; return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + timerText;
case 'value.alarmtime':
type = 'timer';
iconId = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : Icons.GetIcon('timer-outline');
let alarmtimerText = pageItem.buttonText !== undefined ? pageItem.buttonText : 'PRESS';
if (existsState(pageItem.id + '.STATE')) {
val = getState(pageItem.id + '.STATE').val;
iconColor = (val == 'paused') ? rgb_dec565(colorScale10) : rgb_dec565(colorScale0);
}
if (existsState(pageItem.id + '.ACTUAL')) {
let timer_actual = getState(pageItem.id + '.ACTUAL').val
name = ('0' + String(Math.floor(timer_actual / 60))).slice(-2) + ':' + ('0' + String(timer_actual % 60)).slice(-2);
}
if (Debug) log('CreateEntity Icon role value.alarmtime ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + alarmtimerText + ' ' + val, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + alarmtimerText;
case 'level.mode.fan': case 'level.mode.fan':
type = 'fan'; type = 'fan';
@@ -7435,22 +7453,36 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
label2 = findLocale('timer', 'cancel'); label2 = findLocale('timer', 'cancel');
label3 = findLocale('timer', 'finish'); label3 = findLocale('timer', 'finish');
} }
} else if (o.common.role == 'value.alarmtime') {
if (getState(id + '.STATE').val == 'paused') {
min_remaining = Math.floor(timer_actual / 60);
sec_remaining = timer_actual % 60;
editable = 1;
action2 = 'start';
label2 = findLocale('timer', 'on');
} else {
min_remaining = Math.floor(timer_actual / 60);
sec_remaining = timer_actual % 60;
editable = 0;
action2 = 'pause';
label2 = findLocale('timer', 'off');
}
} }
out_msgs.push({ out_msgs.push({
payload: 'entityUpdateDetail' + '~' //entityUpdateDetail payload: 'entityUpdateDetail' + '~' //entityUpdateDetail
+ id + '~~' //{entity_id} + id + '~~' //{entity_id}
+ rgb_dec565(White) + '~' //{icon_color}~ + rgb_dec565(White) + '~' //{icon_color}~
+ id + '~' + id + '~'
+ min_remaining + '~' + min_remaining + '~'
+ sec_remaining + '~' + sec_remaining + '~'
+ editable + '~' + editable + '~'
+ action1 + '~' + action1 + '~'
+ action2 + '~' + action2 + '~'
+ action3 + '~' + action3 + '~'
+ label1 + '~' + label1 + '~'
+ label2 + '~' + label2 + '~'
+ label3 + label3
}); });
} }
} }