mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-06-29 08:31:38 +00:00
Add preferredColorMode option. https://github.com/Koenkk/zigbee-herdsman-converters/pull/3708
This commit is contained in:
@@ -127,6 +127,7 @@ export default class HomeAssistant extends Extension {
|
||||
const hasBrightness = exposes.find((expose) => expose.features.find((e) => e.name === 'brightness'));
|
||||
const hasColorTemp = exposes.find((expose) => expose.features.find((e) => e.name === 'color_temp'));
|
||||
const state = firstExpose.features.find((f) => f.name === 'state');
|
||||
const preferHS = !!exposes.find((expose) => expose.preferredColorMode === 'hs');
|
||||
|
||||
const discoveryEntry: DiscoveryEntry = {
|
||||
type: 'light',
|
||||
@@ -143,8 +144,8 @@ export default class HomeAssistant extends Extension {
|
||||
};
|
||||
|
||||
const colorModes = [
|
||||
hasColorXY ? 'xy' : null,
|
||||
!hasColorXY && hasColorHS ? 'hs' : null,
|
||||
hasColorXY && !preferHS ? 'xy' : null,
|
||||
(!hasColorXY || preferHS) && hasColorHS ? 'hs' : null,
|
||||
hasColorTemp ? 'color_temp' : null,
|
||||
].filter((c) => c);
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -101,7 +101,7 @@ declare global {
|
||||
interface DefinitionExpose {
|
||||
type: string, name?: string, features?: DefinitionExposeFeature[],
|
||||
endpoint?: string, values?: string[], value_off?: string, value_on?: string,
|
||||
access: number, property: string, unit?: string,
|
||||
access: number, property: string, unit?: string, preferredColorMode?: 'xy' | 'hs',
|
||||
value_min?: number, value_max?: number}
|
||||
|
||||
interface Definition {
|
||||
|
||||
Reference in New Issue
Block a user