Bump reolink-aio to 0.7.14 and improve typing of Reolink (#103129)
* Improve typing * fix mypy * Further improve typing * Restore Literal typing * Bump reolink_aio to 0.7.13 * Bump reolink-aio to 0.7.14
This commit is contained in:
parent
c1d979dc07
commit
1df69f52e5
10 changed files with 37 additions and 29 deletions
|
@ -38,8 +38,8 @@ class ReolinkLightEntityDescription(
|
|||
"""A class that describes light entities."""
|
||||
|
||||
supported_fn: Callable[[Host, int], bool] = lambda api, ch: True
|
||||
get_brightness_fn: Callable[[Host, int], int] | None = None
|
||||
set_brightness_fn: Callable[[Host, int, float], Any] | None = None
|
||||
get_brightness_fn: Callable[[Host, int], int | None] | None = None
|
||||
set_brightness_fn: Callable[[Host, int, int], Any] | None = None
|
||||
|
||||
|
||||
LIGHT_ENTITIES = (
|
||||
|
@ -127,13 +127,13 @@ class ReolinkLightEntity(ReolinkChannelCoordinatorEntity, LightEntity):
|
|||
if self.entity_description.get_brightness_fn is None:
|
||||
return None
|
||||
|
||||
return round(
|
||||
255
|
||||
* (
|
||||
self.entity_description.get_brightness_fn(self._host.api, self._channel)
|
||||
/ 100.0
|
||||
)
|
||||
bright_pct = self.entity_description.get_brightness_fn(
|
||||
self._host.api, self._channel
|
||||
)
|
||||
if bright_pct is None:
|
||||
return None
|
||||
|
||||
return round(255 * bright_pct / 100.0)
|
||||
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn light off."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue