Compare commits

...

7 Commits

Author SHA1 Message Date
Armilar
77b7400b04 v5.1.0.2 DEV - Update TFT compatibility from 60 to 61
Updated compatibility notes for TFT version.
2025-11-16 12:41:44 +01:00
Armilar
995e7eebd2 Update script version to v5.1.0.2
Add Swiss-Weather-API Adapter by starwarsfan (many ThanX)
2025-11-16 12:36:26 +01:00
Armilar
c91ca0912a Merge pull request #1397 from starwarsfan/feature/swiss-weather-api
Add Swiss-Weather-API Adapter
2025-11-16 11:38:25 +01:00
Armilar
a6742f88c8 Merge pull request #1396 from starwarsfan/feature/fixTrailingWhitespaces
Feature/fix trailing whitespaces
2025-11-16 11:37:40 +01:00
Yves Schumann
9f146ec8b3 Add Swiss-Weather-API Adapter 2025-11-15 23:08:55 +01:00
Yves Schumann
0cccfac4a6 Fix trailing whitespaces on dev version 2025-11-15 22:56:44 +01:00
Yves Schumann
fbe5f9658e Fix trailing whitespaces 2025-11-15 22:42:34 +01:00
2 changed files with 1049 additions and 728 deletions

View File

@@ -1,6 +1,6 @@
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
TypeScript v5.1.0.1 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @ticaki / @Britzelpuf / @Sternmiere / @ravenS0ne TypeScript v5.1.0.2 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @ticaki / @Britzelpuf / @Sternmiere / @ravenS0ne
- abgestimmt auf TFT 60 / v5.1.0 / BerryDriver 10 / Tasmota 15.0.1 - abgestimmt auf TFT 61 / v5.1.0 / BerryDriver 10 / Tasmota 15.0.1
Projekt: Projekt:
https://github.com/joBr99/nspanel-lovelace-ui/tree/main/ioBroker https://github.com/joBr99/nspanel-lovelace-ui/tree/main/ioBroker
@@ -96,12 +96,13 @@ ReleaseNotes:
- 19.10.2025 - v5.0.2.1 TFT 59 / 5.0.2 - EU/US-L/US-P - Fix cardAlarm Icon; Fix Notification in Advanced Screensaver; Fix Dimensions in cardChart/cardLChart - 19.10.2025 - v5.0.2.1 TFT 59 / 5.0.2 - EU/US-L/US-P - Fix cardAlarm Icon; Fix Notification in Advanced Screensaver; Fix Dimensions in cardChart/cardLChart
- 12.11.2025 - v5.1.0 TFT 61 / 5.1.0 - Breaking Changes in popupNotify TFT - add 3. Button only for Adapter - 12.11.2025 - v5.1.0 TFT 61 / 5.1.0 - Breaking Changes in popupNotify TFT - add 3. Button only for Adapter
- 12.11.2025 - v5.1.0.1 Change Brightsky icon to icon_special - 12.11.2025 - v5.1.0.1 Change Brightsky icon to icon_special
- 15.11.2025 - v5.1.0.2 Add Swiss-Weather-API Adapter
*************************************************************************************************************** ***************************************************************************************************************
* DE: Für die Erstellung der Aliase durch das Skript, muss in der JavaScript Instanz "setObject" gesetzt sein! * * DE: Für die Erstellung der Aliase durch das Skript, muss in der JavaScript Instanz "setObject" gesetzt sein! *
* EN: In order for the script to create the aliases, “setObject” must be set in the JavaScript instance! * * EN: In order for the script to create the aliases, “setObject” must be set in the JavaScript instance! *
***************************************************************************************************************{ ***************************************************************************************************************
Wenn Rule definiert, dann können die Hardware-Tasten ebenfalls für Seitensteuerung (dann nicht mehr als Relais) genutzt werden Wenn Rule definiert, dann können die Hardware-Tasten ebenfalls für Seitensteuerung (dann nicht mehr als Relais) genutzt werden
@@ -192,9 +193,13 @@ Tasmota-Status0 - (zyklische Ausführung)
Erforderliche Adapter: Erforderliche Adapter:
Pirate-Weather oder BrightSky oder OpenWeatherMap --> Bei Nutzung der Wetterfunktionen (und zur Icon-Konvertierung) im Screensaver Bei Nutzung der Wetterfunktionen (und zur Icon-Konvertierung) im Screensaver einen der folgenden Wetter-Adapter:
!!!DasWetter deprecated - Dienst nur noch für ältere Accounts funktional - Pirate-Weather
!!!AccuWeather deprecated - Dienst schaltet Free-Account ab!!! - BrightSky
- OpenWeatherMap
- Swiss-Weather-API
- !!!DasWetter deprecated - Dienst nur noch für ältere Accounts funktional
- !!!AccuWeather deprecated - Dienst schaltet Free-Account ab!!!
Alexa2: - Bei Nutzung der dynamischen SpeakerList in der cardMedia Alexa2: - Bei Nutzung der dynamischen SpeakerList in der cardMedia
Geräte verwalten - Für Erstellung der Aliase Geräte verwalten - Für Erstellung der Aliase
MQTT-Adapter - Für Kommunikation zwischen Skript und Tasmota MQTT-Adapter - Für Kommunikation zwischen Skript und Tasmota
@@ -256,8 +261,8 @@ const NSPanel_Alarm_Path = '0_userdata.0.NSPanel.';
/***** 3. Weather adapter Config *****/ /***** 3. Weather adapter Config *****/
// DE: Mögliche Wetteradapter 'pirate-weather.0.' oder 'brightsky.0.' oder 'openweathermap.0.' oder 'daswetter.0.' (deprecated) oder 'accuweather.0.' (deprecated) // DE: Mögliche Wetteradapter 'pirate-weather.0.' oder 'brightsky.0.' oder 'openweathermap.0.' oder 'swiss-weather-api.0.' oder 'daswetter.0.' (deprecated) oder 'accuweather.0.' (deprecated)
// EN: Possible weather adapters 'pirate-weather.0.' or 'brightsky.0.' or 'openweathermap.0.' or 'daswetter.0.' (deprecated) or 'accuweather.0.' (deprecated) // EN: Possible weather adapters 'pirate-weather.0.' or 'brightsky.0.' or 'openweathermap.0.' or 'swiss-weather-api.0.' or 'daswetter.0.' (deprecated) or 'accuweather.0.' (deprecated)
const weatherAdapterInstance: string = 'pirate-weather.0.'; const weatherAdapterInstance: string = 'pirate-weather.0.';
// DE: Mögliche Werte: 'Min', 'Max' oder 'MinMax' im Screensaver // DE: Mögliche Werte: 'Min', 'Max' oder 'MinMax' im Screensaver
@@ -408,10 +413,10 @@ const defaultBackgroundColorParam: any = HMIDark;
- Servicemenü aus pages "NSPanel_Service" unter pages kommentieren ("//" hinzufügen) - Servicemenü aus pages "NSPanel_Service" unter pages kommentieren ("//" hinzufügen)
*/ */
/************************************************************************************************* /***********************************************************************************************
** Service pages with auto alias (subsequent pages are automatically created with alias) ** ** Service pages with auto alias (subsequent pages are automatically created with alias) **
** https://github.com/joBr99/nspanel-lovelace-ui/wiki/NSPanel-Service-Men%C3%BC ** ** https://github.com/joBr99/nspanel-lovelace-ui/wiki/NSPanel-Service-Men%C3%BC **
************************************************************************************************/ ***********************************************************************************************/
/* EN: English /* EN: English
If the service menu needs to be secured, a cardUnlock can be installed upstream. If the service menu needs to be secured, a cardUnlock can be installed upstream.
@@ -824,7 +829,7 @@ export const config: Config = {
NSPanel_Wifi_Info_2, //Auto-Alias Service Page NSPanel_Wifi_Info_2, //Auto-Alias Service Page
NSPanel_Sensoren, //Auto-Alias Service Page NSPanel_Sensoren, //Auto-Alias Service Page
NSPanel_Hardware, //Auto-Alias Service Page NSPanel_Hardware, //Auto-Alias Service Page
NSPanel_IoBroker, //Auot-Alias Service Page NSPanel_IoBroker, //Auto-Alias Service Page
NSPanel_Einstellungen, //Auto-Alias Service Page NSPanel_Einstellungen, //Auto-Alias Service Page
NSPanel_Screensaver, //Auto-Alias Service Page NSPanel_Screensaver, //Auto-Alias Service Page
NSPanel_ScreensaverDimmode, //Auto-Alias Service Page NSPanel_ScreensaverDimmode, //Auto-Alias Service Page
@@ -994,7 +999,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 = 'v5.1.0.1'; const scriptVersion: string = 'v5.1.0.2';
const tft_version: string = 'v5.1.0'; const tft_version: string = 'v5.1.0';
const desired_display_firmware_version = 61; const desired_display_firmware_version = 61;
const berry_driver_version = 10; const berry_driver_version = 10;
@@ -1113,6 +1118,11 @@ async function CheckConfigParameters () {
log('Weather adapter: << weatherAdapterInstance - ' + weatherAdapterInstance + ' >> is not installed. Please Check Adapter!', 'error'); log('Weather adapter: << weatherAdapterInstance - ' + weatherAdapterInstance + ' >> is not installed. Please Check Adapter!', 'error');
} }
} }
if (weatherAdapterInstance.substring(0, weatherAdapterInstance.length - 3) == 'swiss-weather-api') {
if (existsObject(weatherAdapterInstance + 'forecast.days.day0.0000.symbol_code') == false) {
log('Weather adapter: << weatherAdapterInstance - ' + weatherAdapterInstance + ' >> is not installed. Please Check Adapter!', 'error');
}
}
let weatherAdapterInstanceArray: any = weatherAdapterInstance.split('.'); let weatherAdapterInstanceArray: any = weatherAdapterInstance.split('.');
weatherAdapterInstanceNumber = weatherAdapterInstanceArray[1]; weatherAdapterInstanceNumber = weatherAdapterInstanceArray[1];
@@ -2605,6 +2615,57 @@ async function CreateWeatherAlias () {
} catch (err: any) { } catch (err: any) {
log('error at function CreateWeatherAlias brightsky.' + weatherAdapterInstanceNumber + '.: ' + err.message, 'warn'); log('error at function CreateWeatherAlias brightsky.' + weatherAdapterInstanceNumber + '.: ' + err.message, 'warn');
} }
} else if (weatherAdapterInstance == 'swiss-weather-api.' + weatherAdapterInstanceNumber + '.') {
try {
if (isSetOptionActive) {
if (!existsState(config.weatherEntity + '.ICON') && existsState('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day0.0000.symbol_code')) {
log('Weather alias for swiss-weather-api.' + weatherAdapterInstanceNumber + '. does not exist yet, will be created now', 'info');
setObject(config.weatherEntity, {
_id: config.weatherEntity,
type: 'channel',
common: {role: 'weatherCurrent', name: 'weatherCurrent'},
native: {}
});
await createAliasAsync(config.weatherEntity + '.ICON', ('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day0.0000.symbol_code'), true, {
type: 'string',
role: 'value',
name: 'ICON',
alias: {id: 'swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day0.0000.symbol_code'},
});
await createAliasAsync(config.weatherEntity + '.TEMP', 'swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.current_hour.TTT_C', true, {
type: 'number',
role: 'value.temperature',
name: 'TEMP',
alias: {
id: 'swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.current_hour.TTT_C',
read: 'Math.round(val*10)/10'
},
});
await createAliasAsync(config.weatherEntity + '.TEMP_MIN', 'swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day0.0000.TN_C', true, {
type: 'number',
role: 'value.temperature.forecast.0',
name: 'TEMP_MIN',
alias: {
id: 'swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day0.0000.TN_C',
read: 'Math.round(val)'
},
});
await createAliasAsync(config.weatherEntity + '.TEMP_MAX', 'swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day0.0000.TX_C', true, {
type: 'number',
role: 'value.temperature.max.forecast.0',
name: 'TEMP_MAX',
alias: {
id: 'swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day0.0000.TX_C',
read: 'Math.round(val)'
},
});
} else {
log('weather alias for swiss-weather-api.' + weatherAdapterInstanceNumber + '. already exists', 'info');
}
}
} catch (err: any) {
log('error at function CreateWeatherAlias swiss-weather-api.' + weatherAdapterInstanceNumber + '.: ' + err.message, 'warn');
}
} }
} }
} catch (err: any) { } catch (err: any) {
@@ -3899,6 +3960,7 @@ function get_current_tasmota_ip_address () {
log('error at function get_current_tasmota_ip_address: ' + err.message, 'warn'); log('error at function get_current_tasmota_ip_address: ' + err.message, 'warn');
} }
} }
/** /**
* Retrieves the current IP address of the Tasmota device. * Retrieves the current IP address of the Tasmota device.
* *
@@ -4377,7 +4439,6 @@ on({id: config.panelRecvTopic}, async (obj) => {
}); });
/** /**
* Updates the Berry driver version on the NSPanel. * Updates the Berry driver version on the NSPanel.
* *
@@ -5231,7 +5292,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
/** /**
* The same extension can be found below in blind. vval=0 means closed / val=100 means open. If val is in between, icon3 is used. * The same extension can be found below in blind. vval=0 means closed / val=100 means open. If val is in between, icon3 is used.
* Icons in this part can be states and strings. The specifications are based on German shutters. * Icons in this part can be states and strings. The specifications are based on German shutters.
*/ */
iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['window-shutter', 'window-shutter-open', 'window-shutter-alert']); iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['window-shutter', 'window-shutter-open', 'window-shutter-alert']);
iconColor = existsState(pageItem.id + '.COLORDEC') iconColor = existsState(pageItem.id + '.COLORDEC')
? getState(pageItem.id + '.COLORDEC').val ? getState(pageItem.id + '.COLORDEC').val
@@ -5341,7 +5402,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (role == 'temperature' || role == 'value.temperature' || role == 'thermostat') { if (role == 'temperature' || role == 'value.temperature' || role == 'thermostat') {
iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['snowflake-thermometer', 'sun-thermometer', 'thermometer']); iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['snowflake-thermometer', 'sun-thermometer', 'thermometer']);
} else if (role == 'humidity' || role == 'value.humidity') { } else if (role == 'humidity' || role == 'value.humidity') {
iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['water-off', 'water-percent-alert' , 'water-percent']); iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['water-off', 'water-percent-alert', 'water-percent']);
} }
iconColor = GetIconColor(pageItem, parseInt(optVal), useColors); iconColor = GetIconColor(pageItem, parseInt(optVal), useColors);
@@ -5448,7 +5509,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (pageItem.popupVersion !== undefined) { if (pageItem.popupVersion !== undefined) {
if (pageItem.popupVersion == 1) { if (pageItem.popupVersion == 1) {
type = 'light'; type = 'light';
} else if (pageItem.popupVersion == 2){ } else if (pageItem.popupVersion == 2) {
type = 'light2'; type = 'light2';
} }
} }
@@ -5492,7 +5553,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (pageItem.popupVersion !== undefined) { if (pageItem.popupVersion !== undefined) {
if (pageItem.popupVersion == 1) { if (pageItem.popupVersion == 1) {
type = 'light'; type = 'light';
} else if (pageItem.popupVersion == 2){ } else if (pageItem.popupVersion == 2) {
type = 'light2'; type = 'light2';
} }
} }
@@ -5532,7 +5593,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (pageItem.popupVersion !== undefined) { if (pageItem.popupVersion !== undefined) {
if (pageItem.popupVersion == 1) { if (pageItem.popupVersion == 1) {
type = 'light'; type = 'light';
} else if (pageItem.popupVersion == 2){ } else if (pageItem.popupVersion == 2) {
type = 'light2'; type = 'light2';
} }
} }
@@ -5587,7 +5648,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (pageItem.popupVersion !== undefined) { if (pageItem.popupVersion !== undefined) {
if (pageItem.popupVersion == 1) { if (pageItem.popupVersion == 1) {
type = 'light'; type = 'light';
} else if (pageItem.popupVersion == 2){ } else if (pageItem.popupVersion == 2) {
type = 'light2'; type = 'light2';
} }
} }
@@ -5614,7 +5675,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (Debug) log('CIE wurde zuletzt geändert - Lampe ist Color-Mode'); if (Debug) log('CIE wurde zuletzt geändert - Lampe ist Color-Mode');
if (getState(pageItem.id + '.CIE').val != null) { if (getState(pageItem.id + '.CIE').val != null) {
let cie: string = getState(pageItem.id + '.CIE').val; let cie: string = getState(pageItem.id + '.CIE').val;
let cieArray = (cie.substring(1, cie.length -1)).split(','); let cieArray = (cie.substring(1, cie.length - 1)).split(',');
let rgb: RGB = cie_to_rgb(parseFloat(cieArray[0]), parseFloat(cieArray[1]), 254); let rgb: RGB = cie_to_rgb(parseFloat(cieArray[0]), parseFloat(cieArray[1]), 254);
let cRGB: RGB = lightenDarkenColor(ConvertRGBtoHex(rgb.red, rgb.green, rgb.blue), (100 - brightness) * -1); let cRGB: RGB = lightenDarkenColor(ConvertRGBtoHex(rgb.red, rgb.green, rgb.blue), (100 - brightness) * -1);
iconColor = rgb_dec565(pageItem.interpolateColor !== undefined ? cRGB : config.defaultOnColor); iconColor = rgb_dec565(pageItem.interpolateColor !== undefined ? cRGB : config.defaultOnColor);
@@ -5641,7 +5702,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (pageItem.popupVersion !== undefined) { if (pageItem.popupVersion !== undefined) {
if (pageItem.popupVersion == 1) { if (pageItem.popupVersion == 1) {
type = 'light'; type = 'light';
} else if (pageItem.popupVersion == 2){ } else if (pageItem.popupVersion == 2) {
type = 'light2'; type = 'light2';
} }
} }
@@ -5697,7 +5758,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (pageItem.popupVersion !== undefined) { if (pageItem.popupVersion !== undefined) {
if (pageItem.popupVersion == 1) { if (pageItem.popupVersion == 1) {
type = 'light'; type = 'light';
} else if (pageItem.popupVersion == 2){ } else if (pageItem.popupVersion == 2) {
type = 'light2'; type = 'light2';
} }
} }
@@ -5723,7 +5784,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (pageItem.popupVersion !== undefined) { if (pageItem.popupVersion !== undefined) {
if (pageItem.popupVersion == 1) { if (pageItem.popupVersion == 1) {
type = 'shutter'; type = 'shutter';
} else if (pageItem.popupVersion == 2){ } else if (pageItem.popupVersion == 2) {
type = 'shutter2'; type = 'shutter2';
} }
} }
@@ -5864,7 +5925,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (role == 'temperature' || role == 'value.temperature' || role == 'thermostat') { if (role == 'temperature' || role == 'value.temperature' || role == 'thermostat') {
iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['snowflake-thermometer', 'sun-thermometer', 'thermometer']); iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['snowflake-thermometer', 'sun-thermometer', 'thermometer']);
} else if (role == 'humidity' || role == 'value.humidity') { } else if (role == 'humidity' || role == 'value.humidity') {
iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['water-off', 'water-percent-alert' , 'water-percent']); iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['water-off', 'water-percent-alert', 'water-percent']);
} }
iconColor = GetIconColor(pageItem, parseInt(optVal), useColors); iconColor = GetIconColor(pageItem, parseInt(optVal), useColors);
@@ -5927,7 +5988,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (!pageItem.useValue) iconId = pageItem.icon != undefined ? Icons.GetIcon(pageItem.icon) : iconId; if (!pageItem.useValue) iconId = pageItem.icon != undefined ? Icons.GetIcon(pageItem.icon) : iconId;
iconColor = pageItem.onColor != undefined ? rgb_dec565(pageItem.onColor) : iconColor; iconColor = pageItem.onColor != undefined ? rgb_dec565(pageItem.onColor) : iconColor;
} else { } else {
if(!pageItem.useValue) iconId = pageItem.icon2 != undefined ? Icons.GetIcon(pageItem.icon2) : iconId; if (!pageItem.useValue) iconId = pageItem.icon2 != undefined ? Icons.GetIcon(pageItem.icon2) : iconId;
iconColor = pageItem.offColor != undefined ? rgb_dec565(pageItem.offColor) : iconColor; iconColor = pageItem.offColor != undefined ? rgb_dec565(pageItem.offColor) : iconColor;
} }
} }
@@ -7162,6 +7223,7 @@ function subscribeMediaSubscriptionsSonosAdd (id: string): void {
} }
}); });
} }
/** /**
* Creates media aliases for a specific media device and adapter player instance. * Creates media aliases for a specific media device and adapter player instance.
* *
@@ -8018,9 +8080,9 @@ function GenerateMediaPage (page: NSPanel.PageMedia): NSPanel.Payload[] {
page.items[0].playList = getState(page.items[0].adapterPlayerInstance + 'playlists.playlistListString').val.split(';'); page.items[0].playList = getState(page.items[0].adapterPlayerInstance + 'playlists.playlistListString').val.split(';');
} else if (v2Adapter == 'mpd') { } else if (v2Adapter == 'mpd') {
let tempPL = getState(page.items[0].adapterPlayerInstance + 'listplaylists').val; let tempPL = getState(page.items[0].adapterPlayerInstance + 'listplaylists').val;
tempPL = tempPL.replace('[',''); tempPL = tempPL.replace('[', '');
tempPL = tempPL.replace(']',''); tempPL = tempPL.replace(']', '');
tempPL = tempPL.replaceAll('"',''); tempPL = tempPL.replaceAll('"', '');
page.items[0].playList = tempPL.split(','); page.items[0].playList = tempPL.split(',');
} }
playListIconCol = rgb_dec565(HMIOn); playListIconCol = rgb_dec565(HMIOn);
@@ -9103,6 +9165,7 @@ function triggerButton (id: string): boolean {
} }
return false; return false;
} }
// End Monobutton // End Monobutton
/** /**
@@ -12393,7 +12456,10 @@ function HandleScreensaverUpdate (): void {
} else if (weatherAdapterInstance == 'openweathermap.' + weatherAdapterInstanceNumber + '.') { } else if (weatherAdapterInstance == 'openweathermap.' + weatherAdapterInstanceNumber + '.') {
entityIcon = Icons.GetIcon(GetOpenWeatherMapIcon(icon)); entityIcon = Icons.GetIcon(GetOpenWeatherMapIcon(icon));
entityIconCol = GetOpenWeatherMapIconColor(icon); entityIconCol = GetOpenWeatherMapIconColor(icon);
} else if (weatherAdapterInstance == 'pirate-weather.' + weatherAdapterInstanceNumber + '.') { } else if (weatherAdapterInstance == 'swiss-weather-api.' + weatherAdapterInstanceNumber + '.') {
entityIcon = Icons.GetIcon(GetSwissWeatherApiIcon(icon));
entityIconCol = GetSwissWeatherApiIconColor(icon);
} else if (weatherAdapterInstance == 'pirate-weather.' + weatherAdapterInstanceNumber + '.' || weatherAdapterInstance == 'brightsky.' + weatherAdapterInstanceNumber + '.') {
entityIcon = Icons.GetIcon(GetPirateWeatherIcon(icon)); entityIcon = Icons.GetIcon(GetPirateWeatherIcon(icon));
entityIconCol = GetPirateWeatherIconColor(icon); entityIconCol = GetPirateWeatherIconColor(icon);
} else if (weatherAdapterInstance == 'brightsky.' + weatherAdapterInstanceNumber + '.') { } else if (weatherAdapterInstance == 'brightsky.' + weatherAdapterInstanceNumber + '.') {
@@ -12611,6 +12677,30 @@ function HandleScreensaverUpdate (): void {
RegisterScreensaverEntityWatcher('brightsky.' + weatherAdapterInstanceNumber + '.daily.0' + String(i-1) + '.timestamp'); RegisterScreensaverEntityWatcher('brightsky.' + weatherAdapterInstanceNumber + '.daily.0' + String(i-1) + '.timestamp');
RegisterScreensaverEntityWatcher('brightsky.' + weatherAdapterInstanceNumber + '.daily.0' + String(i-1) + '.icon_special'); RegisterScreensaverEntityWatcher('brightsky.' + weatherAdapterInstanceNumber + '.daily.0' + String(i-1) + '.icon_special');
} }
} else if (weatherAdapterInstance == 'swiss-weather-api.' + weatherAdapterInstanceNumber + '.') {
if (i < 6) {
// swiss-weather-api. 0 .forecast.days.day 0 .0000.TN_C
TempMin = existsObject('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day' + String(i - 1) + '.0000.TN_C')
? Math.round(getState('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day' + String(i - 1) + '.0000.TN_C').val * 10) / 10
: 0;
TempMax = existsObject('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day' + String(i - 1) + '.0000.TX_C')
? Math.round(getState('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day' + String(i - 1) + '.0000.TX_C').val * 10) / 10
: 0;
DayOfWeek = existsObject('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day' + String(i - 1) + '.0000.day_name')
? getState('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day' + String(i - 1) + '.0000.day_name').val
: 0;
WeatherIcon = existsObject('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day' + String(i - 1) + '.0000.symbol_code')
? GetSwissWeatherApiIcon(String(getState('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day' + String(i - 1) + '.0000.symbol_code').val))
: '';
WheatherColor = existsObject('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day' + String(i - 1) + '.0000.symbol_code')
? GetSwissWeatherApiIconColor(String(getState('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day' + String(i - 1) + '.0000.symbol_code').val))
: 0;
RegisterScreensaverEntityWatcher('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day' + String(i - 1) + '.0000.TN_C');
RegisterScreensaverEntityWatcher('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day' + String(i - 1) + '.0000.TX_C');
RegisterScreensaverEntityWatcher('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day' + String(i - 1) + '.0000.day_name');
RegisterScreensaverEntityWatcher('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day' + String(i - 1) + '.0000.symbol_code');
}
} }
let tempMinMaxString: string = ''; let tempMinMaxString: string = '';
@@ -12719,6 +12809,30 @@ function HandleScreensaverUpdate (): void {
sun = 'weather-sunset-up'; sun = 'weather-sunset-up';
} }
payloadString += '~' + '~' + Icons.GetIcon(sun) + '~' + rgb_dec565(MSYellow) + '~' + 'Sonne' + '~' + formatDate(getDateObject(arraySunEvent[nextSunEvent]), 'hh:mm') + '~';
} else if (weatherAdapterInstance == 'swiss-weather-api.' + weatherAdapterInstanceNumber + '.' && i == 6) {
let nextSunEvent = 0;
let valDateNow = getDateObject((new Date().getTime())).getTime();
let arraySunEvent: number[] = [];
arraySunEvent[0] = getDateObject(getState('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day0.0000.SUNRISE').val).getTime();
arraySunEvent[1] = getDateObject(getState('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day0.0000.SUNSET').val).getTime();
arraySunEvent[2] = getDateObject(getState('swiss-weather-api.' + weatherAdapterInstanceNumber + '.forecast.days.day1.0000.SUNRISE').val).getTime();
let j = 0;
for (j = 0; j < 3; j++) {
if (arraySunEvent[j] > valDateNow) {
nextSunEvent = j;
break;
}
}
let sun = '';
if (j == 1) {
sun = 'weather-sunset-down';
} else {
sun = 'weather-sunset-up';
}
payloadString += '~' + '~' + Icons.GetIcon(sun) + '~' + rgb_dec565(MSYellow) + '~' + 'Sonne' + '~' + formatDate(getDateObject(arraySunEvent[nextSunEvent]), 'hh:mm') + '~'; payloadString += '~' + '~' + Icons.GetIcon(sun) + '~' + rgb_dec565(MSYellow) + '~' + 'Sonne' + '~' + formatDate(getDateObject(arraySunEvent[nextSunEvent]), 'hh:mm') + '~';
} else { } else {
payloadString += '~' + '~' + Icons.GetIcon(WeatherIcon) + '~' + WheatherColor + '~' + DayOfWeek + '~' + tempMinMaxString + '~'; payloadString += '~' + '~' + Icons.GetIcon(WeatherIcon) + '~' + WheatherColor + '~' + DayOfWeek + '~' + tempMinMaxString + '~';
@@ -13691,6 +13805,193 @@ function GetOpenWeatherMapIconColor (icon: string): number {
return 0; return 0;
} }
/**
* Retrieves the SwissWeatherApi icon string based on the provided icon string.
*
* This function maps the given SwissWeatherApi icon string to its corresponding icon string representation.
* See https://github.com/baerengraben/ioBroker.swiss-weather-api/tree/master/img/Meteo_API_Icons/Color for
* list of icons.
*
* @function GetSwissWeatherApiIcon
* @param {string} icon - The icon string.
* @returns {string} The corresponding icon string.
*/
function GetSwissWeatherApiIcon(icon: string): string {
try {
switch (icon) {
case "1":
return 'weather-sunny';
case "-1":
return 'weather-night';
case "3": //few clouds day
return 'weather-partly-cloudy';
case "-3": //few clouds night
return 'weather-night-partly-cloudy';
case "10": //scattered clouds
case "-10":
return 'weather-cloudy';
case "18": //cloudy
case "-18":
case "19":
case "-19":
return 'weather-cloudy';
case "23": //shower rain
case "-23":
return 'weather-rainy';
case "4": //rain
case "-4":
case "8":
case "-8":
case "11":
case "-11":
case "15":
case "-15":
case "20":
case "-20":
case "22":
case "-22":
case "25":
case "-25":
case "29":
case "-29":
return 'weather-pouring';
case "5": //Thunderstorm
case "-5":
case "7":
case "-7":
case "9":
case "-9":
case "12":
case "-12":
case "14":
case "-14":
case "16":
case "-16":
case "26":
case "-26":
case "28":
case "-28":
case "30":
case "-30":
return 'weather-lightning';
case "6": //snow
case "-6":
case "13":
case "-13":
case "21":
case "-21":
case "24":
case "-24":
case "27":
case "-27":
return 'weather-snowy';
case "2": //mist
case "-2":
case "17":
case "-17":
return 'weather-fog';
default:
return 'alert-circle-outline';
}
} catch (err: any) {
log('error at function GetSwissWeatherApiIcon: ' + err.message, 'warn');
}
return '';
}
/**
* Retrieves the color code for a given SwissWeatherApi icon string.
*
* This function maps the provided SwissWeatherApi icon string to its corresponding color code.
* See https://github.com/baerengraben/ioBroker.swiss-weather-api/tree/master/img/Meteo_API_Icons/Color for
* list of icons.
*
* @function GetSwissWeatherApiIconColor
* @param {string} icon - The icon string.
* @returns {number} The corresponding color code.
*/
function GetSwissWeatherApiIconColor(icon: string): number {
try {
switch (icon) {
case "1": //clear sky day
return rgb_dec565(swSunny);
case "-1": //clear sky night
return rgb_dec565(swClearNight);
case "3": //few clouds day
case "-3": //few clouds night
return rgb_dec565(swPartlycloudy);
case "10": //scattered clouds
case "-10":
return rgb_dec565(swCloudy);
case "18": //cloudy
case "-18":
case "19":
case "-19":
return rgb_dec565(swCloudy);
case "23": //shower rain
case "-23":
return rgb_dec565(swRainy);
case "4": //rain
case "-4":
case "8":
case "-8":
case "11":
case "-11":
case "15":
case "-15":
case "20":
case "-20":
case "22":
case "-22":
case "25":
case "-25":
case "29":
case "-29":
return rgb_dec565(swPouring);
case "5": //Thunderstorm
case "-5":
case "7":
case "-7":
case "9":
case "-9":
case "12":
case "-12":
case "14":
case "-14":
case "16":
case "-16":
case "26":
case "-26":
case "28":
case "-28":
case "30":
case "-30":
return rgb_dec565(swLightningRainy);
case "6": //snow
case "-6":
case "13":
case "-13":
case "21":
case "-21":
case "24":
case "-24":
case "27":
case "-27":
return rgb_dec565(swSnowy);
case "2": //mist
case "-2":
case "17":
case "-17":
return rgb_dec565(swFog);
default:
return rgb_dec565(White);
}
} catch (err: any) {
log('error at function GetSwissWeatherApiIconColor: ' + err.message, 'warn');
}
return 0;
}
/** /**
* Retrieves the PirateWeather icon string based on the provided icon string. * Retrieves the PirateWeather icon string based on the provided icon string.
* *
@@ -14002,6 +14303,7 @@ on({id: config.panelRecvTopic.substring(0, config.panelRecvTopic.length - 'RESUL
log('error Trigger reading senor-data: ' + err.message, 'warn'); log('error Trigger reading senor-data: ' + err.message, 'warn');
} }
}); });
//------------------End Read Internal Sensor Data //------------------End Read Internal Sensor Data
/** /**
@@ -14449,6 +14751,7 @@ function determineStatusIcon (
if (min === undefined || max === undefined) { if (min === undefined || max === undefined) {
return iconId; return iconId;
} }
function pickIcon(iconKey?: string, defIndex?: number): string { function pickIcon(iconKey?: string, defIndex?: number): string {
return ( return (
(iconKey && existsState(iconKey) && Icons.GetIcon(getState(iconKey).val)) || (iconKey && existsState(iconKey) && Icons.GetIcon(getState(iconKey).val)) ||
@@ -14489,6 +14792,7 @@ function spotifyGetDeviceID (vDeviceString: string): string {
let strDevID = arrayDeviceListIds[indexPos]; let strDevID = arrayDeviceListIds[indexPos];
return strDevID; return strDevID;
} }
/** /**
* Join arguments with ~ and return the string; * Join arguments with ~ and return the string;
* @param tokens unlimited numbers of strings * @param tokens unlimited numbers of strings
@@ -14564,6 +14868,7 @@ function _schedule (time: {hour?: number; minute?: number} | undefined | number,
const timeout = targetTime - new Date().getTime(); const timeout = targetTime - new Date().getTime();
scheduleList[ref] = setTimeout(_schedule, timeout, time, ref, repeatTime, callback); scheduleList[ref] = setTimeout(_schedule, timeout, time, ref, repeatTime, callback);
} }
/** /**
* Clears a scheduled task based on the reference ID. * Clears a scheduled task based on the reference ID.
* *
@@ -14578,6 +14883,7 @@ function _clearSchedule (ref: number): null {
delete scheduleList[ref]; delete scheduleList[ref];
return null; return null;
} }
const ArrayPlayerTypeWithMediaDevice = ['alexa2', 'sonos', 'squeezeboxrpc'] as const; const ArrayPlayerTypeWithMediaDevice = ['alexa2', 'sonos', 'squeezeboxrpc'] as const;
const ArrayPlayerTypeWithOutMediaDevice = ['spotify-premium', 'volumio', 'bosesoundtouch', 'mpd'] as const; const ArrayPlayerTypeWithOutMediaDevice = ['spotify-premium', 'volumio', 'bosesoundtouch', 'mpd'] as const;
@@ -14593,6 +14899,7 @@ const ArrayPlayerTypeWithOutMediaDevice = ['spotify-premium', 'volumio', 'boseso
function isPlayerWithMediaDevice (F: string | NSPanel._PlayerTypeWithMediaDevice): F is NSPanel._PlayerTypeWithMediaDevice { function isPlayerWithMediaDevice (F: string | NSPanel._PlayerTypeWithMediaDevice): F is NSPanel._PlayerTypeWithMediaDevice {
return ArrayPlayerTypeWithMediaDevice.indexOf(F as NSPanel._PlayerTypeWithMediaDevice) != -1; return ArrayPlayerTypeWithMediaDevice.indexOf(F as NSPanel._PlayerTypeWithMediaDevice) != -1;
} }
/** check if NSPanel.adapterPlayerInstanceType has all Playertypes */ /** check if NSPanel.adapterPlayerInstanceType has all Playertypes */
function checkSortedPlayerType (F: NSPanel.notSortedPlayerType) { function checkSortedPlayerType (F: NSPanel.notSortedPlayerType) {
const test: NSPanel.adapterPlayerInstanceType = F; const test: NSPanel.adapterPlayerInstanceType = F;
@@ -14678,10 +14985,12 @@ function isPopupType (F: NSPanel.PopupType | string): F is NSPanel.PopupType {
return false; return false;
} }
} }
// If u get a error here u forgot something in PagetypeType or PageType // If u get a error here u forgot something in PagetypeType or PageType
function checkPageType (F: NSPanel.PagetypeType, A: NSPanel.PageType) { function checkPageType (F: NSPanel.PagetypeType, A: NSPanel.PageType) {
A.type = F; A.type = F;
} }
function isPageMediaItem (F: NSPanel.PageItem | NSPanel.PageMediaItem): F is NSPanel.PageMediaItem { function isPageMediaItem (F: NSPanel.PageItem | NSPanel.PageMediaItem): F is NSPanel.PageMediaItem {
return 'adapterPlayerInstance' in F; return 'adapterPlayerInstance' in F;
} }
@@ -14693,6 +15002,7 @@ function isPageThermoItem (F: PageItem | NSPanel.PageThermoItem): F is NSPanel.P
function isPageMedia (F: NSPanel.PageType | NSPanel.PageMedia): F is NSPanel.PageMedia { function isPageMedia (F: NSPanel.PageType | NSPanel.PageMedia): F is NSPanel.PageMedia {
return F.type == 'cardMedia'; return F.type == 'cardMedia';
} }
function isPagePower (F: NSPanel.PageType | NSPanel.PagePower): F is NSPanel.PagePower { function isPagePower (F: NSPanel.PageType | NSPanel.PagePower): F is NSPanel.PagePower {
return F.type == 'cardPower'; return F.type == 'cardPower';
} }

