Skip to content

Commit

Permalink
HA discovery: prefer XY over HS.
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Jan 5, 2021
1 parent 90abc2e commit acfd938
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/extension/homeassistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit acfd938

Please sign in to comment.