Compare commits

..

6 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
88b53755ef [WIP] Investigating energy pie chart displaying 0 kWh total issue
Co-authored-by: MindFreeze <5219205+MindFreeze@users.noreply.github.com>
2025-11-24 10:31:07 +00:00
copilot-swe-agent[bot]
b090ba6e8e Refactor total calculation to avoid duplicate type assertions
Extracted the type cast to a variable for better readability and to avoid duplication.

Addresses code review feedback.

Co-authored-by: MindFreeze <5219205+MindFreeze@users.noreply.github.com>
2025-11-24 09:55:56 +00:00
copilot-swe-agent[bot]
60142cde59 Add JSDoc documentation for EnergyDeviceDataItem interface
Added detailed documentation explaining the purpose and structure of the interface, including the tuple value format used for chart data.

Addresses code review feedback.

Co-authored-by: MindFreeze <5219205+MindFreeze@users.noreply.github.com>
2025-11-24 09:54:34 +00:00
copilot-swe-agent[bot]
95691a859b Add proper type definition for energy device data items
Replaced `any` type with proper `EnergyDeviceDataItem` interface for better type safety while maintaining correct runtime behavior.

Addresses code review feedback.

Co-authored-by: MindFreeze <5219205+MindFreeze@users.noreply.github.com>
2025-11-24 09:53:06 +00:00
copilot-swe-agent[bot]
a2a5d68f3f Fix energy pie chart total calculation showing 0 instead of actual total
The issue was caused by incorrect type assertion when accessing array values.
Changed from `(d as PieDataItemOption).value![0]` to `(d as any).value[0]`
to properly access the array structure at runtime.

Also fixed tooltip formatter to check value[0] instead of value for decimal precision.

Fixes #27925

Co-authored-by: MindFreeze <5219205+MindFreeze@users.noreply.github.com>
2025-11-24 09:51:20 +00:00
copilot-swe-agent[bot]
5086d1ed1a Initial plan 2025-11-24 09:37:57 +00:00
5 changed files with 2 additions and 57 deletions

View File

@@ -2,8 +2,8 @@
import { genClientId } from "home-assistant-js-websocket";
import type { PropertyValues } from "lit";
import { html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { keyed } from "lit/directives/keyed";
import { customElement, property, state } from "lit/decorators";
import type { LocalizeFunc } from "../common/translations/localize";
import "../components/ha-alert";
import "../components/ha-button";
@@ -118,9 +118,6 @@ export class HaAuthFlow extends LitElement {
display: block;
margin-top: 16px;
}
.action ha-button {
width: 100%;
}
</style>
<form>${this._renderForm()}</form>
`;

View File

@@ -188,7 +188,6 @@ export default class HaAutomationSidebar extends LitElement {
class="handle ${this._resizing ? "resizing" : ""}"
@mousedown=${this._handleMouseDown}
@touchstart=${this._handleMouseDown}
@dblclick=${this._handleDoubleClick}
@focus=${this._startKeyboardResizing}
@blur=${this._stopKeyboardResizing}
tabindex="0"
@@ -259,17 +258,6 @@ export default class HaAutomationSidebar extends LitElement {
);
};
private _handleDoubleClick = (ev: MouseEvent) => {
ev.preventDefault();
ev.stopPropagation();
this._unregisterResizeHandlers();
this._tinykeysUnsub?.();
this._tinykeysUnsub = undefined;
this._resizing = false;
document.body.style.removeProperty("cursor");
fireEvent(this, "sidebar-reset-size");
};
private _startResizing(clientX: number) {
// register event listeners for drag handling
document.addEventListener("mousemove", this._handleMouseMove);
@@ -434,6 +422,5 @@ declare global {
deltaInPx: number;
};
"sidebar-resizing-stopped": undefined;
"sidebar-reset-size": undefined;
}
}

View File

@@ -317,7 +317,6 @@ export class HaManualAutomationEditor extends LitElement {
@value-changed=${this._sidebarConfigChanged}
@sidebar-resized=${this._resizeSidebar}
@sidebar-resizing-stopped=${this._stopResizeSidebar}
@sidebar-reset-size=${this._resetSidebarWidth}
></ha-automation-sidebar>
</div>
</div>
@@ -701,16 +700,6 @@ export class HaManualAutomationEditor extends LitElement {
this._prevSidebarWidthPx = undefined;
}
private _resetSidebarWidth(ev: Event) {
ev.stopPropagation();
this._prevSidebarWidthPx = undefined;
this._sidebarWidthPx = SIDEBAR_DEFAULT_WIDTH;
this.style.setProperty(
"--sidebar-dynamic-width",
`${this._sidebarWidthPx}px`
);
}
static get styles(): CSSResultGroup {
return [
saveFabStyles,

View File

@@ -25,10 +25,6 @@ import { computeCssColor } from "../../../common/color/compute-color";
import { storage } from "../../../common/decorators/storage";
import type { HASSDomEvent } from "../../../common/dom/fire_event";
import { computeStateDomain } from "../../../common/entity/compute_state_domain";
import {
DEFAULT_ENTITY_NAME,
type EntityNameItem,
} from "../../../common/entity/compute_entity_name_display";
import { navigate } from "../../../common/navigate";
import type {
LocalizeFunc,
@@ -126,11 +122,6 @@ import {
import { getSignedPath } from "../../../data/auth";
import { fileDownload } from "../../../util/file_download";
const HELPER_ENTITY_NAME: EntityNameItem[] = [
{ type: "area" },
...DEFAULT_ENTITY_NAME,
];
interface HelperItem {
id: string;
name: string;
@@ -514,7 +505,7 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
return {
id: entityState.entity_id,
name: this._formatHelperName(entityState),
name: entityState.attributes.friendly_name || "",
entity_id: entityState.entity_id,
editable:
configEntry !== undefined || entityState.attributes.editable,
@@ -593,14 +584,6 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
}
);
private _formatHelperName(stateObj: HassEntity): string {
const formatted =
this.hass.formatEntityName(stateObj, HELPER_ENTITY_NAME) || "";
return (
formatted || stateObj.attributes.friendly_name || stateObj.entity_id || ""
);
}
private _labelsForEntity(entityId: string): string[] {
return (
this.hass.entities[entityId]?.labels ||

View File

@@ -270,7 +270,6 @@ export class HaManualScriptEditor extends LitElement {
@value-changed=${this._sidebarConfigChanged}
@sidebar-resized=${this._resizeSidebar}
@sidebar-resizing-stopped=${this._stopResizeSidebar}
@sidebar-reset-size=${this._resetSidebarWidth}
></ha-automation-sidebar>
</div>
</div>
@@ -619,16 +618,6 @@ export class HaManualScriptEditor extends LitElement {
this._prevSidebarWidthPx = undefined;
}
private _resetSidebarWidth(ev: Event) {
ev.stopPropagation();
this._prevSidebarWidthPx = undefined;
this._sidebarWidthPx = SIDEBAR_DEFAULT_WIDTH;
this.style.setProperty(
"--sidebar-dynamic-width",
`${this._sidebarWidthPx}px`
);
}
static get styles(): CSSResultGroup {
return [
saveFabStyles,