Fix round typing [isy994] (#82435)
This commit is contained in:
parent
91a44b697b
commit
0337b5d975
2 changed files with 4 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
"""Support for ISY994 covers."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, cast
|
||||
|
||||
from pyisy.constants import ISY_VALUE_UNKNOWN
|
||||
|
||||
|
@ -58,7 +58,7 @@ class ISYCoverEntity(ISYNodeEntity, CoverEntity):
|
|||
if self._node.status == ISY_VALUE_UNKNOWN:
|
||||
return None
|
||||
if self._node.uom == UOM_8_BIT_RANGE:
|
||||
return round(self._node.status * 100.0 / 255.0)
|
||||
return round(cast(float, self._node.status) * 100.0 / 255.0)
|
||||
return int(sorted((0, self._node.status, 100))[1])
|
||||
|
||||
@property
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for ISY994 lights."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, cast
|
||||
|
||||
from pyisy.constants import ISY_VALUE_UNKNOWN
|
||||
from pyisy.helpers import NodeProperty
|
||||
|
@ -70,7 +70,7 @@ class ISYLightEntity(ISYNodeEntity, LightEntity, RestoreEntity):
|
|||
return None
|
||||
# Special Case for ISY Z-Wave Devices using % instead of 0-255:
|
||||
if self._node.uom == UOM_PERCENTAGE:
|
||||
return round(self._node.status * 255.0 / 100.0)
|
||||
return round(cast(float, self._node.status) * 255.0 / 100.0)
|
||||
return int(self._node.status)
|
||||
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
|
|
Loading…
Add table
Reference in a new issue