mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-17 14:26:35 +00:00
Add white mode to more info light (#15774)
This commit is contained in:
parent
24c3ddb96b
commit
65d3af6fd6
@ -2,6 +2,7 @@ import "@material/mwc-list/mwc-list-item";
|
|||||||
import "@material/web/iconbutton/outlined-icon-button";
|
import "@material/web/iconbutton/outlined-icon-button";
|
||||||
import {
|
import {
|
||||||
mdiCreation,
|
mdiCreation,
|
||||||
|
mdiFileWordBox,
|
||||||
mdiLightbulb,
|
mdiLightbulb,
|
||||||
mdiLightbulbOff,
|
mdiLightbulbOff,
|
||||||
mdiPalette,
|
mdiPalette,
|
||||||
@ -73,6 +74,11 @@ class MoreInfoLight extends LitElement {
|
|||||||
|
|
||||||
const supportsColor = lightSupportsColor(this.stateObj);
|
const supportsColor = lightSupportsColor(this.stateObj);
|
||||||
|
|
||||||
|
const supportsWhite = lightSupportsColorMode(
|
||||||
|
this.stateObj,
|
||||||
|
LightColorMode.WHITE
|
||||||
|
);
|
||||||
|
|
||||||
const supportsBrightness = lightSupportsBrightness(this.stateObj);
|
const supportsBrightness = lightSupportsBrightness(this.stateObj);
|
||||||
|
|
||||||
const supportsEffects = supportsFeature(
|
const supportsEffects = supportsFeature(
|
||||||
@ -148,6 +154,22 @@ class MoreInfoLight extends LitElement {
|
|||||||
</md-outlined-icon-button>
|
</md-outlined-icon-button>
|
||||||
`
|
`
|
||||||
: null}
|
: null}
|
||||||
|
${supportsWhite
|
||||||
|
? html`
|
||||||
|
<md-outlined-icon-button
|
||||||
|
.disabled=${this.stateObj.state === UNAVAILABLE}
|
||||||
|
.title=${this.hass.localize(
|
||||||
|
"ui.dialogs.more_info_control.light.set_white"
|
||||||
|
)}
|
||||||
|
.ariaLabel=${this.hass.localize(
|
||||||
|
"ui.dialogs.more_info_control.light.set_white"
|
||||||
|
)}
|
||||||
|
@click=${this._setWhiteColor}
|
||||||
|
>
|
||||||
|
<ha-svg-icon .path=${mdiFileWordBox}></ha-svg-icon>
|
||||||
|
</md-outlined-icon-button>
|
||||||
|
`
|
||||||
|
: null}
|
||||||
${supportsEffects && this.stateObj.attributes.effect_list
|
${supportsEffects && this.stateObj.attributes.effect_list
|
||||||
? html`
|
? html`
|
||||||
<ha-button-menu
|
<ha-button-menu
|
||||||
@ -216,6 +238,13 @@ class MoreInfoLight extends LitElement {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private _setWhiteColor = () => {
|
||||||
|
this.hass.callService("light", "turn_on", {
|
||||||
|
entity_id: this.stateObj!.entity_id,
|
||||||
|
white: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
private _handleEffectButton(ev) {
|
private _handleEffectButton(ev) {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
@ -899,6 +899,7 @@
|
|||||||
"light": {
|
"light": {
|
||||||
"toggle": "Toggle",
|
"toggle": "Toggle",
|
||||||
"change_color": "Change color",
|
"change_color": "Change color",
|
||||||
|
"set_white": "Set white",
|
||||||
"select_effect": "Select effect",
|
"select_effect": "Select effect",
|
||||||
"brightness": "Brightness",
|
"brightness": "Brightness",
|
||||||
"color_picker": {
|
"color_picker": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user