mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2024-11-17 02:48:31 -07:00
HA discovery: prefer XY over HS.
This commit is contained in:
parent
90abc2e846
commit
acfd938e48
@ -82,14 +82,16 @@ class HomeAssistant extends Extension {
|
||||
let discoveryEntry = null;
|
||||
/* istanbul ignore else */
|
||||
if (expose.type === 'light') {
|
||||
const supportsXY = !!expose.features.find((e) => e.name === 'color_xy');
|
||||
const supportsHS = !!expose.features.find((e) => e.name === 'color_hs');
|
||||
discoveryEntry = {
|
||||
type: 'light',
|
||||
object_id: expose.endpoint ? `light_${expose.endpoint}` : 'light',
|
||||
discovery_payload: {
|
||||
brightness: !!expose.features.find((e) => e.name === 'brightness'),
|
||||
color_temp: !!expose.features.find((e) => e.name === 'color_temp'),
|
||||
xy: !!expose.features.find((e) => e.name === 'color_xy'),
|
||||
hs: !!expose.features.find((e) => e.name === 'color_hs'),
|
||||
xy: supportsXY,
|
||||
hs: !supportsXY && supportsHS,
|
||||
schema: 'json',
|
||||
command_topic: true,
|
||||
brightness_scale: 254,
|
||||
|
Loading…
Reference in New Issue
Block a user