This commit is contained in:
Home Assistant Version Control
2026-10-04 20:48:28 +00:00
parent 0ff8c287a8
commit dc8f284e00
5 changed files with 31 additions and 18 deletions
+1 -1
View File
@@ -1 +1 @@
{"pid": 72, "version": 1, "ha_version": "2026.9.4", "start_ts": 1791119416.803484}
{"pid": 71, "version": 1, "ha_version": "2026.9.4", "start_ts": 1791146884.4391842}
+1 -1
View File
@@ -256,7 +256,7 @@
},
{
"id": "8713ea9c008e4270bb28085eed5be959",
"url": "/hacsfiles/Statistics-Graph-Chart-Card/statistics-graph-chart-card.js?hacstag=1034932856403",
"url": "/hacsfiles/Statistics-Graph-Chart-Card/statistics-graph-chart-card.js?hacstag=1034932856404",
"type": "module"
},
{
@@ -8,5 +8,5 @@
"iot_class": "local_push",
"issue_tracker": "https://github.com/Patafoin/ha-my-music-library/issues",
"requirements": ["music-assistant-client>=1.3.3,<2"],
"version": "4.8.2"
"version": "4.8.4"
}
@@ -5,7 +5,7 @@
* @version 1.0.0
*/
const CARD_VERSION = "4.8.2";
const CARD_VERSION = "4.8.4";
/* ─── Icons (inline SVG strings) ─────────────────────────── */
const ICONS = {
@@ -2327,6 +2327,7 @@ class MyMusicLibraryCard extends HTMLElement {
this._progressInterval = null;
this._localPosition = null;
this._localPositionTime = null;
this._localPositionKey = null; // player + track the seek override belongs to
this._maQueueItems = [];
this._maQueueId = null; // MA queue_id of the active player, from the last ma_queue load
this._queueLoadSeq = 0; // drops out-of-order ma_queue responses
@@ -3565,6 +3566,16 @@ class MyMusicLibraryCard extends HTMLElement {
const dur = attr.media_duration || 0;
const isPlaying = state?.state === "playing";
// The seek override only bridges the gap until HA reports the new position: drop it
// on another track or player, or once a position report newer than the seek arrives.
if (this._localPosition !== null) {
const posUpdated = attr.media_position_updated_at;
if (this._localPositionKey !== `${this._activePlayer}|${attr.media_content_id}`
|| (posUpdated && new Date(posUpdated).getTime() / 1000 > this._localPositionTime + 1)) {
this._localPosition = null;
}
}
let pos;
if (isPlaying && this._localPosition !== null) {
const elapsed = Date.now() / 1000 - this._localPositionTime;
@@ -3583,7 +3594,8 @@ class MyMusicLibraryCard extends HTMLElement {
this._localPosition = null;
}
pos = Math.min(pos || 0, dur);
// never below 0: a device clock a bit behind HA's puts media_position_updated_at in the future
pos = Math.max(0, Math.min(pos || 0, dur));
const pct = dur > 0 ? (pos / dur) * 100 : 0;
if (!this._seekDragging) {
@@ -3693,6 +3705,7 @@ class MyMusicLibraryCard extends HTMLElement {
this._callService("media_seek", { seek_position: Math.round(pos) });
this._localPosition = pos;
this._localPositionTime = Date.now() / 1000;
this._localPositionKey = `${this._activePlayer}|${state.attributes.media_content_id}`;
};
progressBar.addEventListener("pointerup", endSeekDrag);
progressBar.addEventListener("pointercancel", () => {
+13 -13
View File
@@ -22,15 +22,15 @@
},
"0xffffb40e0607af27": {
"state": "ON",
"voltage": 119,
"voltage": 118.8,
"ac_frequency": 60,
"led_brightness": 100,
"countdown_to_turn_off": 0,
"countdown_to_turn_on": 0,
"power": 1.9,
"power": 2.2,
"current": 0.09,
"energy": 51.83,
"power_factor": 0.17,
"power_factor": 0.18,
"update": {
"state": "idle",
"installed_version": 268513381,
@@ -58,7 +58,7 @@
"latest_release_notes": null
},
"linkquality": 145,
"power": 86.9,
"power": 85.2,
"current": 0.83,
"power_on_behavior": "on"
},
@@ -74,13 +74,13 @@
"led_brightness": 100,
"countdown_to_turn_off": 0,
"countdown_to_turn_on": 0,
"voltage": 117.6,
"voltage": 117.3,
"state": "ON",
"ac_frequency": 60,
"energy": 203.95,
"power": 0.8,
"current": 0.07,
"power_factor": 0.39,
"power": 101.9,
"current": 0.92,
"power_factor": 0.94,
"update": {
"state": "idle",
"installed_version": 268513381,
@@ -98,10 +98,10 @@
"voltage": 118.9,
"energy": 98.26,
"state": "ON",
"power": 26.7,
"power": 29.8,
"current": 0.27,
"ac_frequency": 60,
"power_factor": 0.81,
"power_factor": 0.75,
"update": {
"state": "idle",
"installed_version": 268513381,
@@ -114,12 +114,12 @@
},
"0xffffb40e060895b3": {
"state": "ON",
"voltage": 119,
"voltage": 118.5,
"ac_frequency": 60,
"energy": 13.83,
"current": 0.01,
"power": 0.1,
"power_factor": 0.22,
"power_factor": 0.11,
"linkquality": 116,
"update": {
"state": "idle",
@@ -143,7 +143,7 @@
"current": 0.02,
"ac_frequency": 60,
"power": 0.4,
"power_factor": 0.2,
"power_factor": 0.14,
"update": {
"state": "idle",
"installed_version": 268513381,