Skip to content

Commit

Permalink
default to mirek
Browse files Browse the repository at this point in the history
  • Loading branch information
philipparndt committed Jan 17, 2022
1 parent b83f71d commit f6b8f4f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/api/v2/device-stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export const deviceStubs = {
}
},
color_temperature: {
mirek: 366,
mirek: null,
mirek_schema: {
mirek_maximum: 500,
mirek_minimum: 153
Expand Down
2 changes: 1 addition & 1 deletion lib/api/v2/types/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type LightDimmingData = {

/* eslint-disable camelcase */
export type LightColorTemperatureData = {
mirek: number
mirek: number | null
mirek_valid: boolean
mirek_schema: {
mirek_maximum: number
Expand Down
2 changes: 1 addition & 1 deletion lib/messages/light-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const fromLight = (light: Light) => {
brightness: light.dimming?.brightness ?? 0
}

if (light.color_temperature) {
if (light.color_temperature && light.color_temperature.mirek && light.color_temperature.mirek_valid) {
message.color_temp = light.color_temperature.mirek
}
else if (light.color) {
Expand Down
2 changes: 0 additions & 2 deletions lib/messages/messages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ describe("Messages", () => {
x: 0.4575,
y: 0.4099
},
color_temp: 366,
state: "ON"
})
})
Expand All @@ -61,7 +60,6 @@ describe("Messages", () => {
x: 0.1,
y: 0.2
},
color_temp: 366,
state: "ON"
}
expect(isEffectMessage(message)).toBeFalsy()
Expand Down

0 comments on commit f6b8f4f

Please sign in to comment.