mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-21 21:54:46 +01:00
Compare commits
7 Commits
5ff3a25b2f
...
1c896da331
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c896da331 | ||
|
|
16673df8cf | ||
|
|
cb4c26acfd | ||
|
|
fda7ca4574 | ||
|
|
8e2e8d1e82 | ||
|
|
4e36f47774 | ||
|
|
858dac73d0 |
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -58,5 +58,5 @@ _If applicable, add screenshots/pictures to help explain your problem._
|
||||
_Add any other context about the problem here._
|
||||
_Please note here in case you are using ioBroker_
|
||||
|
||||
### PANEL / FIRMWARE VERION
|
||||
### PANEL / FIRMWARE VERSION
|
||||
_Please add the Panel/Firmware Version you are using (EU, US-L or US-P)_
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/feature-request.md
vendored
2
.github/ISSUE_TEMPLATE/feature-request.md
vendored
@@ -24,5 +24,5 @@ _A clear and concise description of what the feature should do._
|
||||
### ADDITIONAL CONTEXT
|
||||
_Add any other context about the problem here._
|
||||
|
||||
### PANEL / FIRMWARE VERION
|
||||
### PANEL / FIRMWARE VERSION
|
||||
_Please add the Panel/Firmware Version you are using (EU, US-L or US-P)_
|
||||
|
||||
@@ -116,6 +116,7 @@ ReleaseNotes:
|
||||
- 09.02.2024 - v4.3.3.42 Spotify Media-Player: Dynamic loading of the speaker list, playlist, tracklist, fix repeat, add seek, add elapsed/duration
|
||||
- 10.02.2024 - v4.3.3.42 Spotify Minor Fixes; Add miValue / maxValue to Volume-Slider
|
||||
- 10.02.2024 - v4.3.3.43 Fix: cardGrid2 => 9 Entities for Layout 'us-p' issue #1167
|
||||
- 11.02.2024 - v4.3.3.43 Fix VolumeSlider
|
||||
|
||||
Todo:
|
||||
- XX.XX.XXXX - v5.0.0 Change the bottomScreensaverEntity (rolling) if more than 6 entries are defined
|
||||
@@ -4768,97 +4769,25 @@ function unsubscribeMediaSubscriptions(): void {
|
||||
|
||||
function subscribeMediaSubscriptions(id: string): void {
|
||||
on({id: [id + '.STATE',
|
||||
id + '.VOLUME',
|
||||
id + '.ARTIST',
|
||||
id + '.ALBUM',
|
||||
id + '.TITLE',
|
||||
id + '.ALBUM',
|
||||
id + '.VOLUME',
|
||||
id + '.REPEAT',
|
||||
id + '.SHUFFLE'], change: "any"}, async function () {
|
||||
(function () { if (timeoutMedia) { clearTimeout(timeoutMedia); timeoutMedia = null; } })();
|
||||
timeoutMedia = setTimeout(async function () {
|
||||
if (useMediaEvents) {
|
||||
GeneratePage(activePage!);
|
||||
setTimeout(async function () {
|
||||
GeneratePage(activePage!);
|
||||
}, 1500);
|
||||
}
|
||||
},50)
|
||||
id + '.SHUFFLE',
|
||||
id + '.DURATION',
|
||||
id + '.ELAPSED'], change: "any", ack: true}, async function () {
|
||||
if (useMediaEvents && pageCounter == 1) {
|
||||
GeneratePage(activePage!);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function subscribeMediaSubscriptionsSonosAdd(id: string): void {
|
||||
on({id: [id + '.QUEUE',
|
||||
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 subscribeMediaSubscriptionsAlexaAdd(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 subscribeMediaSubscriptionsBoseAdd(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 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 () {
|
||||
(function () { if (timeoutMedia) { clearTimeout(timeoutMedia); timeoutMedia = null; } })();
|
||||
timeoutMedia = setTimeout(async function () {
|
||||
if (useMediaEvents) {
|
||||
GeneratePage(activePage!);
|
||||
setTimeout(async function () {
|
||||
GeneratePage(activePage!);
|
||||
}, 50);
|
||||
}
|
||||
},50)
|
||||
on({id: [id + '.QUEUE'], change: "any", ack: true}, async function () {
|
||||
if (useMediaEvents && pageCounter == 1) {
|
||||
GeneratePage(activePage!);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5159,14 +5088,7 @@ function GenerateMediaPage(page: NSPanel.PageMedia): NSPanel.Payload[] {
|
||||
subscribeMediaSubscriptions(page.items[0].id);
|
||||
if (v2Adapter == 'sonos') {
|
||||
subscribeMediaSubscriptionsSonosAdd(page.items[0].id);
|
||||
} else if (v2Adapter == 'alexa2') {
|
||||
subscribeMediaSubscriptionsAlexaAdd(page.items[0].id);
|
||||
} else if (v2Adapter == 'bosesoundtouch') {
|
||||
subscribeMediaSubscriptionsBoseAdd(page.items[0].id);
|
||||
} else if (v2Adapter == 'squeezeboxrpc') {
|
||||
subscribeMediaSubscriptionsSqueezeboxAdd(page.items[0].id);
|
||||
} else if (v2Adapter == 'spotify-premium') {
|
||||
subscribeMediaSubscriptionsSpotifyAdd(page.items[0].id);
|
||||
setState(vInstance + 'getDevices', true);
|
||||
setState(vInstance + 'getPlaybackInfo', true);
|
||||
setState(vInstance + 'getPlaylists', true);
|
||||
@@ -5178,15 +5100,7 @@ function GenerateMediaPage(page: NSPanel.PageMedia): NSPanel.Payload[] {
|
||||
alwaysOn = true;
|
||||
subscribeMediaSubscriptions(page.items[0].id);
|
||||
if (v2Adapter == 'sonos') {
|
||||
subscribeMediaSubscriptionsSonosAdd(page.items[0].id);
|
||||
} else if (v2Adapter == 'alexa2') {
|
||||
subscribeMediaSubscriptionsAlexaAdd(page.items[0].id);
|
||||
} else if (v2Adapter == 'bosesoundtouch') {
|
||||
subscribeMediaSubscriptionsBoseAdd(page.items[0].id);
|
||||
} else if (v2Adapter == 'squeezeboxrpc') {
|
||||
subscribeMediaSubscriptionsSqueezeboxAdd(page.items[0].id);
|
||||
} else if (v2Adapter == 'spotify-premium') {
|
||||
subscribeMediaSubscriptionsSpotifyAdd(page.items[0].id);
|
||||
subscribeMediaSubscriptionsSonosAdd(page.items[0].id);
|
||||
}
|
||||
} else if (page.type == 'cardMedia' && pageCounter == -1) {
|
||||
//Do Nothing
|
||||
@@ -5794,8 +5708,6 @@ function GenerateMediaPage(page: NSPanel.PageMedia): NSPanel.Payload[] {
|
||||
if (Debug) {
|
||||
log('GenerateMediaPage payload: ' + JSON.stringify(out_msgs), 'info');
|
||||
}
|
||||
if (Debug) log(JSON.stringify(out_msgs).length);
|
||||
if (Debug) log('GenerateMediaPage payload: ' + JSON.stringify(out_msgs), 'info');
|
||||
return out_msgs
|
||||
} catch (err: any) {
|
||||
log('error at function GenerateMediaPage: ' + err.message, 'warn');
|
||||
@@ -6723,8 +6635,8 @@ function HandleButtonEvent(words: any): void {
|
||||
|
||||
switch (deviceAdapterRP) {
|
||||
case 'spotify-premium':
|
||||
log(getState(id + '.REPEAT').val)
|
||||
let stateSpotifyRepeat = getState(id + '.REPEAT').val
|
||||
if (Debug) log(getState(id + '.REPEAT').val);
|
||||
let stateSpotifyRepeat = getState(id + '.REPEAT').val;
|
||||
if (stateSpotifyRepeat == 'off') {
|
||||
setIfExists(id + '.REPEAT', 'context');
|
||||
} else if (stateSpotifyRepeat == 'context') {
|
||||
@@ -6736,7 +6648,7 @@ function HandleButtonEvent(words: any): void {
|
||||
break;
|
||||
case 'bosesoundtouch':
|
||||
if (Debug) log(adapterInstanceRepeat);
|
||||
let stateBoseRepeat = getState(id + '.REPEAT').val
|
||||
let stateBoseRepeat = getState(id + '.REPEAT').val;
|
||||
if (stateBoseRepeat == 'REPEAT_OFF') {
|
||||
setIfExists(adapterInstanceRepeat + 'key', 'REPEAT_ALL');
|
||||
} else if (stateBoseRepeat == 'REPEAT_ALL') {
|
||||
@@ -6747,7 +6659,7 @@ function HandleButtonEvent(words: any): void {
|
||||
GeneratePage(activePage!);
|
||||
break;
|
||||
case 'sonos':
|
||||
let stateSonosRepeat = getState(id + '.REPEAT').val
|
||||
let stateSonosRepeat = getState(id + '.REPEAT').val;
|
||||
if (stateSonosRepeat == 0) {
|
||||
setIfExists(id + '.REPEAT', 1);
|
||||
} else if (stateSonosRepeat == 1) {
|
||||
@@ -7046,16 +6958,11 @@ function HandleButtonEvent(words: any): void {
|
||||
break;
|
||||
}
|
||||
case 'volumeSlider':
|
||||
pageCounter = -1;
|
||||
(function () { if (timeoutSlider) { clearTimeout(timeoutSlider); timeoutSlider = null; } })();
|
||||
timeoutSlider = setTimeout(async function () {
|
||||
setTimeout(async function () {
|
||||
let vVolume = scale(parseInt(words[4]), 100, 0, activePage.items[0].minValue ?? 0, activePage.items[0].maxValue ?? 100);
|
||||
setIfExists(id + '.VOLUME', Math.floor(vVolume));
|
||||
pageCounter = 1;
|
||||
GeneratePage(activePage!);
|
||||
}, 10);
|
||||
}, 50);
|
||||
subscribeMediaSubscriptions(id);
|
||||
useMediaEvents = true;
|
||||
pageCounter = 1;
|
||||
let vVolume = scale(parseInt(words[4]), 100, 0, activePage.items[0].minValue ?? 0, activePage.items[0].maxValue ?? 100);
|
||||
setIfExists(id + '.VOLUME', Math.floor(vVolume));
|
||||
break;
|
||||
case 'mode-speakerlist':
|
||||
let pageItem = findPageItem(id);
|
||||
@@ -8967,7 +8874,7 @@ function HandleScreensaverUpdate(): void {
|
||||
val = parseFloat(val);
|
||||
}
|
||||
let iconColor = rgb_dec565(White);
|
||||
let icon;
|
||||
let icon;
|
||||
if (config.bottomScreensaverEntity[i].ScreensaverEntityIconOn && existsObject(config.bottomScreensaverEntity[i].ScreensaverEntityIconOn!)) {
|
||||
let iconName = getState(config.bottomScreensaverEntity[i].ScreensaverEntityIconOn!).val;
|
||||
icon = Icons.GetIcon(iconName);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
|
||||
name: NSPanel Lovelace UI Addon
|
||||
version: "4.7.78"
|
||||
version: "4.7.80"
|
||||
slug: nspanel-lovelace-ui
|
||||
description: NSPanel Lovelace UI Addon
|
||||
services:
|
||||
|
||||
@@ -209,11 +209,11 @@ class HAEntity(panel_cards.Entity):
|
||||
forecast = libs.home_assistant.execute_script(
|
||||
entity_name=self.entity_id,
|
||||
domain='weather',
|
||||
service="get_forecast",
|
||||
service="get_forecasts",
|
||||
service_data={
|
||||
'type': forecast_type
|
||||
}
|
||||
).get("forecast", [])
|
||||
).get(self.entity_id,{}).get("forecast", [])
|
||||
if len(forecast) > pos:
|
||||
forcast_pos = forecast[pos]
|
||||
forcast_condition = forcast_pos.get("condition", "")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
paho-mqtt
|
||||
paho-mqtt==1.6.1
|
||||
pyyaml
|
||||
websockets
|
||||
websocket-client
|
||||
@@ -7,4 +7,4 @@ python-dateutil
|
||||
scheduler
|
||||
babel
|
||||
watchdog
|
||||
jinja2
|
||||
jinja2
|
||||
|
||||
Reference in New Issue
Block a user