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:
starkillerOG 2023-11-03 17:05:27 +01:00 committed by GitHub
parent c1d979dc07
commit 1df69f52e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 37 additions and 29 deletions

View file

@ -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."""