ZWaveJS: Add names to colors in Installer Settings (#22819)

This commit is contained in:
Petar Petrov 2024-11-15 18:55:02 +02:00 committed by GitHub
parent cae5540c44
commit b8a13dd6eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 3 deletions

View File

@ -8,6 +8,18 @@ import "../../../../../../components/ha-circular-progress";
import { extractApiErrorMessage } from "../../../../../../data/hassio/common"; import { extractApiErrorMessage } from "../../../../../../data/hassio/common";
import "./zwave_js-capability-control-multilevel-switch"; import "./zwave_js-capability-control-multilevel-switch";
enum ColorComponent {
"Warm White" = 0,
"Cold White",
Red,
Green,
Blue,
Amber,
Cyan,
Purple,
Index,
}
@customElement("zwave_js-capability-control-color_switch") @customElement("zwave_js-capability-control-color_switch")
class ZWaveJSCapabilityColorSwitch extends LitElement { class ZWaveJSCapabilityColorSwitch extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant; @property({ attribute: false }) public hass!: HomeAssistant;
@ -20,7 +32,7 @@ class ZWaveJSCapabilityColorSwitch extends LitElement {
@property({ type: Number }) public version!: number; @property({ type: Number }) public version!: number;
@state() private _color_components?: number[]; @state() private _color_components?: ColorComponent[];
@state() private _error?: string; @state() private _error?: string;
@ -37,7 +49,9 @@ class ZWaveJSCapabilityColorSwitch extends LitElement {
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.zwave_js.node_installer.capability_controls.color_switch.color_component" "ui.panel.config.zwave_js.node_installer.capability_controls.color_switch.color_component"
)}: )}:
${color} ${this.hass.localize(
`ui.panel.config.zwave_js.node_installer.capability_controls.color_switch.colors.${color}`
)}
</h5> </h5>
<zwave_js-capability-control-multilevel_switch <zwave_js-capability-control-multilevel_switch
.hass=${this.hass} .hass=${this.hass}

View File

@ -5268,7 +5268,18 @@
"control_failed": "Failed to control transition. {error}" "control_failed": "Failed to control transition. {error}"
}, },
"color_switch": { "color_switch": {
"color_component": "Color component" "color_component": "Color component",
"colors": {
"0": "Warm White",
"1": "Cold White",
"2": "Red",
"3": "Green",
"4": "Blue",
"5": "Amber",
"6": "Cyan",
"7": "Purple",
"8": "Index"
}
} }
} }
} }