Skip to content

Commit

Permalink
ZWaveJS: Add names to colors in Installer Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
MindFreeze committed Nov 14, 2024
1 parent 17982e0 commit b7a5269
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ import "../../../../../../components/ha-circular-progress";
import { extractApiErrorMessage } from "../../../../../../data/hassio/common";
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")
class ZWaveJSCapabilityColorSwitch extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
Expand All @@ -20,7 +32,7 @@ class ZWaveJSCapabilityColorSwitch extends LitElement {

@property({ type: Number }) public version!: number;

@state() private _color_components?: number[];
@state() private _color_components?: ColorComponent[];

@state() private _error?: string;

Expand All @@ -37,7 +49,9 @@ class ZWaveJSCapabilityColorSwitch extends LitElement {
${this.hass.localize(
"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>
<zwave_js-capability-control-multilevel_switch
.hass=${this.hass}
Expand Down
13 changes: 12 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5265,7 +5265,18 @@
"control_failed": "Failed to control transition. {error}"
},
"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"
}
}
}
}
Expand Down

0 comments on commit b7a5269

Please sign in to comment.