Skip to content

Commit 5dc25cf

Browse files
committed
Fix unsupported operand type for 'int' / 'NoneType' #1641
1 parent b00e1d0 commit 5dc25cf

File tree

1 file changed

+5
-1
lines changed
  • custom_components/xiaomi_gateway3

1 file changed

+5
-1
lines changed

custom_components/xiaomi_gateway3/light.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ async def async_setup_entry(hass, entry, async_add_entities) -> None:
2929
ATTR_COLOR_TEMP_KELVIN = "color_temp_kelvin"
3030

3131

32-
def color_temp(value: int) -> int:
32+
def color_temp(value: int | None) -> int | None:
33+
if value is None:
34+
return None
35+
if value == 0:
36+
return 0
3337
return math.floor(1000000 / value)
3438

3539

0 commit comments

Comments
 (0)