Skip to content

Commit 77910f3

Browse files
committed
fix: add support for HA 2026.2
1 parent ae6a94d commit 77910f3

File tree

6 files changed

+34
-41
lines changed

6 files changed

+34
-41
lines changed

src/sections/grouping.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class Grouping extends LitElement {
6060
<div
6161
class="item"
6262
modified=${item.isModified || nothing}
63-
disabled=${(item.isDisabled || this.applying) || nothing}
63+
disabled=${item.isDisabled || this.applying || nothing}
6464
compact=${this.groupingConfig.compact || nothing}
6565
>
6666
<ha-icon

src/sections/media-browser.ts

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,8 @@ export class MediaBrowser extends LitElement {
9090
localStorage.setItem(LAYOUT_KEY, layout);
9191
}
9292

93-
private handleMenuAction = (ev: CustomEvent<{ index: number }>) => {
94-
const layouts: LayoutType[] = ['auto', 'grid', 'list'];
95-
this.setLayout(layouts[ev.detail.index]);
93+
private handleMenuAction = (ev: CustomEvent<{ item: { value: string } }>) => {
94+
this.setLayout(ev.detail.item.value as LayoutType);
9695
};
9796

9897
private getStartPath(): string | null {
@@ -255,29 +254,21 @@ export class MediaBrowser extends LitElement {
255254

256255
private renderLayoutMenu() {
257256
return html`
258-
<ha-button-menu fixed corner="BOTTOM_END" @action=${this.handleMenuAction}>
257+
<ha-dropdown @wa-select=${this.handleMenuAction}>
259258
<ha-icon-button slot="trigger" .path=${mdiDotsVertical}></ha-icon-button>
260-
<ha-list-item graphic="icon">
259+
<ha-dropdown-item value="auto" .selected=${this.layout === 'auto'}>
260+
<ha-svg-icon slot="icon" .path=${mdiAlphaABoxOutline}></ha-svg-icon>
261261
Auto
262-
<ha-svg-icon
263-
class=${this.layout === 'auto' ? 'selected' : ''}
264-
slot="graphic"
265-
.path=${mdiAlphaABoxOutline}
266-
></ha-svg-icon>
267-
</ha-list-item>
268-
<ha-list-item graphic="icon">
262+
</ha-dropdown-item>
263+
<ha-dropdown-item value="grid" .selected=${this.layout === 'grid'}>
264+
<ha-svg-icon slot="icon" .path=${mdiGrid}></ha-svg-icon>
269265
Grid
270-
<ha-svg-icon class=${this.layout === 'grid' ? 'selected' : ''} slot="graphic" .path=${mdiGrid}></ha-svg-icon>
271-
</ha-list-item>
272-
<ha-list-item graphic="icon">
266+
</ha-dropdown-item>
267+
<ha-dropdown-item value="list" .selected=${this.layout === 'list'}>
268+
<ha-svg-icon slot="icon" .path=${mdiListBoxOutline}></ha-svg-icon>
273269
List
274-
<ha-svg-icon
275-
class=${this.layout === 'list' ? 'selected' : ''}
276-
slot="graphic"
277-
.path=${mdiListBoxOutline}
278-
></ha-svg-icon>
279-
</ha-list-item>
280-
</ha-button-menu>
270+
</ha-dropdown-item>
271+
</ha-dropdown>
281272
`;
282273
}
283274

@@ -504,9 +495,6 @@ export class MediaBrowser extends LitElement {
504495
text-align: center;
505496
margin-top: 50%;
506497
}
507-
ha-svg-icon.selected {
508-
color: var(--primary-color);
509-
}
510498
ha-icon-button.startpath-active {
511499
color: var(--accent-color);
512500
}

src/upstream/.upstream-version

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
20260107.2
2-
Reviewed: 2026-01-29 21:28:02 UTC
3-
Note: Only change was import path entity->entity/entity, handled by our stub
1+
20260128.6
2+
Reviewed: 2026-02-15
3+
Changes applied:
4+
- brands-url.ts: Removed useFallback option, URL now always uses fallback path (_/)
5+
- data/media-player.ts: formatMediaTime rewritten to use plain math instead of Date.toISOString()
6+
- ha-media-player-browse.ts: Removed useFallback property from brandsUrl call (matching upstream removal)
7+
- No changes in: slugify.ts, media_source.ts, virtualizer.ts

src/upstream/data/media-player.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,12 +424,17 @@ export const formatMediaTime = (seconds: number | undefined): string => {
424424
return "";
425425
}
426426

427-
let secondsString = new Date(seconds * 1000).toISOString();
428-
secondsString =
429-
seconds > 3600
430-
? secondsString.substring(11, 16)
431-
: secondsString.substring(14, 19);
432-
return secondsString.replace(/^0+/, "").padStart(4, "0");
427+
const totalSeconds = Math.max(0, Math.floor(seconds));
428+
const hours = Math.floor(totalSeconds / 3600);
429+
const minutes = Math.floor((totalSeconds % 3600) / 60);
430+
const secs = totalSeconds % 60;
431+
const pad = (value: number) => value.toString().padStart(2, "0");
432+
433+
if (hours > 0) {
434+
return `${pad(hours)}:${pad(minutes)}:${pad(secs)}`;
435+
}
436+
437+
return `${pad(minutes)}:${pad(secs)}`;
433438
};
434439

435440
export const cleanupMediaTitle = (title?: string): string | undefined => {

src/upstream/ha-media-player-browse.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,6 @@ export class HaMediaPlayerBrowse extends LitElement {
691691
thumbnailUrl = brandsUrl({
692692
domain: extractDomainFromBrandUrl(thumbnailUrl),
693693
type: 'icon',
694-
useFallback: true,
695694
darkOptimized: this.hass.themes?.darkMode,
696695
});
697696
}

src/upstream/util/brands-url.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ import type { HomeAssistant } from 'custom-card-helpers';
44
export interface BrandsUrlOptions {
55
domain: string;
66
type: string;
7-
useFallback?: boolean;
87
darkOptimized?: boolean;
98
}
109

11-
export const brandsUrl = (options: BrandsUrlOptions): string => {
12-
const { domain, type, useFallback = true, darkOptimized = false } = options;
13-
return `https://brands.home-assistant.io/${useFallback ? '_/' : ''}${domain}/${darkOptimized ? 'dark_' : ''}${type}.png`;
14-
};
10+
export const brandsUrl = (options: BrandsUrlOptions): string =>
11+
`https://brands.home-assistant.io/_/${options.domain}/${options.darkOptimized ? 'dark_' : ''}${options.type}.png`;
1512

1613
export const isBrandUrl = (url?: string): boolean => {
1714
return url?.startsWith('https://brands.home-assistant.io/') ?? false;

0 commit comments

Comments
 (0)