mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-03-03 20:06:53 +01:00
Compare commits
1 Commits
d04da62cb3
...
249e7d7fab
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
249e7d7fab |
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------------------------------------
|
||||
TypeScript v4.3.3.42 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @ticaki / @Britzelpuf / @Sternmiere / @ravenS0ne
|
||||
TypeScript v4.3.3.41 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @ticaki / @Britzelpuf / @Sternmiere / @ravenS0ne
|
||||
- abgestimmt auf TFT 53 / v4.3.3 / BerryDriver 9 / Tasmota 13.3.0
|
||||
@joBr99 Projekt: https://github.com/joBr99/nspanel-lovelace-ui/tree/main/ioBroker
|
||||
NsPanelTs.ts (dieses TypeScript in ioBroker) Stable: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/NsPanelTs.ts
|
||||
@@ -111,7 +111,6 @@ ReleaseNotes:
|
||||
- 05.02.2024 - v4.3.3.40 Fix: SqueezeboxRPC-Media-Player and add some Functions
|
||||
- 06.02.2024 - v4.3.3.41 Fix: activeBrightness -> null
|
||||
- 06.02.2024 - v4.3.3.41 Fix: bHome -> corrected PageId
|
||||
- 07.02.2024 - v4.3.3.42 Minor Fixes
|
||||
|
||||
|
||||
Todo:
|
||||
@@ -979,7 +978,7 @@ export const config: Config = {
|
||||
// _________________________________ DE: Ab hier keine Konfiguration mehr _____________________________________
|
||||
// _________________________________ EN: No more configuration from here _____________________________________
|
||||
|
||||
const scriptVersion: string = 'v4.3.3.42';
|
||||
const scriptVersion: string = 'v4.3.3.41';
|
||||
const tft_version: string = 'v4.3.3';
|
||||
const desired_display_firmware_version = 53;
|
||||
const berry_driver_version = 9;
|
||||
@@ -4824,23 +4823,7 @@ function subscribeMediaSubscriptionsBoseAdd(id: string): void {
|
||||
}
|
||||
|
||||
function subscribeMediaSubscriptionsSqueezeboxAdd(id: string): void {
|
||||
on({id: [id + '.DURATION',
|
||||
id + '.ELAPSED'], change: "any"}, async function () {
|
||||
(function () { if (timeoutMedia) { clearTimeout(timeoutMedia); timeoutMedia = null; } })();
|
||||
timeoutMedia = setTimeout(async function () {
|
||||
if (useMediaEvents) {
|
||||
GeneratePage(activePage!);
|
||||
setTimeout(async function () {
|
||||
GeneratePage(activePage!);
|
||||
}, 50);
|
||||
}
|
||||
},50)
|
||||
});
|
||||
}
|
||||
|
||||
function subscribeMediaSubscriptionsSpotifyAdd(id: string): void {
|
||||
on({id: [id + '.DURATION',
|
||||
id + '.ELAPSED'], change: "any"}, async function () {
|
||||
on({id: [id + '.ELAPSED'], change: "any"}, async function () {
|
||||
(function () { if (timeoutMedia) { clearTimeout(timeoutMedia); timeoutMedia = null; } })();
|
||||
timeoutMedia = setTimeout(async function () {
|
||||
if (useMediaEvents) {
|
||||
@@ -4978,13 +4961,6 @@ async function createAutoMediaAlias (id: string, mediaDevice: string, adapterPla
|
||||
log('error at function createAutoMediaAlias Adapter spotify-premium: ' + err.message, 'warn');
|
||||
}
|
||||
}
|
||||
//Add Spotify Datapoints > v4.3.3.42
|
||||
//Spotify-Premium has Role value and a known Bug in player.progress
|
||||
if (existsObject(id + '.DURATION') == false) {
|
||||
const dpPath: string = adapterPlayerInstance;
|
||||
await createAliasAsync(id + '.DURATION', dpPath + 'player.duration', true, <iobJS.StateCommon> {type: 'string', role: 'media.duration.text', name: 'DURATION'});
|
||||
await createAliasAsync(id + '.ELAPSED', dpPath + 'player.progress', true, <iobJS.StateCommon> {type: 'string', role: 'media.elapsed.text', name: 'ELAPSED'});
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
@@ -5150,8 +5126,6 @@ function GenerateMediaPage(page: NSPanel.PageMedia): NSPanel.Payload[] {
|
||||
subscribeMediaSubscriptionsBoseAdd(page.items[0].id);
|
||||
} else if (v2Adapter == 'squeezeboxrpc') {
|
||||
subscribeMediaSubscriptionsSqueezeboxAdd(page.items[0].id);
|
||||
} else if (v2Adapter == 'spotify-premium') {
|
||||
subscribeMediaSubscriptionsSpotifyAdd(page.items[0].id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5167,8 +5141,6 @@ function GenerateMediaPage(page: NSPanel.PageMedia): NSPanel.Payload[] {
|
||||
subscribeMediaSubscriptionsBoseAdd(page.items[0].id);
|
||||
} else if (v2Adapter == 'squeezeboxrpc') {
|
||||
subscribeMediaSubscriptionsSqueezeboxAdd(page.items[0].id);
|
||||
} else if (v2Adapter == 'spotify-premium') {
|
||||
subscribeMediaSubscriptionsSpotifyAdd(page.items[0].id);
|
||||
}
|
||||
} else if (page.type == 'cardMedia' && pageCounter == -1) {
|
||||
//Do Nothing
|
||||
@@ -5179,8 +5151,8 @@ function GenerateMediaPage(page: NSPanel.PageMedia): NSPanel.Payload[] {
|
||||
if (existsObject(id)) {
|
||||
let name = getState(id + '.ALBUM').val;
|
||||
let title = getState(id + '.TITLE').val;
|
||||
if (title.length > 26) {
|
||||
title = title.slice(0, 26) + '...';
|
||||
if (title.length > 27) {
|
||||
title = title.slice(0, 27) + '...';
|
||||
}
|
||||
if (existsObject(id + '.DURATION') && existsObject(id + '.ELAPSED')) {
|
||||
if (v2Adapter == 'alexa2') {
|
||||
@@ -5201,15 +5173,8 @@ function GenerateMediaPage(page: NSPanel.PageMedia): NSPanel.Payload[] {
|
||||
if(parseInt(vDuration.slice(0,2)) < 9) {
|
||||
vDuration = vDuration.slice(1);
|
||||
}
|
||||
}
|
||||
if (vDuration != '0:00') {
|
||||
title = title + ' (' + vElapsed + '|' + vDuration + ')';
|
||||
} else {
|
||||
title = title + ' (' + vElapsed + ')';
|
||||
}
|
||||
if (title == ' (0:00)') {
|
||||
title = '';
|
||||
}
|
||||
}
|
||||
title = title + ' (' + vElapsed + '|' + vDuration + ')';
|
||||
} else if (v2Adapter == 'sonos' && getState(page.items[0].adapterPlayerInstance + 'root.' + page.items[0].mediaDevice + '.current_type').val == 0) {
|
||||
let vElapsed = getState(id + '.ELAPSED').val;
|
||||
if (vElapsed.length == 5) {
|
||||
@@ -5265,24 +5230,6 @@ function GenerateMediaPage(page: NSPanel.PageMedia): NSPanel.Payload[] {
|
||||
}
|
||||
}
|
||||
|
||||
// Settings >>Aktualisierungsintervall für Statusinformationen<< = 1 !
|
||||
// If the refresh time is set to 1 second in the spotify-premium.X instance,
|
||||
// the elapsed refresh bug '00:00' is not visible
|
||||
if (v2Adapter == 'spotify-premium') {
|
||||
let vElapsed: string = getState(id + '.ELAPSED').val;
|
||||
if (vElapsed.substring(0,1) == '0') {
|
||||
vElapsed = vElapsed.slice(1)
|
||||
}
|
||||
let vDuration: string = getState(id + '.DURATION').val;
|
||||
if (vDuration.substring(0,1) == '0') {
|
||||
vDuration = vDuration.slice(1)
|
||||
}
|
||||
title = title + ' (' + vElapsed + '|' + vDuration + ')';
|
||||
if (title == ' (0:00|0:00)') {
|
||||
title = '';
|
||||
}
|
||||
}
|
||||
|
||||
let shuffle = getState(id + '.SHUFFLE').val;
|
||||
|
||||
//New Adapter/Player
|
||||
@@ -5356,10 +5303,9 @@ function GenerateMediaPage(page: NSPanel.PageMedia): NSPanel.Payload[] {
|
||||
//Logitech Squeezebox RPC
|
||||
if (v2Adapter == 'squeezeboxrpc') {
|
||||
media_icon = Icons.GetIcon('dlna');
|
||||
if (name.length == 0) {
|
||||
name = page.heading;
|
||||
} else if (name.length > 16) {
|
||||
name = name.slice(0,16) + '...'
|
||||
let nameLength = name.length;
|
||||
if (nameLength == 0) {
|
||||
name = page.items[0].mediaDevice;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5377,8 +5323,6 @@ function GenerateMediaPage(page: NSPanel.PageMedia): NSPanel.Payload[] {
|
||||
}
|
||||
if (nameLength == 0) {
|
||||
name = 'Alexa Player';
|
||||
} else {
|
||||
name = name.slice(0,16) + '...';
|
||||
}
|
||||
author = getState(id + '.ARTIST').val + ' | ' + getState(id + '.ALBUM').val;
|
||||
if (author.length > 30) {
|
||||
@@ -5758,7 +5702,6 @@ function GenerateMediaPage(page: NSPanel.PageMedia): NSPanel.Payload[] {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function createAutoAlarmAlias (id: string, nsPath: string){
|
||||
try {
|
||||
if (Debug){
|
||||
@@ -8896,10 +8839,9 @@ function HandleScreensaverUpdate(): void {
|
||||
iconColor + '~' +
|
||||
config.bottomScreensaverEntity[4].ScreensaverEntityText + '~' +
|
||||
val
|
||||
} // Ende zusätzlichen Status Alternativ Layout
|
||||
}
|
||||
|
||||
} else {
|
||||
// USER definierte Bottom Entities
|
||||
let checkpoint = true;
|
||||
let i = 0;
|
||||
for (i = 0; i < maxEntities - 1 && i < config.bottomScreensaverEntity.length; i++) {
|
||||
@@ -8953,7 +8895,7 @@ function HandleScreensaverUpdate(): void {
|
||||
}
|
||||
}
|
||||
|
||||
const temp = config.bottomScreensaverEntity[i].ScreensaverEntityIconColor
|
||||
const temp = config.bottomScreensaverEntity[4].ScreensaverEntityIconColor
|
||||
if (temp && typeof temp == 'string' && existsObject(temp)) {
|
||||
iconColor = getState(temp).val;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user