mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-16 01:46:59 +01:00
Compare commits
19 Commits
Armilar-pa
...
60f31595d4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60f31595d4 | ||
|
|
7194d7f613 | ||
|
|
af02a70600 | ||
|
|
77d8e0607d | ||
|
|
d6d12bc93c | ||
|
|
ead1def4bb | ||
|
|
14e944885f | ||
|
|
a075e0cba8 | ||
|
|
dd14e66f10 | ||
|
|
ce0892b986 | ||
|
|
71b84cc8d3 | ||
|
|
fd3ce243a6 | ||
|
|
aa3e90ef98 | ||
|
|
2621b22ffd | ||
|
|
6460f5f4ff | ||
|
|
e45560c27f | ||
|
|
0c6cd158dd | ||
|
|
f11de05eb3 | ||
|
|
ef47efb9aa |
6
.github/workflows/codeql-analysis.yml
vendored
6
.github/workflows/codeql-analysis.yml
vendored
@@ -47,7 +47,7 @@ jobs:
|
|||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v3
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
@@ -58,7 +58,7 @@ jobs:
|
|||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v2
|
uses: github/codeql-action/autobuild@v3
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 https://git.io/JvXDl
|
||||||
@@ -72,4 +72,4 @@ jobs:
|
|||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@v3
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*-----------------------------------------------------------------------
|
/*-----------------------------------------------------------------------
|
||||||
TypeScript v4.3.3.34 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @ticaki / @Britzelpuf / @Sternmiere / @ravenS0ne
|
TypeScript v4.3.3.36 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @ticaki / @Britzelpuf / @Sternmiere / @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
|
||||||
@@ -89,10 +89,14 @@ ReleaseNotes:
|
|||||||
- 04.01.2024 - v4.3.3.32 Add more details to types for: leftScreensaverEntity, indicatorScreensaverEntity, PageThermo, PageMedia
|
- 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
|
- 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.32 Add Body for BoseSoundtouch-Player
|
||||||
- 05.01.2024 - v4.3.3.33 Add BoseSoundtouch Functions
|
- 05.01.2024 - v4.3.3.33 Add BoseSoundtouch Functions
|
||||||
- 05.01.2024 - v4.3.3.33 Screensaver Fix max Number of indicatorScreensaverEntity
|
- 05.01.2024 - v4.3.3.33 Screensaver Fix max Number of indicatorScreensaverEntity
|
||||||
- 07.01.2024 - v4.3.3.33 Fix BoseSoundtouch Proto
|
- 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.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
|
||||||
|
|
||||||
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
|
||||||
@@ -911,10 +915,11 @@ export const config: Config = {
|
|||||||
ScreensaverEntityOnColor: On,
|
ScreensaverEntityOnColor: On,
|
||||||
ScreensaverEntityOffColor: HMIOff
|
ScreensaverEntityOffColor: HMIOff
|
||||||
},
|
},
|
||||||
// ------ DE: Ende der Screensaver Einstellungen --------------------
|
// ------ DE: Ende der Screensaver Einstellungen --------------------
|
||||||
// ------ EN: End of screensaver settings ---------------------------
|
// ------ EN: End of screensaver settings ---------------------------
|
||||||
//-------DE: Anfang Einstellungen für Hardware Button, wenn Sie softwareseitig genutzt werden (Rule2) -------------
|
|
||||||
//-------EN: Start Settings for Hardware Button, if used in software (Rule2) --------------------------------------
|
//-------DE: Anfang Einstellungen für Hardware Button, wenn Sie softwareseitig genutzt werden (Rule2) -------------
|
||||||
|
//-------EN: Start Settings for Hardware Button, if used in software (Rule2) --------------------------------------
|
||||||
// DE: Konfiguration des linken Schalters des NSPanels
|
// DE: Konfiguration des linken Schalters des NSPanels
|
||||||
// EN: Configuration of the left switch of the NSPanel
|
// EN: Configuration of the left switch of the NSPanel
|
||||||
button1: {
|
button1: {
|
||||||
@@ -940,8 +945,10 @@ export const config: Config = {
|
|||||||
entity: null,
|
entity: null,
|
||||||
setValue: null
|
setValue: null
|
||||||
},
|
},
|
||||||
//--------- DE: Ende - Einstellungen für Hardware Button, wenn Sie softwareseitig genutzt werden (Rule2) -------------
|
|
||||||
//--------- EN: End - settings for hardware button if they are used in software (Rule2) ------------------------------
|
//--------- DE: Ende - Einstellungen für Hardware Button, wenn Sie softwareseitig genutzt werden (Rule2) -------------
|
||||||
|
//--------- EN: End - settings for hardware button if they are used in software (Rule2) ------------------------------
|
||||||
|
|
||||||
// DE: WICHTIG !! Parameter nicht ändern WICHTIG!!
|
// DE: WICHTIG !! Parameter nicht ändern WICHTIG!!
|
||||||
// EN: IMPORTANT !! Do not change parameters IMPORTANT!!
|
// EN: IMPORTANT !! Do not change parameters IMPORTANT!!
|
||||||
panelRecvTopic: NSPanelReceiveTopic,
|
panelRecvTopic: NSPanelReceiveTopic,
|
||||||
@@ -956,7 +963,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.34';
|
const scriptVersion: string = 'v4.3.3.36';
|
||||||
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;
|
||||||
@@ -976,6 +983,8 @@ const moment = require('moment');
|
|||||||
const parseFormat = require('moment-parseformat');
|
const parseFormat = require('moment-parseformat');
|
||||||
moment.locale(getState(NSPanel_Path + 'Config.locale').val);
|
moment.locale(getState(NSPanel_Path + 'Config.locale').val);
|
||||||
|
|
||||||
|
const scheduleList:{[key:string]: any} = {};
|
||||||
|
|
||||||
const globalTextColor: any = White;
|
const globalTextColor: any = White;
|
||||||
const Sliders2: number = 0;
|
const Sliders2: number = 0;
|
||||||
let checkBlindActive: boolean = false;
|
let checkBlindActive: boolean = false;
|
||||||
@@ -1014,13 +1023,13 @@ let scheduleInitDimModeDay: any;
|
|||||||
let scheduleInitDimModeNight: any;
|
let scheduleInitDimModeNight: any;
|
||||||
|
|
||||||
onStop (function scriptStop () {
|
onStop (function scriptStop () {
|
||||||
if (scheduleSendTime!=null) clearSchedule(scheduleSendTime);
|
if (scheduleSendTime!=null) _clearSchedule(scheduleSendTime);
|
||||||
if (scheduleSendDate!=null) clearSchedule(scheduleSendDate);
|
if (scheduleSendDate!=null) _clearSchedule(scheduleSendDate);
|
||||||
if (scheduleSwichScreensaver!=null) clearSchedule(scheduleSwichScreensaver);
|
if (scheduleSwichScreensaver!=null) _clearSchedule(scheduleSwichScreensaver);
|
||||||
if (scheduleStartup!=null) clearSchedule(scheduleStartup);
|
if (scheduleStartup!=null) _clearSchedule(scheduleStartup);
|
||||||
if (scheduleCheckUpdates!=null) clearSchedule(scheduleCheckUpdates);
|
if (scheduleCheckUpdates!=null) _clearSchedule(scheduleCheckUpdates);
|
||||||
if (scheduleInitDimModeDay!=null) clearSchedule(scheduleInitDimModeDay);
|
if (scheduleInitDimModeDay!=null) _clearSchedule(scheduleInitDimModeDay);
|
||||||
if (scheduleInitDimModeNight!=null) clearSchedule(scheduleInitDimModeNight);
|
if (scheduleInitDimModeNight!=null) _clearSchedule(scheduleInitDimModeNight);
|
||||||
UnsubscribeWatcher();
|
UnsubscribeWatcher();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
@@ -1387,8 +1396,27 @@ Init_ActivePageData();
|
|||||||
//switch BackgroundColors for Screensaver Indicators
|
//switch BackgroundColors for Screensaver Indicators
|
||||||
async function Init_Screensaver_Backckground_Color_Switch() {
|
async function Init_Screensaver_Backckground_Color_Switch() {
|
||||||
try {
|
try {
|
||||||
if (existsState(NSPanel_Path + 'ScreensaverInfo.bgColorIndicator') == false ) {
|
const objDef: iobJS.StateObject = {
|
||||||
await createStateAsync(NSPanel_Path + 'ScreensaverInfo.bgColorIndicator', 0, true, { type: 'number' });
|
_id: '',
|
||||||
|
type: "state",
|
||||||
|
common: {
|
||||||
|
type: "number",
|
||||||
|
name: "Color Indicator",
|
||||||
|
role: "level",
|
||||||
|
states: {0:'black', 1:'red', 2:'green', 3:'attention', 4: 'pink', 5: 'dark red'},
|
||||||
|
read: true,
|
||||||
|
write: true
|
||||||
|
},
|
||||||
|
"native": {},
|
||||||
|
};
|
||||||
|
await extendObjectAsync(NSPanel_Path + 'ScreensaverInfo.bgColorIndicator', objDef)
|
||||||
|
if (await existsStateAsync(NSPanel_Path + 'ScreensaverInfo.bgColorIndicator')) {
|
||||||
|
const obj = await getStateAsync(NSPanel_Path + 'ScreensaverInfo.bgColorIndicator');
|
||||||
|
if (obj && obj.val !== null && obj.val !== undefined) {
|
||||||
|
bgColorScrSaver = obj.val;
|
||||||
|
} else {
|
||||||
|
setStateAsync(NSPanel_Path + 'ScreensaverInfo.bgColorIndicator', bgColorScrSaver)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
log('error at function Init_Screensaver_Backckground_Color_Switch: ' + err.message, 'warn');
|
log('error at function Init_Screensaver_Backckground_Color_Switch: ' + err.message, 'warn');
|
||||||
@@ -1471,6 +1499,19 @@ async function InitActiveBrightness() {
|
|||||||
}
|
}
|
||||||
InitActiveBrightness();
|
InitActiveBrightness();
|
||||||
|
|
||||||
|
on({id: [NSPanel_Path + 'ScreensaverInfo.activeBrightness'], change: 'ne'}, async function (obj) {
|
||||||
|
try {
|
||||||
|
let active = getState(NSPanel_Path + 'ScreensaverInfo.activeDimmodeBrightness').val;
|
||||||
|
if (obj.state.val >= 0 || obj.state.val <= 100) {
|
||||||
|
log('action at trigger activeBrightness: ' + obj.state.val + ' - activeDimmodeBrightness: ' + active, 'info');
|
||||||
|
SendToPanel({ payload: 'dimmode~' + active + '~' + obj.state.val + '~' + rgb_dec565(config.defaultBackgroundColor) + '~' + rgb_dec565(globalTextColor) + '~' + Sliders2 });
|
||||||
|
InitDimmode();
|
||||||
|
}
|
||||||
|
} catch (err:any) {
|
||||||
|
log('error at trigger activeBrightness: ' + err.message, 'warn');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
on({id: [NSPanel_Path + 'ScreensaverInfo.activeDimmodeBrightness'], change: "ne"}, async function (obj) {
|
on({id: [NSPanel_Path + 'ScreensaverInfo.activeDimmodeBrightness'], change: "ne"}, async function (obj) {
|
||||||
try {
|
try {
|
||||||
let active = getState(NSPanel_Path + 'ScreensaverInfo.activeBrightness').val;
|
let active = getState(NSPanel_Path + 'ScreensaverInfo.activeBrightness').val;
|
||||||
@@ -1704,8 +1745,19 @@ on({id: [String(NSPanel_Path) + 'Config.Dateformat.Switch.weekday',
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Set Relays from Tasmota
|
||||||
|
const NSPanelStatTopic = NSPanelSendTopic.replace('.cmnd.','.stat.').replace(/\.CustomSend$/g,'.');
|
||||||
|
on({id: [String(NSPanelStatTopic) + 'POWER1',String(NSPanelStatTopic) + 'POWER2'], change: "ne"}, (obj) => {
|
||||||
|
if (!obj || !obj.id) return
|
||||||
|
const n = obj.id.substring(obj.id.length-1);
|
||||||
|
if ( n === '1' || n === '2') {
|
||||||
|
if (getState(NSPanel_Path + 'Relay.' + n).val != obj.state.val) {
|
||||||
|
setState(NSPanel_Path + 'Relay.' + n, obj.state.val == 'ON' ? true : false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
//Control Relays from DP's
|
//Control Relays from DP's
|
||||||
on({id: [String(NSPanel_Path) + 'Relay.1',String(NSPanel_Path) + 'Relay.2'], change: "ne"}, async function (obj) {
|
on({id: [String(NSPanel_Path) + 'Relay.1',String(NSPanel_Path) + 'Relay.2'], change: "ne", ack: false}, async function (obj) {
|
||||||
try {
|
try {
|
||||||
let Button = obj.id!.split('.');
|
let Button = obj.id!.split('.');
|
||||||
let urlString: string = ['http://',get_current_tasmota_ip_address(),'/cm?cmnd=Power',Button[Button.length - 1],' ',(obj.state ? obj.state.val : "")].join('');
|
let urlString: string = ['http://',get_current_tasmota_ip_address(),'/cm?cmnd=Power',Button[Button.length - 1],' ',(obj.state ? obj.state.val : "")].join('');
|
||||||
@@ -1939,11 +1991,11 @@ async function InitDimmode() {
|
|||||||
timeNight: (vTimeNight < 10) ? `0${vTimeNight}:00` : `${vTimeNight}:00`
|
timeNight: (vTimeNight < 10) ? `0${vTimeNight}:00` : `${vTimeNight}:00`
|
||||||
};
|
};
|
||||||
// timeDimMode Day
|
// timeDimMode Day
|
||||||
scheduleInitDimModeDay = schedule({ hour: getState(NSPanel_Path + 'NSPanel_Dimmode_hourDay').val, minute: 0 }, () => {
|
scheduleInitDimModeDay = adapterSchedule({ hour: getState(NSPanel_Path + 'NSPanel_Dimmode_hourDay').val, minute: 0}, 24 * 60 * 60, () => {
|
||||||
ScreensaverDimmode(timeDimMode);
|
ScreensaverDimmode(timeDimMode);
|
||||||
});
|
});
|
||||||
// timeDimMode Night
|
// timeDimMode Night
|
||||||
scheduleInitDimModeNight = schedule({ hour: getState(NSPanel_Path + 'NSPanel_Dimmode_hourNight').val, minute: 0 }, () => {
|
scheduleInitDimModeNight = adapterSchedule({ hour: getState(NSPanel_Path + 'NSPanel_Dimmode_hourNight').val, minute: 0 }, 24 * 60 * 60, () => {
|
||||||
ScreensaverDimmode(timeDimMode);
|
ScreensaverDimmode(timeDimMode);
|
||||||
});
|
});
|
||||||
if (getState(NSPanel_Path + 'ScreensaverInfo.activeDimmodeBrightness').val != null && getState(NSPanel_Path + 'ScreensaverInfo.activeDimmodeBrightness').val != -1) {
|
if (getState(NSPanel_Path + 'ScreensaverInfo.activeDimmodeBrightness').val != null && getState(NSPanel_Path + 'ScreensaverInfo.activeDimmodeBrightness').val != -1) {
|
||||||
@@ -2142,7 +2194,7 @@ let pageId = 0;
|
|||||||
let activePage: PageType | undefined = undefined;
|
let activePage: PageType | undefined = undefined;
|
||||||
|
|
||||||
//Send time to NSPanel
|
//Send time to NSPanel
|
||||||
let scheduleSendTime = schedule('* * * * *', () => {
|
let scheduleSendTime = adapterSchedule(new Date().setSeconds(0,0), 60, () => {
|
||||||
try {
|
try {
|
||||||
SendTime();
|
SendTime();
|
||||||
HandleScreensaverUpdate();
|
HandleScreensaverUpdate();
|
||||||
@@ -2152,7 +2204,7 @@ let scheduleSendTime = schedule('* * * * *', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//Switch between Screensaver Entities and WeatherForecast
|
//Switch between Screensaver Entities and WeatherForecast
|
||||||
let scheduleSwichScreensaver = schedule('*/' + getState(NSPanel_Path + 'ScreensaverInfo.entityChangeTime').val + ' * * * * *', () => {
|
let scheduleSwichScreensaver = adapterSchedule(undefined, parseInt(getState(NSPanel_Path + 'ScreensaverInfo.entityChangeTime').val), () => {
|
||||||
try {
|
try {
|
||||||
//WeatherForecast true/false Switchover delayed
|
//WeatherForecast true/false Switchover delayed
|
||||||
if (getState(NSPanel_Path + "ScreensaverInfo.popupNotifyHeading").val == '' && getState(NSPanel_Path + "ScreensaverInfo.popupNotifyText").val == '' && getState(NSPanel_Path + "ScreensaverInfo.weatherForecast").val == true && getState(NSPanel_Path + "ScreensaverInfo.weatherForecastTimer").val == true) {
|
if (getState(NSPanel_Path + "ScreensaverInfo.popupNotifyHeading").val == '' && getState(NSPanel_Path + "ScreensaverInfo.popupNotifyText").val == '' && getState(NSPanel_Path + "ScreensaverInfo.weatherForecast").val == true && getState(NSPanel_Path + "ScreensaverInfo.weatherForecastTimer").val == true) {
|
||||||
@@ -2211,17 +2263,17 @@ on({id: [config.weatherEntity + '.TEMP',
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let scheduleSendDate = schedule('0 * * * *', () => {
|
let scheduleSendDate = adapterSchedule((new Date().setMinutes(0,0)),60*60, () => {
|
||||||
SendDate();
|
SendDate();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3:30 a.m. Perform startup and receive current TFT version
|
// 3:30 a.m. Perform startup and receive current TFT version
|
||||||
let scheduleStartup = schedule({ hour: 3, minute: 30 }, async () => {
|
let scheduleStartup = adapterSchedule({ hour: 3, minute: 30 }, 24*60*60, async () => {
|
||||||
setIfExists(config.panelSendTopic, 'pageType~pageStartup');
|
setIfExists(config.panelSendTopic, 'pageType~pageStartup');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Updates currently compare every 12 hours
|
// Updates currently compare every 12 hours
|
||||||
let scheduleCheckUpdates = schedule('{"time":{"start":"00:00","end":"23:59","mode":"hours","interval":12},"period":{"days":1}}', () => {
|
let scheduleCheckUpdates = adapterSchedule(undefined,60*60*12, () => {
|
||||||
get_tasmota_status0();
|
get_tasmota_status0();
|
||||||
get_panel_update_data();
|
get_panel_update_data();
|
||||||
check_updates();
|
check_updates();
|
||||||
@@ -3330,19 +3382,19 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
|||||||
// ioBroker
|
// ioBroker
|
||||||
if (pageItem.id && existsObject(pageItem.id) || pageItem.navigate === true) {
|
if (pageItem.id && existsObject(pageItem.id) || pageItem.navigate === true) {
|
||||||
|
|
||||||
let iconColor = rgb_dec565(config.defaultColor);
|
let iconColor:number = rgb_dec565(config.defaultColor);
|
||||||
let optVal = '0';
|
let optVal:string = '0';
|
||||||
let val: any = null;
|
let val: any = null;
|
||||||
|
|
||||||
let o:any
|
let o:any = undefined;
|
||||||
if (pageItem.id != null && existsObject(pageItem.id)) {
|
if (pageItem.id != null && existsObject(pageItem.id)) {
|
||||||
o = getObject(pageItem.id);
|
o = getObject(pageItem.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback if no name is given
|
// Fallback if no name is given
|
||||||
name = pageItem.name !== undefined ? pageItem.name : o.common.name.de == undefined ? o.common.name : o.common.name.de;
|
name = pageItem.name !== undefined ? pageItem.name : o.common.name.de == undefined ? o.common.name : o.common.name.de;
|
||||||
let prefix = pageItem.prefixName !== undefined ? pageItem.prefixName : '';
|
const prefix = pageItem.prefixName !== undefined ? pageItem.prefixName : '';
|
||||||
let suffix = pageItem.suffixName !== undefined ? pageItem.suffixName : '';
|
const suffix = pageItem.suffixName !== undefined ? pageItem.suffixName : '';
|
||||||
|
|
||||||
// If name is used with changing values
|
// If name is used with changing values
|
||||||
if ((name || '').indexOf('getState(') != -1) {
|
if ((name || '').indexOf('getState(') != -1) {
|
||||||
@@ -3350,6 +3402,10 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
|||||||
name = getState(dpName).val;
|
name = getState(dpName).val;
|
||||||
RegisterEntityWatcher(dpName);
|
RegisterEntityWatcher(dpName);
|
||||||
}
|
}
|
||||||
|
else if ((name || '').split('.').length > 3 && existsState(name)) {
|
||||||
|
name = getState(name).val;
|
||||||
|
RegisterEntityWatcher(name);
|
||||||
|
}
|
||||||
name = prefix + name + suffix;
|
name = prefix + name + suffix;
|
||||||
|
|
||||||
if (existsState(pageItem.id + '.GET')) {
|
if (existsState(pageItem.id + '.GET')) {
|
||||||
@@ -5074,6 +5130,9 @@ function GenerateMediaPage(page: NSPanel.PageMedia): NSPanel.Payload[] {
|
|||||||
vElapsed = vElapsed.slice(1);
|
vElapsed = vElapsed.slice(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (vElapsed == 0) {
|
||||||
|
vElapsed = '0:00';
|
||||||
|
}
|
||||||
let vDuration = Duration;
|
let vDuration = Duration;
|
||||||
if (vDuration.length == 5) {
|
if (vDuration.length == 5) {
|
||||||
if(parseInt(vDuration.slice(0,2)) < 9) {
|
if(parseInt(vDuration.slice(0,2)) < 9) {
|
||||||
@@ -6204,11 +6263,8 @@ function HandleButtonEvent(words: any): void {
|
|||||||
if (words[2] == 'bNext' || words[2] == 'bPrev' || words[2] == 'bUp' || words[2] == 'bHome' || words[2] == 'bSubNext' || words[2] == 'bSubPrev' ) {
|
if (words[2] == 'bNext' || words[2] == 'bPrev' || words[2] == 'bUp' || words[2] == 'bHome' || words[2] == 'bSubNext' || words[2] == 'bSubPrev' ) {
|
||||||
buttonAction = words[2];
|
buttonAction = words[2];
|
||||||
pageCounter = 0;
|
pageCounter = 0;
|
||||||
// Turn off the display if the alwaysOnDisplay parameter was specified
|
alwaysOn = false;
|
||||||
if (alwaysOn == true) {
|
SendToPanel({ payload: 'timeout~' + getState(NSPanel_Path + 'Config.Screensaver.timeoutScreensaver').val });
|
||||||
alwaysOn = false;
|
|
||||||
SendToPanel({ payload: 'timeout~' + getState(NSPanel_Path + 'Config.Screensaver.timeoutScreensaver').val });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Debug) {
|
if (Debug) {
|
||||||
@@ -8594,7 +8650,6 @@ function HandleScreensaverUpdate(): void {
|
|||||||
|
|
||||||
//Alternativ Layout bekommt zusätzlichen Status
|
//Alternativ Layout bekommt zusätzlichen Status
|
||||||
if (config.bottomScreensaverEntity[4] && getState(NSPanel_Path + 'Config.Screensaver.alternativeScreensaverLayout').val) {
|
if (config.bottomScreensaverEntity[4] && getState(NSPanel_Path + 'Config.Screensaver.alternativeScreensaverLayout').val) {
|
||||||
log('alternativ');
|
|
||||||
let val = getState(config.bottomScreensaverEntity[4].ScreensaverEntity).val;
|
let val = getState(config.bottomScreensaverEntity[4].ScreensaverEntity).val;
|
||||||
if (parseFloat(val+"") == val) {
|
if (parseFloat(val+"") == val) {
|
||||||
val = parseFloat(val);
|
val = parseFloat(val);
|
||||||
@@ -9024,8 +9079,12 @@ function HandleScreensaverColors(): void {
|
|||||||
scrSvrBGCol = rgb_dec565(scbackgroundInd2);
|
scrSvrBGCol = rgb_dec565(scbackgroundInd2);
|
||||||
} else if (bgColorScrSaver == 3) {
|
} else if (bgColorScrSaver == 3) {
|
||||||
scrSvrBGCol = rgb_dec565(scbackgroundInd3);
|
scrSvrBGCol = rgb_dec565(scbackgroundInd3);
|
||||||
|
} else if (bgColorScrSaver == 4) {
|
||||||
|
scrSvrBGCol = rgb_dec565({red:255, green:16, blue:240});
|
||||||
|
} else if (bgColorScrSaver == 5) {
|
||||||
|
scrSvrBGCol = rgb_dec565({ red: 100, green: 0, blue: 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
let payloadString = 'color' + '~' +
|
let payloadString = 'color' + '~' +
|
||||||
scrSvrBGCol + '~' + //background
|
scrSvrBGCol + '~' + //background
|
||||||
rgb_dec565(sctime) + '~' + //time
|
rgb_dec565(sctime) + '~' + //time
|
||||||
@@ -9632,6 +9691,48 @@ type PageUnlock = NSPanel.PageUnlock;
|
|||||||
type PageAlarm = NSPanel.PageAlarm;
|
type PageAlarm = NSPanel.PageAlarm;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param time object { hour: number, minutes: number } | number: Time as number in ms
|
||||||
|
* @param repeatTime in seconds
|
||||||
|
* @param callback what todo
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
function adapterSchedule(time: {hour?: number, minute?: number} | undefined | number, repeatTime: number, callback: () => void): number|null {
|
||||||
|
if (typeof callback !== 'function') return null
|
||||||
|
const ref = Math.random() + 1;
|
||||||
|
scheduleList[ref] = setTimeout(_schedule, 1, time, ref, repeatTime, callback), true;
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _schedule(time: {hour?: number, minute?: number} | undefined | number, ref: number, repeatTime: number, callback, init: boolean = false) {
|
||||||
|
if (!scheduleList[ref]) return;
|
||||||
|
if (!init) callback();
|
||||||
|
let targetTime: number;
|
||||||
|
if ( time === undefined) {
|
||||||
|
targetTime = new Date().setMilliseconds(0) + repeatTime * 1000;
|
||||||
|
time = targetTime;
|
||||||
|
} else if (typeof time === 'number') {
|
||||||
|
targetTime = time + repeatTime * 1000;
|
||||||
|
time = targetTime;
|
||||||
|
} else {
|
||||||
|
time.hour = time.hour !== undefined ? time.hour : -1;
|
||||||
|
time.minute = time.minute !== undefined ? time.minute : 0;
|
||||||
|
targetTime = time.hour !== -1 ? new Date().setHours(time.hour, time.minute, 0, 0) : new Date().setMinutes(time.minute, 0, 0);
|
||||||
|
if (new Date().getTime() >= targetTime) {
|
||||||
|
targetTime += repeatTime * 1000;
|
||||||
|
targetTime = time.hour !== -1 ? new Date(targetTime).setHours(time.hour, time.minute, 0, 0) : new Date(targetTime).setMinutes(time.minute, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const timeout = targetTime - new Date().getTime();
|
||||||
|
scheduleList[ref] = setTimeout(_schedule, timeout, time, ref, repeatTime, callback);
|
||||||
|
}
|
||||||
|
function _clearSchedule(ref: number): null {
|
||||||
|
if (scheduleList[ref]) clearTimeout(scheduleList[ref]);
|
||||||
|
delete scheduleList[ref];
|
||||||
|
return null;
|
||||||
|
}
|
||||||
const ArrayPlayerTypeWithMediaDevice = ['alexa2', 'sonos', 'squeezeboxrpc'] as const
|
const ArrayPlayerTypeWithMediaDevice = ['alexa2', 'sonos', 'squeezeboxrpc'] as const
|
||||||
const ArrayPlayerTypeWithOutMediaDevice = ['spotify-premium', 'volumio', 'bosesoundtouch'] as const
|
const ArrayPlayerTypeWithOutMediaDevice = ['spotify-premium', 'volumio', 'bosesoundtouch'] as const
|
||||||
|
|
||||||
@@ -9844,7 +9945,8 @@ namespace NSPanel {
|
|||||||
setThermoAlias?: string[],
|
setThermoAlias?: string[],
|
||||||
setThermoDestTemp2?: string,
|
setThermoDestTemp2?: string,
|
||||||
} & PageBaseItem
|
} & PageBaseItem
|
||||||
|
// mean string start with getState(' and end with ').val
|
||||||
|
type getStateID = string;
|
||||||
export type PageBaseItem = {
|
export type PageBaseItem = {
|
||||||
id?: string | null,
|
id?: string | null,
|
||||||
icon?: string,
|
icon?: string,
|
||||||
@@ -9866,7 +9968,7 @@ namespace NSPanel {
|
|||||||
stepValue?: number,
|
stepValue?: number,
|
||||||
prefixName?: string,
|
prefixName?: string,
|
||||||
suffixName?: string,
|
suffixName?: string,
|
||||||
name?: string,
|
name?: string | getStateID,
|
||||||
secondRow?: string,
|
secondRow?: string,
|
||||||
buttonText?: string,
|
buttonText?: string,
|
||||||
unit?: string,
|
unit?: string,
|
||||||
|
|||||||
Reference in New Issue
Block a user