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] [project]
name = "home-assistant-frontend" name = "home-assistant-frontend"
version = "20250702.2" version = "20250702.3"
license = "Apache-2.0" license = "Apache-2.0"
license-files = ["LICENSE*"] license-files = ["LICENSE*"]
description = "The Home Assistant frontend" description = "The Home Assistant frontend"

View File

@ -106,6 +106,8 @@ export class StatisticsChart extends LitElement {
private _computedStyle?: CSSStyleDeclaration; private _computedStyle?: CSSStyleDeclaration;
private _previousYAxisLabelValue = 0;
protected shouldUpdate(changedProps: PropertyValues): boolean { protected shouldUpdate(changedProps: PropertyValues): boolean {
return changedProps.size > 1 || !changedProps.has("hass"); return changedProps.size > 1 || !changedProps.has("hass");
} }
@ -314,6 +316,9 @@ export class StatisticsChart extends LitElement {
splitLine: { splitLine: {
show: true, show: true,
}, },
axisLabel: {
formatter: this._formatYAxisLabel,
} as any,
}, },
legend: { legend: {
type: "custom", type: "custom",
@ -640,6 +645,22 @@ export class StatisticsChart extends LitElement {
return Math.abs(value) < 1 ? value : roundingFn(value); 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` static styles = css`
:host { :host {
display: block; display: block;

View File

@ -212,7 +212,10 @@ class StepFlowCreateEntry extends LitElement {
entityIds.push(...entities.map((entity) => entity.entity_id)); 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]) => { Object.entries(entityIdsMapping).forEach(([oldEntityId, newEntityId]) => {
if (newEntityId) { if (newEntityId) {

View File

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

View File

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

View File

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

View File

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