mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-03-03 20:06:53 +01:00
Compare commits
7 Commits
603d207e12
...
77b7400b04
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77b7400b04 | ||
|
|
995e7eebd2 | ||
|
|
c91ca0912a | ||
|
|
a6742f88c8 | ||
|
|
9f146ec8b3 | ||
|
|
0cccfac4a6 | ||
|
|
fbe5f9658e |
@@ -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
|
||||
- abgestimmt auf TFT 60 / v5.1.0 / BerryDriver 10 / Tasmota 15.0.1
|
||||
TypeScript v5.1.0.2 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @ticaki / @Britzelpuf / @Sternmiere / @ravenS0ne
|
||||
- abgestimmt auf TFT 61 / v5.1.0 / BerryDriver 10 / Tasmota 15.0.1
|
||||
|
||||
Projekt:
|
||||
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
|
||||
- 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
|
||||
- 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! *
|
||||
* 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
|
||||
|
||||
@@ -192,9 +193,13 @@ Tasmota-Status0 - (zyklische Ausführung)
|
||||
|
||||
Erforderliche Adapter:
|
||||
|
||||
Pirate-Weather oder BrightSky oder OpenWeatherMap --> Bei Nutzung der Wetterfunktionen (und zur Icon-Konvertierung) im Screensaver
|
||||
!!!DasWetter deprecated - Dienst nur noch für ältere Accounts funktional
|
||||
!!!AccuWeather deprecated - Dienst schaltet Free-Account ab!!!
|
||||
Bei Nutzung der Wetterfunktionen (und zur Icon-Konvertierung) im Screensaver einen der folgenden Wetter-Adapter:
|
||||
- Pirate-Weather
|
||||
- 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
|
||||
Geräte verwalten - Für Erstellung der Aliase
|
||||
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 *****/
|
||||
|
||||
// DE: Mögliche Wetteradapter 'pirate-weather.0.' oder 'brightsky.0.' oder 'openweathermap.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)
|
||||
// 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 'swiss-weather-api.0.' or 'daswetter.0.' (deprecated) or 'accuweather.0.' (deprecated)
|
||||
const weatherAdapterInstance: string = 'pirate-weather.0.';
|
||||
|
||||
// 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)
|
||||
*/
|
||||
|
||||
/*************************************************************************************************
|
||||
** 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 **
|
||||
************************************************************************************************/
|
||||
/***********************************************************************************************
|
||||
** 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 **
|
||||
***********************************************************************************************/
|
||||
|
||||
/* EN: English
|
||||
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_Sensoren, //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_Screensaver, //Auto-Alias Service Page
|
||||
NSPanel_ScreensaverDimmode, //Auto-Alias Service Page
|
||||
@@ -994,7 +999,7 @@ export const config: Config = {
|
||||
// _________________________________ DE: Ab hier keine Konfiguration mehr _____________________________________
|
||||
// _________________________________ 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 desired_display_firmware_version = 61;
|
||||
const berry_driver_version = 10;
|
||||
@@ -1113,6 +1118,11 @@ async function CheckConfigParameters () {
|
||||
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('.');
|
||||
weatherAdapterInstanceNumber = weatherAdapterInstanceArray[1];
|
||||
@@ -2605,6 +2615,57 @@ async function CreateWeatherAlias () {
|
||||
} catch (err: any) {
|
||||
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) {
|
||||
@@ -3899,6 +3960,7 @@ function get_current_tasmota_ip_address () {
|
||||
log('error at function get_current_tasmota_ip_address: ' + err.message, 'warn');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@@ -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.
|
||||
* 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']);
|
||||
iconColor = existsState(pageItem.id + '.COLORDEC')
|
||||
? 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') {
|
||||
iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['snowflake-thermometer', 'sun-thermometer', 'thermometer']);
|
||||
} 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);
|
||||
|
||||
@@ -5448,7 +5509,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (pageItem.popupVersion !== undefined) {
|
||||
if (pageItem.popupVersion == 1) {
|
||||
type = 'light';
|
||||
} else if (pageItem.popupVersion == 2){
|
||||
} else if (pageItem.popupVersion == 2) {
|
||||
type = 'light2';
|
||||
}
|
||||
}
|
||||
@@ -5492,7 +5553,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (pageItem.popupVersion !== undefined) {
|
||||
if (pageItem.popupVersion == 1) {
|
||||
type = 'light';
|
||||
} else if (pageItem.popupVersion == 2){
|
||||
} else if (pageItem.popupVersion == 2) {
|
||||
type = 'light2';
|
||||
}
|
||||
}
|
||||
@@ -5532,7 +5593,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (pageItem.popupVersion !== undefined) {
|
||||
if (pageItem.popupVersion == 1) {
|
||||
type = 'light';
|
||||
} else if (pageItem.popupVersion == 2){
|
||||
} else if (pageItem.popupVersion == 2) {
|
||||
type = 'light2';
|
||||
}
|
||||
}
|
||||
@@ -5587,7 +5648,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (pageItem.popupVersion !== undefined) {
|
||||
if (pageItem.popupVersion == 1) {
|
||||
type = 'light';
|
||||
} else if (pageItem.popupVersion == 2){
|
||||
} else if (pageItem.popupVersion == 2) {
|
||||
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 (getState(pageItem.id + '.CIE').val != null) {
|
||||
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 cRGB: RGB = lightenDarkenColor(ConvertRGBtoHex(rgb.red, rgb.green, rgb.blue), (100 - brightness) * -1);
|
||||
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 == 1) {
|
||||
type = 'light';
|
||||
} else if (pageItem.popupVersion == 2){
|
||||
} else if (pageItem.popupVersion == 2) {
|
||||
type = 'light2';
|
||||
}
|
||||
}
|
||||
@@ -5697,7 +5758,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (pageItem.popupVersion !== undefined) {
|
||||
if (pageItem.popupVersion == 1) {
|
||||
type = 'light';
|
||||
} else if (pageItem.popupVersion == 2){
|
||||
} else if (pageItem.popupVersion == 2) {
|
||||
type = 'light2';
|
||||
}
|
||||
}
|
||||
@@ -5723,7 +5784,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (pageItem.popupVersion !== undefined) {
|
||||
if (pageItem.popupVersion == 1) {
|
||||
type = 'shutter';
|
||||
} else if (pageItem.popupVersion == 2){
|
||||
} else if (pageItem.popupVersion == 2) {
|
||||
type = 'shutter2';
|
||||
}
|
||||
}
|
||||
@@ -5864,7 +5925,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (role == 'temperature' || role == 'value.temperature' || role == 'thermostat') {
|
||||
iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['snowflake-thermometer', 'sun-thermometer', 'thermometer']);
|
||||
} 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);
|
||||
@@ -5927,7 +5988,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (!pageItem.useValue) iconId = pageItem.icon != undefined ? Icons.GetIcon(pageItem.icon) : iconId;
|
||||
iconColor = pageItem.onColor != undefined ? rgb_dec565(pageItem.onColor) : iconColor;
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
@@ -7162,6 +7223,7 @@ function subscribeMediaSubscriptionsSonosAdd (id: string): void {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(';');
|
||||
} else if (v2Adapter == 'mpd') {
|
||||
let tempPL = getState(page.items[0].adapterPlayerInstance + 'listplaylists').val;
|
||||
tempPL = tempPL.replace('[','');
|
||||
tempPL = tempPL.replace(']','');
|
||||
tempPL = tempPL.replaceAll('"','');
|
||||
tempPL = tempPL.replace('[', '');
|
||||
tempPL = tempPL.replace(']', '');
|
||||
tempPL = tempPL.replaceAll('"', '');
|
||||
page.items[0].playList = tempPL.split(',');
|
||||
}
|
||||
playListIconCol = rgb_dec565(HMIOn);
|
||||
@@ -9103,6 +9165,7 @@ function triggerButton (id: string): boolean {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// End Monobutton
|
||||
|
||||
/**
|
||||
@@ -12393,7 +12456,10 @@ function HandleScreensaverUpdate (): void {
|
||||
} else if (weatherAdapterInstance == 'openweathermap.' + weatherAdapterInstanceNumber + '.') {
|
||||
entityIcon = Icons.GetIcon(GetOpenWeatherMapIcon(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));
|
||||
entityIconCol = GetPirateWeatherIconColor(icon);
|
||||
} 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) + '.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 = '';
|
||||
@@ -12719,6 +12809,30 @@ function HandleScreensaverUpdate (): void {
|
||||
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') + '~';
|
||||
} else {
|
||||
payloadString += '~' + '~' + Icons.GetIcon(WeatherIcon) + '~' + WheatherColor + '~' + DayOfWeek + '~' + tempMinMaxString + '~';
|
||||
@@ -13691,6 +13805,193 @@ function GetOpenWeatherMapIconColor (icon: string): number {
|
||||
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.
|
||||
*
|
||||
@@ -14002,6 +14303,7 @@ on({id: config.panelRecvTopic.substring(0, config.panelRecvTopic.length - 'RESUL
|
||||
log('error Trigger reading senor-data: ' + err.message, 'warn');
|
||||
}
|
||||
});
|
||||
|
||||
//------------------End Read Internal Sensor Data
|
||||
|
||||
/**
|
||||
@@ -14449,6 +14751,7 @@ function determineStatusIcon (
|
||||
if (min === undefined || max === undefined) {
|
||||
return iconId;
|
||||
}
|
||||
|
||||
function pickIcon(iconKey?: string, defIndex?: number): string {
|
||||
return (
|
||||
(iconKey && existsState(iconKey) && Icons.GetIcon(getState(iconKey).val)) ||
|
||||
@@ -14489,6 +14792,7 @@ function spotifyGetDeviceID (vDeviceString: string): string {
|
||||
let strDevID = arrayDeviceListIds[indexPos];
|
||||
return strDevID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Join arguments with ~ and return the string;
|
||||
* @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();
|
||||
scheduleList[ref] = setTimeout(_schedule, timeout, time, ref, repeatTime, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears a scheduled task based on the reference ID.
|
||||
*
|
||||
@@ -14578,6 +14883,7 @@ function _clearSchedule (ref: number): null {
|
||||
delete scheduleList[ref];
|
||||
return null;
|
||||
}
|
||||
|
||||
const ArrayPlayerTypeWithMediaDevice = ['alexa2', 'sonos', 'squeezeboxrpc'] 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 {
|
||||
return ArrayPlayerTypeWithMediaDevice.indexOf(F as NSPanel._PlayerTypeWithMediaDevice) != -1;
|
||||
}
|
||||
|
||||
/** check if NSPanel.adapterPlayerInstanceType has all Playertypes */
|
||||
function checkSortedPlayerType (F: NSPanel.notSortedPlayerType) {
|
||||
const test: NSPanel.adapterPlayerInstanceType = F;
|
||||
@@ -14678,10 +14985,12 @@ function isPopupType (F: NSPanel.PopupType | string): F is NSPanel.PopupType {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// If u get a error here u forgot something in PagetypeType or PageType
|
||||
function checkPageType (F: NSPanel.PagetypeType, A: NSPanel.PageType) {
|
||||
A.type = F;
|
||||
}
|
||||
|
||||
function isPageMediaItem (F: NSPanel.PageItem | NSPanel.PageMediaItem): F is NSPanel.PageMediaItem {
|
||||
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 {
|
||||
return F.type == 'cardMedia';
|
||||
}
|
||||
|
||||
function isPagePower (F: NSPanel.PageType | NSPanel.PagePower): F is NSPanel.PagePower {
|
||||
return F.type == 'cardPower';
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ ReleaseNotes:
|
||||
***************************************************************************************************************
|
||||
* 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! *
|
||||
***************************************************************************************************************{
|
||||
***************************************************************************************************************
|
||||
|
||||
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)
|
||||
*/
|
||||
|
||||
/*************************************************************************************************
|
||||
** 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 **
|
||||
************************************************************************************************/
|
||||
/***********************************************************************************************
|
||||
** 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 **
|
||||
***********************************************************************************************/
|
||||
|
||||
/* EN: English
|
||||
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_Sensoren, //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_Screensaver, //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');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@@ -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.
|
||||
* 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']);
|
||||
iconColor = existsState(pageItem.id + '.COLORDEC')
|
||||
? 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') {
|
||||
iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['snowflake-thermometer', 'sun-thermometer', 'thermometer']);
|
||||
} 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);
|
||||
|
||||
@@ -5444,7 +5444,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (pageItem.popupVersion !== undefined) {
|
||||
if (pageItem.popupVersion == 1) {
|
||||
type = 'light';
|
||||
} else if (pageItem.popupVersion == 2){
|
||||
} else if (pageItem.popupVersion == 2) {
|
||||
type = 'light2';
|
||||
}
|
||||
}
|
||||
@@ -5488,7 +5488,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (pageItem.popupVersion !== undefined) {
|
||||
if (pageItem.popupVersion == 1) {
|
||||
type = 'light';
|
||||
} else if (pageItem.popupVersion == 2){
|
||||
} else if (pageItem.popupVersion == 2) {
|
||||
type = 'light2';
|
||||
}
|
||||
}
|
||||
@@ -5528,7 +5528,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (pageItem.popupVersion !== undefined) {
|
||||
if (pageItem.popupVersion == 1) {
|
||||
type = 'light';
|
||||
} else if (pageItem.popupVersion == 2){
|
||||
} else if (pageItem.popupVersion == 2) {
|
||||
type = 'light2';
|
||||
}
|
||||
}
|
||||
@@ -5583,7 +5583,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (pageItem.popupVersion !== undefined) {
|
||||
if (pageItem.popupVersion == 1) {
|
||||
type = 'light';
|
||||
} else if (pageItem.popupVersion == 2){
|
||||
} else if (pageItem.popupVersion == 2) {
|
||||
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 (getState(pageItem.id + '.CIE').val != null) {
|
||||
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 cRGB: RGB = lightenDarkenColor(ConvertRGBtoHex(rgb.red, rgb.green, rgb.blue), (100 - brightness) * -1);
|
||||
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 == 1) {
|
||||
type = 'light';
|
||||
} else if (pageItem.popupVersion == 2){
|
||||
} else if (pageItem.popupVersion == 2) {
|
||||
type = 'light2';
|
||||
}
|
||||
}
|
||||
@@ -5693,7 +5693,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (pageItem.popupVersion !== undefined) {
|
||||
if (pageItem.popupVersion == 1) {
|
||||
type = 'light';
|
||||
} else if (pageItem.popupVersion == 2){
|
||||
} else if (pageItem.popupVersion == 2) {
|
||||
type = 'light2';
|
||||
}
|
||||
}
|
||||
@@ -5719,7 +5719,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (pageItem.popupVersion !== undefined) {
|
||||
if (pageItem.popupVersion == 1) {
|
||||
type = 'shutter';
|
||||
} else if (pageItem.popupVersion == 2){
|
||||
} else if (pageItem.popupVersion == 2) {
|
||||
type = 'shutter2';
|
||||
}
|
||||
}
|
||||
@@ -5860,7 +5860,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (role == 'temperature' || role == 'value.temperature' || role == 'thermostat') {
|
||||
iconId = determinePageItemStatusIcon(pageItem, val, iconId, ['snowflake-thermometer', 'sun-thermometer', 'thermometer']);
|
||||
} 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);
|
||||
@@ -5923,7 +5923,7 @@ function CreateEntity (pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (!pageItem.useValue) iconId = pageItem.icon != undefined ? Icons.GetIcon(pageItem.icon) : iconId;
|
||||
iconColor = pageItem.onColor != undefined ? rgb_dec565(pageItem.onColor) : iconColor;
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
@@ -7158,6 +7158,7 @@ function subscribeMediaSubscriptionsSonosAdd (id: string): void {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(';');
|
||||
} else if (v2Adapter == 'mpd') {
|
||||
let tempPL = getState(page.items[0].adapterPlayerInstance + 'listplaylists').val;
|
||||
tempPL = tempPL.replace('[','');
|
||||
tempPL = tempPL.replace(']','');
|
||||
tempPL = tempPL.replaceAll('"','');
|
||||
tempPL = tempPL.replace('[', '');
|
||||
tempPL = tempPL.replace(']', '');
|
||||
tempPL = tempPL.replaceAll('"', '');
|
||||
page.items[0].playList = tempPL.split(',');
|
||||
}
|
||||
playListIconCol = rgb_dec565(HMIOn);
|
||||
@@ -9099,6 +9100,7 @@ function triggerButton (id: string): boolean {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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');
|
||||
}
|
||||
});
|
||||
|
||||
//------------------End Read Internal Sensor Data
|
||||
|
||||
/**
|
||||
@@ -14366,6 +14369,7 @@ function determineStatusIcon (
|
||||
if (min === undefined || max === undefined) {
|
||||
return iconId;
|
||||
}
|
||||
|
||||
function pickIcon(iconKey?: string, defIndex?: number): string {
|
||||
return (
|
||||
(iconKey && existsState(iconKey) && Icons.GetIcon(getState(iconKey).val)) ||
|
||||
@@ -14406,6 +14410,7 @@ function spotifyGetDeviceID (vDeviceString: string): string {
|
||||
let strDevID = arrayDeviceListIds[indexPos];
|
||||
return strDevID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Join arguments with ~ and return the string;
|
||||
* @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();
|
||||
scheduleList[ref] = setTimeout(_schedule, timeout, time, ref, repeatTime, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears a scheduled task based on the reference ID.
|
||||
*
|
||||
@@ -14495,6 +14501,7 @@ function _clearSchedule (ref: number): null {
|
||||
delete scheduleList[ref];
|
||||
return null;
|
||||
}
|
||||
|
||||
const ArrayPlayerTypeWithMediaDevice = ['alexa2', 'sonos', 'squeezeboxrpc'] 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 {
|
||||
return ArrayPlayerTypeWithMediaDevice.indexOf(F as NSPanel._PlayerTypeWithMediaDevice) != -1;
|
||||
}
|
||||
|
||||
/** check if NSPanel.adapterPlayerInstanceType has all Playertypes */
|
||||
function checkSortedPlayerType (F: NSPanel.notSortedPlayerType) {
|
||||
const test: NSPanel.adapterPlayerInstanceType = F;
|
||||
@@ -14595,10 +14603,12 @@ function isPopupType (F: NSPanel.PopupType | string): F is NSPanel.PopupType {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// If u get a error here u forgot something in PagetypeType or PageType
|
||||
function checkPageType (F: NSPanel.PagetypeType, A: NSPanel.PageType) {
|
||||
A.type = F;
|
||||
}
|
||||
|
||||
function isPageMediaItem (F: NSPanel.PageItem | NSPanel.PageMediaItem): F is NSPanel.PageMediaItem {
|
||||
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 {
|
||||
return F.type == 'cardMedia';
|
||||
}
|
||||
|
||||
function isPagePower (F: NSPanel.PageType | NSPanel.PagePower): F is NSPanel.PagePower {
|
||||
return F.type == 'cardPower';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user