Compare commits

..
Author SHA1 Message Date
WendelinandClaude Opus 5.5 00312420d8 Remove clicking the title to enlarge the more info dialog (#56176)
Clicking the title of the more info dialog made it fill the screen, but
nothing showed that this was possible. For a camera it only added black
bars, since its info view already fits the picture. Cameras also no
longer open at the large width: their info view and the image's size the
dialog from the picture, and their other views are as wide as those of
any other entity. A large width passed by the caller still works.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-26 15:24:20 +01:00
WendelinandClaude Opus 5.5 f2116b61fc Remove two marketplace tests that only cover helpers (#56184)
Follow-up to #55130 review: the empty integration_category link test only
covered the query param decoder, and the filtersOfTab category test only
covered a spread.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-26 14:19:49 +00:00
Bram KragtenandClaude Opus 5.5 2e872965f6 Draw the slats of tilt-only covers from their state (#56173)
* Draw the slats of tilt-only covers from their state

A tilt-only cover that only reports open or closed, without a tilt
position, was always drawn with half open slats. When the cover can't
move up or down, its state describes the slats, so draw them at the
closed tilt position when closed and at the open tilt position when
open. Covers that also move up and down keep the neutral slats, as
their state describes the position.

Add tilt-only blinds, open and closed, to the cover more-info gallery.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Draw the slats from the state with the default tilt positions

Core only sends the open and closed tilt positions of covers that can
set their tilt position, so a tilt-only cover drawn from its state
always uses 0 and 100.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-26 15:19:19 +01:00
Paul Bottein cbf745f38a Fix rows value bubble cut off in the card size editor (#56181) 2026-11-26 15:02:14 +01:00
9 changed files with 117 additions and 48 deletions

No files matched your search

+26
View File
@@ -70,6 +70,32 @@ const ENTITIES = [
CoverEntityFeature.CLOSE_TILT,
},
},
{
entity_id: "cover.tilt_only_closed",
state: "closed",
attributes: {
friendly_name: "Tilt-only blind closed",
device_class: "blind",
assumed_state: true,
supported_features:
CoverEntityFeature.OPEN_TILT +
CoverEntityFeature.STOP_TILT +
CoverEntityFeature.CLOSE_TILT,
},
},
{
entity_id: "cover.tilt_only_open",
state: "open",
attributes: {
friendly_name: "Tilt-only blind open",
device_class: "blind",
assumed_state: true,
supported_features:
CoverEntityFeature.OPEN_TILT +
CoverEntityFeature.STOP_TILT +
CoverEntityFeature.CLOSE_TILT,
},
},
{
entity_id: "cover.tilt_slider_half",
state: "on",
+1
View File
@@ -238,6 +238,7 @@ export class HaGridSizeEditor extends LitElement {
grid-template-rows: auto auto;
grid-template-columns: auto 1fr;
gap: var(--ha-space-2);
padding-left: var(--ha-space-4);
}
.precise {
grid-area: precise;
+19 -5
View File
@@ -239,12 +239,29 @@ export interface CoverEntity extends HassEntityBase {
attributes: CoverEntityAttributes;
}
// For covers that report no value, the open or closed state tells where it is
const valueFromState = (stateObj: CoverEntity): number | undefined => {
if (stateObj.state === UNKNOWN || stateObj.state === UNAVAILABLE) {
return undefined;
}
return stateObj.state === "closed" || stateObj.state === "opening" ? 0 : 100;
};
export const coverCurrentValue = (
stateObj: CoverEntity,
mode: CoverControlMode
): number | undefined => {
if (mode === "tilt") {
return stateObj.attributes.current_tilt_position ?? undefined;
const tilt = stateObj.attributes.current_tilt_position;
// The state only describes the slats when the cover can't move up or down
if (
tilt != null ||
coverSupportsTiltPosition(stateObj) ||
coverHasPositionControls(stateObj)
) {
return tilt ?? undefined;
}
return valueFromState(stateObj);
}
const position = stateObj.attributes.current_position;
if (
@@ -253,10 +270,7 @@ export const coverCurrentValue = (
) {
return position ?? undefined;
}
if (stateObj.state === UNKNOWN || stateObj.state === UNAVAILABLE) {
return undefined;
}
return stateObj.state === "closed" || stateObj.state === "opening" ? 0 : 100;
return valueFromState(stateObj);
};
declare global {
+2 -17
View File
@@ -149,8 +149,6 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
@property({ type: Boolean, reflect: true }) public large = false;
@state() private _fill = false;
// The dialog grows with the camera's or image's picture, as high as there
// is room for
@state() private _mediaAspectRatio?: number;
@@ -217,7 +215,6 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
this._detailsYamlMode = false;
this.large = params.large ?? false;
this._fill = false;
this._open = true;
this._loadEntityRegistryEntry();
}
@@ -701,13 +698,7 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
return html`
<ha-adaptive-dialog
.open=${this._open}
.width=${
this._fill
? "full"
: this.large || mediaAspectRatio
? "large"
: "medium"
}
.width=${this.large || mediaAspectRatio ? "large" : "medium"}
class=${classMap({
camera: domain === "camera",
image: domain === "image",
@@ -751,7 +742,7 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
></ha-icon-button-prev>
`
}
<span slot="headerTitle" @click=${this._enlarge} class="title">
<span slot="headerTitle" class="title">
${
breadcrumb.length > 0
? !__DEMO__ && isAdmin
@@ -1168,12 +1159,6 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
this._cameraControlsHeight = ev.detail.height;
}
private _enlarge() {
withViewTransition(() => {
this._fill = !this._fill;
});
}
private _handleOpened() {
window.addEventListener("dialog-closed", this._enableEscapeKeyClose);
window.addEventListener("show-dialog", this._disableEscapeKeyClose);
@@ -504,7 +504,7 @@ export class HaGridLayoutSlider extends LitElement {
left 180ms ease-in-out,
bottom 180ms ease-in-out;
--handle-spacing: calc(2 * var(--handle-margin) + var(--handle-size));
--slider-tooltip-margin: 0px;
--slider-tooltip-margin: var(--ha-space-1);
--slider-tooltip-range: 100%;
--slider-tooltip-offset: 0px;
--slider-tooltip-position: calc(
@@ -420,7 +420,7 @@ export class HuiCardLayoutEditor extends LitElement {
}
ha-grid-size-picker {
display: block;
margin: 16px auto;
margin: var(--ha-space-4) auto;
direction: ltr;
}
`,
+1 -10
View File
@@ -1,7 +1,6 @@
import type { PropertyValues } from "lit";
import type { HASSDomEvent } from "../common/dom/fire_event";
import { mainWindow } from "../common/dom/get_main_window";
import { computeDomain } from "../common/entity/compute_domain";
import { replaceCurrentUrl } from "../common/navigate";
import {
createMoreInfoUrl,
@@ -12,8 +11,6 @@ import type { MoreInfoDialogParams } from "../dialogs/more-info/ha-more-info-dia
import type { Constructor } from "../types";
import type { HassBaseEl } from "./hass-base-mixin";
const LARGE_MORE_INFO_DOMAINS = ["camera"];
declare global {
// for fire event
interface HASSDomEvents {
@@ -47,13 +44,7 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
{
entityId: ev.detail.entityId,
view,
large:
ev.detail.large ??
(ev.detail.entityId
? LARGE_MORE_INFO_DOMAINS.includes(
computeDomain(ev.detail.entityId)
)
: false),
large: ev.detail.large,
data: ev.detail.data,
returnUrl,
},
+66
View File
@@ -0,0 +1,66 @@
import { describe, expect, it } from "vitest";
import type { CoverEntity } from "../../src/data/cover";
import { CoverEntityFeature, coverCurrentValue } from "../../src/data/cover";
const TILT_FEATURES =
CoverEntityFeature.OPEN_TILT +
CoverEntityFeature.CLOSE_TILT +
CoverEntityFeature.STOP_TILT;
const cover = (
state: string,
supportedFeatures: number,
attributes: Partial<CoverEntity["attributes"]> = {}
): CoverEntity =>
({
entity_id: "cover.blind",
state,
attributes: { supported_features: supportedFeatures, ...attributes },
}) as CoverEntity;
describe("coverCurrentValue", () => {
it("uses the state for the tilt of a tilt-only cover without a tilt position", () => {
expect(coverCurrentValue(cover("closed", TILT_FEATURES), "tilt")).toBe(0);
expect(coverCurrentValue(cover("opening", TILT_FEATURES), "tilt")).toBe(0);
expect(coverCurrentValue(cover("open", TILT_FEATURES), "tilt")).toBe(100);
expect(coverCurrentValue(cover("closing", TILT_FEATURES), "tilt")).toBe(
100
);
});
it("has no tilt when the state of a tilt-only cover is unknown", () => {
expect(
coverCurrentValue(cover("unknown", TILT_FEATURES), "tilt")
).toBeUndefined();
expect(
coverCurrentValue(cover("unavailable", TILT_FEATURES), "tilt")
).toBeUndefined();
});
it("prefers the reported tilt position", () => {
expect(
coverCurrentValue(
cover("closed", TILT_FEATURES, { current_tilt_position: 30 }),
"tilt"
)
).toBe(30);
});
it("does not use the state for the tilt when the cover also moves up and down", () => {
expect(
coverCurrentValue(
cover("closed", TILT_FEATURES + CoverEntityFeature.OPEN),
"tilt"
)
).toBeUndefined();
});
it("does not use the state for the tilt when the cover can set its tilt position", () => {
expect(
coverCurrentValue(
cover("closed", TILT_FEATURES + CoverEntityFeature.SET_TILT_POSITION),
"tilt"
)
).toBeUndefined();
});
});
@@ -284,13 +284,6 @@ describe("browseLinkFromUrl", () => {
});
});
it("filters on no integration category for an empty one", () => {
expect(
browseLinkFromUrl("?integration_category=")?.filters
.integration_category ?? []
).toEqual([]);
});
it("keeps what was picked for a link that says nothing about browsing", () => {
expect(
browseLinkFromUrl("?owner=hacs&repository=integration")
@@ -299,13 +292,6 @@ describe("browseLinkFromUrl", () => {
});
describe("filtersOfTab", () => {
it("keeps the integration category on every tab", () => {
expect(
filtersOfTab({ integration_category: ["energy"] }, "installed")
.integration_category
).toEqual(["energy"]);
});
it("only offers statuses something installed can have on the installed tab", () => {
expect(statusesOfTab("installed")).toEqual([
"pending-restart",