Improve type hints in light [a-i] (#75936)

* Improve type hints in ads light

* Improve type hints in avea light

* Improve type hints in avion light

* Improve type hints in broadlink light

* More type hints

* One more
This commit is contained in:
epenet 2022-07-31 20:46:13 +02:00 committed by GitHub
parent c795597511
commit 20fec104e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 88 additions and 61 deletions

View file

@ -2,6 +2,7 @@
from __future__ import annotations
import math
from typing import Any
from iglo import Lamp
from iglo.lamp import MODE_WHITE
@ -86,14 +87,14 @@ class IGloLamp(LightEntity):
return color_util.color_temperature_kelvin_to_mired(self._lamp.state()["white"])
@property
def min_mireds(self):
def min_mireds(self) -> int:
"""Return the coldest color_temp that this light supports."""
return math.ceil(
color_util.color_temperature_kelvin_to_mired(self._lamp.max_kelvin)
)
@property
def max_mireds(self):
def max_mireds(self) -> int:
"""Return the warmest color_temp that this light supports."""
return math.ceil(
color_util.color_temperature_kelvin_to_mired(self._lamp.min_kelvin)
@ -119,7 +120,7 @@ class IGloLamp(LightEntity):
"""Return true if light is on."""
return self._lamp.state()["on"]
def turn_on(self, **kwargs):
def turn_on(self, **kwargs: Any) -> None:
"""Turn the light on."""
if not self.is_on:
self._lamp.switch(True)
@ -145,6 +146,6 @@ class IGloLamp(LightEntity):
self._lamp.effect(effect)
return
def turn_off(self, **kwargs):
def turn_off(self, **kwargs: Any) -> None:
"""Turn the light off."""
self._lamp.switch(False)