mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 19:26:36 +00:00
Add features to light & cover groups more-info
This commit is contained in:
parent
ed8c9f5ce5
commit
3b51f30f7a
@ -11,6 +11,9 @@ import { importMoreInfoControl } from "../../panels/lovelace/custom-card-helpers
|
|||||||
import "../../panels/lovelace/sections/hui-section";
|
import "../../panels/lovelace/sections/hui-section";
|
||||||
import type { HomeAssistant } from "../../types";
|
import type { HomeAssistant } from "../../types";
|
||||||
import { stateMoreInfoType } from "./state_more_info_control";
|
import { stateMoreInfoType } from "./state_more_info_control";
|
||||||
|
import type { LovelaceCardFeatureConfig } from "../../panels/lovelace/card-features/types";
|
||||||
|
import { supportsLightBrightnessCardFeature } from "../../panels/lovelace/card-features/hui-light-brightness-card-feature";
|
||||||
|
import { supportsCoverPositionCardFeature } from "../../panels/lovelace/card-features/hui-cover-position-card-feature";
|
||||||
|
|
||||||
@customElement("more-info-content")
|
@customElement("more-info-content")
|
||||||
class MoreInfoContent extends LitElement {
|
class MoreInfoContent extends LitElement {
|
||||||
@ -73,16 +76,31 @@ class MoreInfoContent extends LitElement {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _entitiesSectionConfig = memoizeOne((entityIds: string[]) => ({
|
private _entitiesSectionConfig = memoizeOne((entityIds: string[]) => {
|
||||||
type: "grid",
|
const cards = entityIds.map((entityId) => {
|
||||||
cards: entityIds.map(
|
const features: LovelaceCardFeatureConfig[] = [];
|
||||||
(entityId) =>
|
const context = { entity_id: entityId };
|
||||||
({
|
if (supportsCoverPositionCardFeature(this.hass!, context)) {
|
||||||
type: "tile",
|
features.push({
|
||||||
entity: entityId,
|
type: "cover-position",
|
||||||
}) as TileCardConfig
|
});
|
||||||
),
|
} else if (supportsLightBrightnessCardFeature(this.hass!, context)) {
|
||||||
}));
|
features.push({
|
||||||
|
type: "light-brightness",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
type: "tile",
|
||||||
|
entity: entityId,
|
||||||
|
features_position: "inline",
|
||||||
|
features,
|
||||||
|
} as TileCardConfig;
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
type: "grid",
|
||||||
|
cards,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
static styles = css`
|
static styles = css`
|
||||||
hui-section {
|
hui-section {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user