Koen Kanters
2022-01-22 10:54:01 +01:00
parent 8e72b3bf64
commit 3451c71a21
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -127,7 +127,11 @@ 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');
// Prefer HS over XY when at least one of the lights in the group prefers HS over XY.
// A light prefers HS over XY when HS is earlier in the feature array than HS.
const preferHS = exposes.map((e) => [e.features.findIndex((ee) => ee.name === 'color_xy'),
e.features.findIndex((ee) => ee.name === 'color_hs')])
.filter((d) => d[0] !== -1 && d[1] !== -1 && d[1] < d[0]).length !== 0;
const discoveryEntry: DiscoveryEntry = {
type: 'light',
+1 -1
View File
@@ -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, preferredColorMode?: 'xy' | 'hs',
access: number, property: string, unit?: string,
value_min?: number, value_max?: number}
interface Definition {