Skip to content

Commit c0ab978

Browse files
authored
fix(light): fix multi-endpoint light support (#2515)
1 parent e0e8f46 commit c0ab978

File tree

1 file changed

+5
-2
lines changed
  • src/components/features/composite/color

1 file changed

+5
-2
lines changed

src/components/features/composite/color/color.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ const Light: FunctionComponent<ColorProps> = (props) => {
1010
const { deviceState, feature, onChange, minimal } = props;
1111
const value = {};
1212
for (const innerFeature of feature.features) {
13-
value[innerFeature.name] =
14-
(deviceState[feature.property] as Record<string, Record<string, unknown>>)?.[innerFeature.property] ?? 0;
13+
// just in case the number comes in as string
14+
const propValue = Number.parseFloat(
15+
(deviceState[feature.property] as Record<string, Record<string, unknown>>)?.[innerFeature.name],
16+
);
17+
value[innerFeature.name] = Number.isNaN(propValue) ? 0 : propValue;
1518
}
1619
return (
1720
<ColorEditor

0 commit comments

Comments
 (0)