Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/panels/lovelace/cards/hui-light-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class HuiLightCard extends LitElement implements LovelaceCard {
<ha-icon
class="light-icon"
data-state="${stateObj.state}"
.icon="${stateIcon(stateObj)}"
.icon="${this._config.icon || stateIcon(stateObj)}"
style="${styleMap({
filter: this._computeBrightness(stateObj),
color: this._computeColor(stateObj),
Expand Down
1 change: 1 addition & 0 deletions src/panels/lovelace/cards/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export interface LightCardConfig extends LovelaceCardConfig {
entity: string;
name?: string;
theme?: string;
icon?: string;
}

export interface MapCardConfig extends LovelaceCardConfig {
Expand Down
5 changes: 3 additions & 2 deletions src/panels/lovelace/components/hui-theme-select-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ declare global {
@customElement("hui-theme-select-editor")
export class HuiThemeSelectEditor extends LitElement {
@property() public value?: string;

@property() public label?: string;
@property() public hass?: HomeAssistant;

protected render(): TemplateResult | void {
Expand All @@ -36,7 +36,8 @@ export class HuiThemeSelectEditor extends LitElement {

return html`
<paper-dropdown-menu
label="Theme"
.label=${this.label ||
this.hass!.localize("ui.panel.lovelace.editor.theme_select.theme")}
dynamic-align
@value-changed="${this._changed}"
>
Expand Down
54 changes: 34 additions & 20 deletions src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const cardConfigStruct = struct({
name: "string?",
entity: "string?",
theme: "string?",
icon: "string?",
});

@customElement("hui-light-card-editor")
Expand All @@ -49,6 +50,10 @@ export class HuiLightCardEditor extends LitElement
return this._config!.entity || "";
}

get _icon(): string {
return this._config!.icon || "";
}

protected render(): TemplateResult | void {
if (!this.hass) {
return html``;
Expand All @@ -57,28 +62,37 @@ export class HuiLightCardEditor extends LitElement
return html`
${configElementStyle}
<div class="card-config">
<paper-input
label="Name"
.value="${this._name}"
.configValue="${"name"}"
@value-changed="${this._valueChanged}"
></paper-input>
<ha-entity-picker
label="Light Entity (Required)"
.hass="${this.hass}"
.value="${this._entity}"
.configValue=${"entity"}
domain-filter="light"
@change="${this._valueChanged}"
allow-custom-entity
></ha-entity-picker>
<div class="side-by-side">
<ha-entity-picker
.hass="${this.hass}"
.value="${this._entity}"
.configValue=${"entity"}
domain-filter="light"
@change="${this._valueChanged}"
allow-custom-entity
></ha-entity-picker>
<hui-theme-select-editor
.hass="${this.hass}"
.value="${this._theme}"
.configValue="${"theme"}"
@theme-changed="${this._valueChanged}"
></hui-theme-select-editor>
<paper-input
label="Name (Optional)"
.value="${this._name}"
.configValue="${"name"}"
@value-changed="${this._valueChanged}"
></paper-input>
<paper-input
label="Icon (Optional)"
.value="${this._icon}"
.configValue="${"icon"}"
@value-changed="${this._valueChanged}"
></paper-input>
</div>

<hui-theme-select-editor
label="Theme (Optional)"
.hass="${this.hass}"
.value="${this._theme}"
.configValue="${"theme"}"
@theme-changed="${this._valueChanged}"
></hui-theme-select-editor>
</div>
`;
}
Expand Down
3 changes: 3 additions & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,9 @@
"para_no_id": "This element doesn't have an ID. Please add an ID to this element in 'ui-lovelace.yaml'.",
"para_migrate": "Home Assistant can add ID's to all your cards and views automatically for you by pressing the 'Migrate config' button.",
"migrate": "Migrate config"
},
"theme": {
"theme": "Theme (Optional)"
}
},
"warning": {
Expand Down