diff --git a/src/components/ha-labeled-slider.js b/src/components/ha-labeled-slider.js index a620ec0204..147fd5b1b1 100644 --- a/src/components/ha-labeled-slider.js +++ b/src/components/ha-labeled-slider.js @@ -14,8 +14,8 @@ class HaLabeledSlider extends PolymerElement { } .title { - margin-bottom: 16px; - color: var(--secondary-text-color); + margin-bottom: 8px; + color: var(--primary-text-color); } .slider-container { @@ -43,7 +43,6 @@ class HaLabeledSlider extends PolymerElement { step="[[step]]" pin="[[pin]]" disabled="[[disabled]]" - disabled="[[disabled]]" value="{{value}}" > diff --git a/src/components/ha-slider.js b/src/components/ha-slider.js index 9a2a9a09c9..f520fa20ef 100644 --- a/src/components/ha-slider.js +++ b/src/components/ha-slider.js @@ -21,6 +21,7 @@ class HaSlider extends PaperSliderClass { .pin > .slider-knob > .slider-knob-inner { font-size: var(--ha-slider-pin-font-size, 10px); line-height: normal; + cursor: pointer; } .disabled.ring > .slider-knob > .slider-knob-inner { @@ -69,9 +70,9 @@ class HaSlider extends PaperSliderClass { transform: scale(1) translate(0, -10px); } - .slider-input { - width: 54px; - } + .slider-input { + width: 54px; + } `) ); } diff --git a/src/dialogs/more-info/controls/more-info-light.ts b/src/dialogs/more-info/controls/more-info-light.ts index 7ce5896ad6..a0ae76b03b 100644 --- a/src/dialogs/more-info/controls/more-info-light.ts +++ b/src/dialogs/more-info/controls/more-info-light.ts @@ -67,9 +67,10 @@ class MoreInfoLight extends LitElement { caption=${this.hass.localize("ui.card.light.brightness")} icon="hass:brightness-5" min="1" - max="255" + max="100" value=${this._brightnessSliderValue} @change=${this._brightnessSliderChanged} + pin > ` : ""} @@ -87,6 +88,7 @@ class MoreInfoLight extends LitElement { .max=${this.stateObj.attributes.max_mireds} .value=${this._ctSliderValue} @change=${this._ctSliderChanged} + pin > ` : ""} @@ -98,6 +100,7 @@ class MoreInfoLight extends LitElement { max="255" .value=${this._wvSliderValue} @change=${this._wvSliderChanged} + pin > ` : ""} @@ -155,16 +158,22 @@ class MoreInfoLight extends LitElement { protected updated(changedProps: PropertyValues): void { const stateObj = this.stateObj! as LightEntity; - if (changedProps.has("stateObj") && stateObj.state === "on") { - this._brightnessSliderValue = stateObj.attributes.brightness; - this._ctSliderValue = stateObj.attributes.color_temp; - this._wvSliderValue = stateObj.attributes.white_value; + if (changedProps.has("stateObj")) { + if (stateObj.state === "on") { + this._brightnessSliderValue = Math.round( + (stateObj.attributes.brightness * 100) / 255 + ); + this._ctSliderValue = stateObj.attributes.color_temp; + this._wvSliderValue = stateObj.attributes.white_value; - if (stateObj.attributes.hs_color) { - this._colorPickerColor = { - h: stateObj.attributes.hs_color[0], - s: stateObj.attributes.hs_color[1] / 100, - }; + if (stateObj.attributes.hs_color) { + this._colorPickerColor = { + h: stateObj.attributes.hs_color[0], + s: stateObj.attributes.hs_color[1] / 100, + }; + } + } else { + this._brightnessSliderValue = 0; } } } @@ -191,7 +200,7 @@ class MoreInfoLight extends LitElement { this.hass.callService("light", "turn_on", { entity_id: this.stateObj!.entity_id, - brightness: bri, + brightness_pct: bri, }); } @@ -250,15 +259,10 @@ class MoreInfoLight extends LitElement { align-items: center; } - .content.is-on { - margin-top: -16px; - } - .content > * { width: 100%; max-height: 84px; overflow: hidden; - padding-top: 16px; } .color_temp { diff --git a/src/panels/lovelace/cards/hui-light-card.ts b/src/panels/lovelace/cards/hui-light-card.ts index a959e518b3..f05168c0dc 100644 --- a/src/panels/lovelace/cards/hui-light-card.ts +++ b/src/panels/lovelace/cards/hui-light-card.ts @@ -99,7 +99,7 @@ export class HuiLightCard extends LitElement implements LovelaceCard { } const brightness = - Math.round((stateObj.attributes.brightness / 254) * 100) || 0; + Math.round((stateObj.attributes.brightness / 255) * 100) || 0; return html` @@ -116,7 +116,8 @@ export class HuiLightCard extends LitElement implements LovelaceCard {