Skip to content

Commit

Permalink
Home Assistant groups use color temperature range supported by all bu…
Browse files Browse the repository at this point in the history
…lbs. #8032
  • Loading branch information
Koenkk committed Jul 16, 2021
1 parent 07ff52a commit f8927a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/extension/homeassistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ class HomeAssistant extends Extension {
if (hasColorTemp) {
const colorTemps = exposes.map((expose) => expose.features.find((e) => e.name === 'color_temp'))
.filter((e) => e);
const max = Math.max(...colorTemps.map((e) => e.value_max));
const min = Math.min(...colorTemps.map((e) => e.value_min));
const max = Math.min(...colorTemps.map((e) => e.value_max));
const min = Math.max(...colorTemps.map((e) => e.value_min));
discoveryEntry.discovery_payload.max_mireds = max;
discoveryEntry.discovery_payload.min_mireds = min;
}
Expand Down
8 changes: 4 additions & 4 deletions test/homeassistant.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ describe('HomeAssistant extension', () => {
"name":"ha_discovery_group",
"sw_version":this.version,
},
"max_mireds": 500,
"min_mireds": 150,
"max_mireds": 454,
"min_mireds": 250,
"json_attributes_topic":"zigbee2mqtt/ha_discovery_group",
"name":"ha_discovery_group",
"schema":"json",
Expand Down Expand Up @@ -1715,8 +1715,8 @@ describe('HomeAssistant extension', () => {
"sw_version":this.version,
},
"json_attributes_topic":"zigbee2mqtt/ha_discovery_group",
"max_mireds": 500,
"min_mireds": 150,
"max_mireds": 454,
"min_mireds": 250,
"name":"ha_discovery_group",
"schema":"json",
"state_topic":"zigbee2mqtt/ha_discovery_group",
Expand Down

0 comments on commit f8927a9

Please sign in to comment.