View File

@@ -99,7 +99,7 @@ ReleaseNotes:
*************************************************************************************************************** ***************************************************************************************************************
* DE: Für die Erstellung der Aliase durch das Skript, muss in der JavaScript Instanz "setObject" gesetzt sein! * * DE: Für die Erstellung der Aliase durch das Skript, muss in der JavaScript Instanz "setObject" gesetzt sein! *
* EN: In order for the script to create the aliases, “setObject” must be set in the JavaScript instance! * * EN: In order for the script to create the aliases, “setObject” must be set in the JavaScript instance! *
***************************************************************************************************************{ ***************************************************************************************************************
Wenn Rule definiert, dann können die Hardware-Tasten ebenfalls für Seitensteuerung (dann nicht mehr als Relais) genutzt werden Wenn Rule definiert, dann können die Hardware-Tasten ebenfalls für Seitensteuerung (dann nicht mehr als Relais) genutzt werden
@@ -406,10 +406,10 @@ const defaultBackgroundColorParam: any = HMIDark;
- Servicemenü aus pages "NSPanel_Service" unter pages kommentieren ("//" hinzufügen) - Servicemenü aus pages "NSPanel_Service" unter pages kommentieren ("//" hinzufügen)
*/ */
/************************************************************************************************* /***********************************************************************************************
** Service pages with auto alias (subsequent pages are automatically created with alias) ** ** Service pages with auto alias (subsequent pages are automatically created with alias) **
** https://github.com/joBr99/nspanel-lovelace-ui/wiki/NSPanel-Service-Men%C3%BC ** ** https://github.com/joBr99/nspanel-lovelace-ui/wiki/NSPanel-Service-Men%C3%BC **
************************************************************************************************/ ***********************************************************************************************/
/* EN: English /* EN: English
If the service menu needs to be secured, a cardUnlock can be installed upstream. If the service menu needs to be secured, a cardUnlock can be installed upstream.
@@ -822,7 +822,7 @@ export const config: Config = {
NSPanel_Wifi_Info_2, //Auto-Alias Service Page NSPanel_Wifi_Info_2, //Auto-Alias Service Page
NSPanel_Sensoren, //Auto-Alias Service Page NSPanel_Sensoren, //Auto-Alias Service Page
NSPanel_Hardware, //Auto-Alias Service Page NSPanel_Hardware, //Auto-Alias Service Page
NSPanel_IoBroker, //Auot-Alias Service Page NSPanel_IoBroker, //Auto-Alias Service Page
NSPanel_Einstellungen, //Auto-Alias Service Page NSPanel_Einstellungen, //Auto-Alias Service Page
NSPanel_Screensaver, //Auto-Alias Service Page NSPanel_Screensaver, //Auto-Alias Service Page
NSPanel_ScreensaverDimmode, //Auto-Alias Service Page NSPanel_ScreensaverDimmode, //Auto-Alias Service Page
@@ -3895,6 +3895,7 @@ function get_current_tasmota_ip_address () {
log('error at function get_current_tasmota_ip_address: ' + err.message, 'warn'); log('error at function get_current_tasmota_ip_address: ' + err.message, 'warn');
} }
} }
/** /**
* Retrieves the current IP address of the Tasmota device. * Retrieves the current IP address of the Tasmota device.
* *
@@ -4373,7 +4374,6 @@ on({id: config.panelRecvTopic}, async (obj) => {
}); });
/** /**
* Updates the Berry driver version on the NSPanel. * Updates the Berry driver version on the NSPanel.
* *
@@ -5227,7 +5227,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
/** /**
* The same extension can be found below in blind. vval=0 means closed / val=100 means open. If val is in between, icon3 is used. * The same extension can be found below in blind. vval=0 means closed / val=100 means open. If val is in between, icon3 is used.
* Icons in this part can be states and strings. The specifications are based on German shutters. * Icons in this part can be states and strings. The specifications are based on German shutters.
*/ */
iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['window-shutter', 'window-shutter-open', 'window-shutter-alert']); iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['window-shutter', 'window-shutter-open', 'window-shutter-alert']);
iconColor = existsState(pageItem.id + '.COLORDEC') iconColor = existsState(pageItem.id + '.COLORDEC')
? getState(pageItem.id + '.COLORDEC').val ? getState(pageItem.id + '.COLORDEC').val
@@ -5337,7 +5337,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (role == 'temperature' || role == 'value.temperature' || role == 'thermostat') { if (role == 'temperature' || role == 'value.temperature' || role == 'thermostat') {
iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['snowflake-thermometer', 'sun-thermometer', 'thermometer']); iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['snowflake-thermometer', 'sun-thermometer', 'thermometer']);
} else if (role == 'humidity' || role == 'value.humidity') { } else if (role == 'humidity' || role == 'value.humidity') {
iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['water-off', 'water-percent-alert' , 'water-percent']); iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['water-off', 'water-percent-alert', 'water-percent']);
} }
iconColor = GetIconColor(pageItem, parseInt(optVal), useColors); iconColor = GetIconColor(pageItem, parseInt(optVal), useColors);
@@ -5444,7 +5444,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (pageItem.popupVersion !== undefined) { if (pageItem.popupVersion !== undefined) {
if (pageItem.popupVersion == 1) { if (pageItem.popupVersion == 1) {
type = 'light'; type = 'light';
} else if (pageItem.popupVersion == 2){ } else if (pageItem.popupVersion == 2) {
type = 'light2'; type = 'light2';
} }
} }
@@ -5488,7 +5488,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (pageItem.popupVersion !== undefined) { if (pageItem.popupVersion !== undefined) {
if (pageItem.popupVersion == 1) { if (pageItem.popupVersion == 1) {
type = 'light'; type = 'light';
} else if (pageItem.popupVersion == 2){ } else if (pageItem.popupVersion == 2) {
type = 'light2'; type = 'light2';
} }
} }
@@ -5528,7 +5528,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (pageItem.popupVersion !== undefined) { if (pageItem.popupVersion !== undefined) {
if (pageItem.popupVersion == 1) { if (pageItem.popupVersion == 1) {
type = 'light'; type = 'light';
} else if (pageItem.popupVersion == 2){ } else if (pageItem.popupVersion == 2) {
type = 'light2'; type = 'light2';
} }
} }
@@ -5583,7 +5583,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (pageItem.popupVersion !== undefined) { if (pageItem.popupVersion !== undefined) {
if (pageItem.popupVersion == 1) { if (pageItem.popupVersion == 1) {
type = 'light'; type = 'light';
} else if (pageItem.popupVersion == 2){ } else if (pageItem.popupVersion == 2) {
type = 'light2'; type = 'light2';
} }
} }
@@ -5610,7 +5610,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (Debug) log('CIE wurde zuletzt geändert - Lampe ist Color-Mode'); if (Debug) log('CIE wurde zuletzt geändert - Lampe ist Color-Mode');
if (getState(pageItem.id + '.CIE').val != null) { if (getState(pageItem.id + '.CIE').val != null) {
let cie: string = getState(pageItem.id + '.CIE').val; let cie: string = getState(pageItem.id + '.CIE').val;
let cieArray = (cie.substring(1, cie.length -1)).split(','); let cieArray = (cie.substring(1, cie.length - 1)).split(',');
let rgb: RGB = cie_to_rgb(parseFloat(cieArray[0]), parseFloat(cieArray[1]), 254); let rgb: RGB = cie_to_rgb(parseFloat(cieArray[0]), parseFloat(cieArray[1]), 254);
let cRGB: RGB = lightenDarkenColor(ConvertRGBtoHex(rgb.red, rgb.green, rgb.blue), (100 - brightness) * -1); let cRGB: RGB = lightenDarkenColor(ConvertRGBtoHex(rgb.red, rgb.green, rgb.blue), (100 - brightness) * -1);
iconColor = rgb_dec565(pageItem.interpolateColor !== undefined ? cRGB : config.defaultOnColor); iconColor = rgb_dec565(pageItem.interpolateColor !== undefined ? cRGB : config.defaultOnColor);
@@ -5637,7 +5637,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (pageItem.popupVersion !== undefined) { if (pageItem.popupVersion !== undefined) {
if (pageItem.popupVersion == 1) { if (pageItem.popupVersion == 1) {
type = 'light'; type = 'light';
} else if (pageItem.popupVersion == 2){ } else if (pageItem.popupVersion == 2) {
type = 'light2'; type = 'light2';
} }
} }
@@ -5693,7 +5693,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (pageItem.popupVersion !== undefined) { if (pageItem.popupVersion !== undefined) {
if (pageItem.popupVersion == 1) { if (pageItem.popupVersion == 1) {
type = 'light'; type = 'light';
} else if (pageItem.popupVersion == 2){ } else if (pageItem.popupVersion == 2) {
type = 'light2'; type = 'light2';
} }
} }
@@ -5719,7 +5719,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (pageItem.popupVersion !== undefined) { if (pageItem.popupVersion !== undefined) {
if (pageItem.popupVersion == 1) { if (pageItem.popupVersion == 1) {
type = 'shutter'; type = 'shutter';
} else if (pageItem.popupVersion == 2){ } else if (pageItem.popupVersion == 2) {
type = 'shutter2'; type = 'shutter2';
} }
} }
@@ -5860,7 +5860,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (role == 'temperature' || role == 'value.temperature' || role == 'thermostat') { if (role == 'temperature' || role == 'value.temperature' || role == 'thermostat') {
iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['snowflake-thermometer', 'sun-thermometer', 'thermometer']); iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['snowflake-thermometer', 'sun-thermometer', 'thermometer']);
} else if (role == 'humidity' || role == 'value.humidity') { } else if (role == 'humidity' || role == 'value.humidity') {
iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['water-off', 'water-percent-alert' , 'water-percent']); iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['water-off', 'water-percent-alert', 'water-percent']);
} }
iconColor = GetIconColor(pageItem, parseInt(optVal), useColors); iconColor = GetIconColor(pageItem, parseInt(optVal), useColors);
@@ -5923,7 +5923,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
if (!pageItem.useValue) iconId = pageItem.icon != undefined ? Icons.GetIcon(pageItem.icon) : iconId; if (!pageItem.useValue) iconId = pageItem.icon != undefined ? Icons.GetIcon(pageItem.icon) : iconId;
iconColor = pageItem.onColor != undefined ? rgb_dec565(pageItem.onColor) : iconColor; iconColor = pageItem.onColor != undefined ? rgb_dec565(pageItem.onColor) : iconColor;
} else { } else {
if(!pageItem.useValue) iconId = pageItem.icon2 != undefined ? Icons.GetIcon(pageItem.icon2) : iconId; if (!pageItem.useValue) iconId = pageItem.icon2 != undefined ? Icons.GetIcon(pageItem.icon2) : iconId;
iconColor = pageItem.offColor != undefined ? rgb_dec565(pageItem.offColor) : iconColor; iconColor = pageItem.offColor != undefined ? rgb_dec565(pageItem.offColor) : iconColor;
} }
} }
@@ -7158,6 +7158,7 @@ function subscribeMediaSubscriptionsSonosAdd (id: string): void {
} }
}); });
} }
/** /**
* Creates media aliases for a specific media device and adapter player instance. * Creates media aliases for a specific media device and adapter player instance.
* *
@@ -8014,9 +8015,9 @@ function GenerateMediaPage (page: NSPanel.PageMedia): NSPanel.Payload[] {
page.items[0].playList = getState(page.items[0].adapterPlayerInstance + 'playlists.playlistListString').val.split(';'); page.items[0].playList = getState(page.items[0].adapterPlayerInstance + 'playlists.playlistListString').val.split(';');
} else if (v2Adapter == 'mpd') { } else if (v2Adapter == 'mpd') {
let tempPL = getState(page.items[0].adapterPlayerInstance + 'listplaylists').val; let tempPL = getState(page.items[0].adapterPlayerInstance + 'listplaylists').val;
tempPL = tempPL.replace('[',''); tempPL = tempPL.replace('[', '');
tempPL = tempPL.replace(']',''); tempPL = tempPL.replace(']', '');
tempPL = tempPL.replaceAll('"',''); tempPL = tempPL.replaceAll('"', '');
page.items[0].playList = tempPL.split(','); page.items[0].playList = tempPL.split(',');
} }
playListIconCol = rgb_dec565(HMIOn); playListIconCol = rgb_dec565(HMIOn);
@@ -9099,6 +9100,7 @@ function triggerButton (id: string): boolean {
} }
return false; return false;
} }
// End Monobutton // End Monobutton
/** /**
@@ -13919,6 +13921,7 @@ on({id: config.panelRecvTopic.substring(0, config.panelRecvTopic.length - 'RESUL
log('error Trigger reading senor-data: ' + err.message, 'warn'); log('error Trigger reading senor-data: ' + err.message, 'warn');
} }
}); });
//------------------End Read Internal Sensor Data //------------------End Read Internal Sensor Data
/** /**
@@ -14366,6 +14369,7 @@ function determineStatusIcon (
if (min === undefined || max === undefined) { if (min === undefined || max === undefined) {
return iconId; return iconId;
} }
function pickIcon(iconKey?: string, defIndex?: number): string { function pickIcon(iconKey?: string, defIndex?: number): string {
return ( return (
(iconKey && existsState(iconKey) && Icons.GetIcon(getState(iconKey).val)) || (iconKey && existsState(iconKey) && Icons.GetIcon(getState(iconKey).val)) ||
@@ -14406,6 +14410,7 @@ function spotifyGetDeviceID (vDeviceString: string): string {
let strDevID = arrayDeviceListIds[indexPos]; let strDevID = arrayDeviceListIds[indexPos];
return strDevID; return strDevID;
} }
/** /**
* Join arguments with ~ and return the string; * Join arguments with ~ and return the string;
* @param tokens unlimited numbers of strings * @param tokens unlimited numbers of strings
@@ -14481,6 +14486,7 @@ function _schedule (time: {hour?: number; minute?: number} | undefined | number,
const timeout = targetTime - new Date().getTime(); const timeout = targetTime - new Date().getTime();
scheduleList[ref] = setTimeout(_schedule, timeout, time, ref, repeatTime, callback); scheduleList[ref] = setTimeout(_schedule, timeout, time, ref, repeatTime, callback);
} }
/** /**
* Clears a scheduled task based on the reference ID. * Clears a scheduled task based on the reference ID.
* *
@@ -14495,6 +14501,7 @@ function _clearSchedule (ref: number): null {
delete scheduleList[ref]; delete scheduleList[ref];
return null; return null;
} }
const ArrayPlayerTypeWithMediaDevice = ['alexa2', 'sonos', 'squeezeboxrpc'] as const; const ArrayPlayerTypeWithMediaDevice = ['alexa2', 'sonos', 'squeezeboxrpc'] as const;
const ArrayPlayerTypeWithOutMediaDevice = ['spotify-premium', 'volumio', 'bosesoundtouch', 'mpd'] as const; const ArrayPlayerTypeWithOutMediaDevice = ['spotify-premium', 'volumio', 'bosesoundtouch', 'mpd'] as const;
@@ -14510,6 +14517,7 @@ const ArrayPlayerTypeWithOutMediaDevice = ['spotify-premium', 'volumio', 'boseso
function isPlayerWithMediaDevice (F: string | NSPanel._PlayerTypeWithMediaDevice): F is NSPanel._PlayerTypeWithMediaDevice { function isPlayerWithMediaDevice (F: string | NSPanel._PlayerTypeWithMediaDevice): F is NSPanel._PlayerTypeWithMediaDevice {
return ArrayPlayerTypeWithMediaDevice.indexOf(F as NSPanel._PlayerTypeWithMediaDevice) != -1; return ArrayPlayerTypeWithMediaDevice.indexOf(F as NSPanel._PlayerTypeWithMediaDevice) != -1;
} }
/** check if NSPanel.adapterPlayerInstanceType has all Playertypes */ /** check if NSPanel.adapterPlayerInstanceType has all Playertypes */
function checkSortedPlayerType (F: NSPanel.notSortedPlayerType) { function checkSortedPlayerType (F: NSPanel.notSortedPlayerType) {
const test: NSPanel.adapterPlayerInstanceType = F; const test: NSPanel.adapterPlayerInstanceType = F;
@@ -14595,10 +14603,12 @@ function isPopupType (F: NSPanel.PopupType | string): F is NSPanel.PopupType {
return false; return false;
} }
} }
// If u get a error here u forgot something in PagetypeType or PageType // If u get a error here u forgot something in PagetypeType or PageType
function checkPageType (F: NSPanel.PagetypeType, A: NSPanel.PageType) { function checkPageType (F: NSPanel.PagetypeType, A: NSPanel.PageType) {
A.type = F; A.type = F;
} }
function isPageMediaItem (F: NSPanel.PageItem | NSPanel.PageMediaItem): F is NSPanel.PageMediaItem { function isPageMediaItem (F: NSPanel.PageItem | NSPanel.PageMediaItem): F is NSPanel.PageMediaItem {
return 'adapterPlayerInstance' in F; return 'adapterPlayerInstance' in F;
} }
@@ -14610,6 +14620,7 @@ function isPageThermoItem (F: PageItem | NSPanel.PageThermoItem): F is NSPanel.P
function isPageMedia (F: NSPanel.PageType | NSPanel.PageMedia): F is NSPanel.PageMedia { function isPageMedia (F: NSPanel.PageType | NSPanel.PageMedia): F is NSPanel.PageMedia {
return F.type == 'cardMedia'; return F.type == 'cardMedia';
} }
function isPagePower (F: NSPanel.PageType | NSPanel.PagePower): F is NSPanel.PagePower { function isPagePower (F: NSPanel.PageType | NSPanel.PagePower): F is NSPanel.PagePower {
return F.type == 'cardPower'; return F.type == 'cardPower';
} }