Merge branch 'rc'

This commit is contained in:
Bram Kragten 2025-07-18 10:32:20 +02:00
commit a885c7e358
8 changed files with 47 additions and 21 deletions

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "home-assistant-frontend"
version = "20250702.2"
version = "20250702.3"
license = "Apache-2.0"
license-files = ["LICENSE*"]
description = "The Home Assistant frontend"

View File

@ -106,6 +106,8 @@ export class StatisticsChart extends LitElement {
private _computedStyle?: CSSStyleDeclaration;
private _previousYAxisLabelValue = 0;
protected shouldUpdate(changedProps: PropertyValues): boolean {
return changedProps.size > 1 || !changedProps.has("hass");
}
@ -314,6 +316,9 @@ export class StatisticsChart extends LitElement {
splitLine: {
show: true,
},
axisLabel: {
formatter: this._formatYAxisLabel,
} as any,
},
legend: {
type: "custom",
@ -640,6 +645,22 @@ export class StatisticsChart extends LitElement {
return Math.abs(value) < 1 ? value : roundingFn(value);
}
private _formatYAxisLabel = (value: number) => {
// show the first significant digit for tiny values
const maximumFractionDigits = Math.max(
1,
// use the difference to the previous value to determine the number of significant digits #25526
-Math.floor(
Math.log10(Math.abs(value - this._previousYAxisLabelValue || 1))
)
);
const label = formatNumber(value, this.hass.locale, {
maximumFractionDigits,
});
this._previousYAxisLabelValue = value;
return label;
};
static styles = css`
:host {
display: block;

View File

@ -212,7 +212,10 @@ class StepFlowCreateEntry extends LitElement {
entityIds.push(...entities.map((entity) => entity.entity_id));
});
const entityIdsMapping = getAutomaticEntityIds(this.hass, entityIds);
const entityIdsMapping = await getAutomaticEntityIds(
this.hass,
entityIds
);
Object.entries(entityIdsMapping).forEach(([oldEntityId, newEntityId]) => {
if (newEntityId) {

View File

@ -74,6 +74,7 @@ import type {
UpdateEntityRegistryEntryResult,
} from "../../../data/entity_registry";
import {
entityRegistryByEntityId,
subscribeEntityRegistry,
updateEntityRegistryEntry,
} from "../../../data/entity_registry";
@ -520,9 +521,8 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
: true
)
.map((item) => {
const entityRegEntry = entityReg.find(
(reg) => reg.entity_id === item.entity_id
);
const entityRegEntry =
entityRegistryByEntityId(entityReg)[item.entity_id];
const labels = labelReg && entityRegEntry?.labels;
const category = entityRegEntry?.categories.helpers;
return {
@ -547,7 +547,7 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
private _labelsForEntity(entityId: string): string[] {
return (
this.hass.entities[entityId]?.labels ||
this._entityReg.find((e) => e.entity_id === entityId)?.labels ||
entityRegistryByEntityId(this._entityReg)[entityId]?.labels ||
[]
);
}
@ -885,9 +885,9 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
const labelItems = new Set<string>();
this._stateItems
.filter((stateItem) =>
this._entityReg
.find((reg) => reg.entity_id === stateItem.entity_id)
?.labels.some((lbl) => filter.includes(lbl))
entityRegistryByEntityId(this._entityReg)[
stateItem.entity_id
]?.labels.some((lbl) => filter.includes(lbl))
)
.forEach((stateItem) => labelItems.add(stateItem.entity_id));
(this._disabledEntityEntries || [])
@ -913,9 +913,8 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
.filter(
(stateItem) =>
filter[0] ===
this._entityReg.find(
(reg) => reg.entity_id === stateItem.entity_id
)?.categories.helpers
entityRegistryByEntityId(this._entityReg)[stateItem.entity_id]
?.categories.helpers
)
.forEach((stateItem) => categoryItems.add(stateItem.entity_id));
(this._disabledEntityEntries || [])
@ -943,9 +942,9 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
}
private _editCategory(helper: any) {
const entityReg = this._entityReg.find(
(reg) => reg.entity_id === helper.entity_id
);
const entityReg = entityRegistryByEntityId(this._entityReg)[
helper.entity_id
];
if (!entityReg) {
showAlertDialog(this, {
title: this.hass.localize(

View File

@ -115,9 +115,7 @@ class HaConfigEntryDeviceRow extends LitElement {
: nothing}
${entities.length
? html`
<ha-md-menu-item
href=${`/config/entities/?historyBack=1&device=${device.id}`}
>
<ha-md-menu-item @click=${this._handleNavigateToEntities}>
<ha-svg-icon
.path=${mdiShapeOutline}
slot="start"
@ -187,6 +185,10 @@ class HaConfigEntryDeviceRow extends LitElement {
});
}
private _handleNavigateToEntities() {
navigate(`/config/entities/?historyBack=1&device=${this.device.id}`);
}
private async _handleDisableDevice() {
const disable = this.device.disabled_by === null;

View File

@ -134,7 +134,7 @@ class ZHADeviceCard extends SubscribeMixin(LitElement) {
}
const entities = this._deviceEntities(device.device_reg_id, this._entities);
const entityIdsMapping = getAutomaticEntityIds(
const entityIdsMapping = await getAutomaticEntityIds(
this.hass,
entities.map((entity) => entity.entity_id)
);

View File

@ -878,7 +878,7 @@ class DialogZWaveJSAddNode extends SubscribeMixin(LitElement) {
(entity) => entity.device_id === this._device!.id
);
const entityIdsMapping = getAutomaticEntityIds(
const entityIdsMapping = await getAutomaticEntityIds(
this.hass,
entities.map((entity) => entity.entity_id)
);

View File

@ -323,7 +323,7 @@ class DialogZWaveJSRemoveNode extends LitElement {
this._subscribed.then((unsub) => unsub && unsub());
this._subscribed = undefined;
}
if (this._step === "exclusion") {
if (this._step === "exclusion" && this._entryId) {
this._stopExclusion();
}
if (this._removeNodeTimeoutHandle) {
@ -332,6 +332,7 @@ class DialogZWaveJSRemoveNode extends LitElement {
};
public closeDialog(): void {
this._unsubscribe();
this._entryId = undefined;
}