Skip to content

Commit

Permalink
add min/max for mired color temperature
Browse files Browse the repository at this point in the history
  • Loading branch information
Garfonso committed Jun 9, 2024
1 parent 1300fd9 commit 2efc0c8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/converters/light.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ function _lightAdvancedAddColorTemperature(states, objects, entity) {
entity.attributes.max_color_temp_kelvin = max;
}

if (attribute.convert_to_mired) {
entity.attributes.max_mireds = tempObj?.common?.max || 1e6 / entity.attributes.min_color_temp_kelvin;
entity.attributes.min_mireds = tempObj?.common?.min || 1e6 / entity.attributes.max_color_temp_kelvin;
} else {
entity.attributes.max_mireds = 1e6 / entity.attributes.min_color_temp_kelvin;
entity.attributes.min_mireds = 1e6 / entity.attributes.max_color_temp_kelvin;
}
entity.attributes.supported_color_modes.push(COLOR_TEMP);
}
}
Expand Down

0 comments on commit 2efc0c8

Please sign in to comment.