Fix round typing [isy994] (#82435)

This commit is contained in:
Marc Mueller 2022-11-21 18:07:30 +01:00 committed by GitHub
parent 91a44b697b
commit 0337b5d975
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
"""Support for ISY994 covers.""" """Support for ISY994 covers."""
from __future__ import annotations from __future__ import annotations
from typing import Any from typing import Any, cast
from pyisy.constants import ISY_VALUE_UNKNOWN from pyisy.constants import ISY_VALUE_UNKNOWN
@ -58,7 +58,7 @@ class ISYCoverEntity(ISYNodeEntity, CoverEntity):
if self._node.status == ISY_VALUE_UNKNOWN: if self._node.status == ISY_VALUE_UNKNOWN:
return None return None
if self._node.uom == UOM_8_BIT_RANGE: 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]) return int(sorted((0, self._node.status, 100))[1])
@property @property

View file

@ -1,7 +1,7 @@
"""Support for ISY994 lights.""" """Support for ISY994 lights."""
from __future__ import annotations from __future__ import annotations
from typing import Any from typing import Any, cast
from pyisy.constants import ISY_VALUE_UNKNOWN from pyisy.constants import ISY_VALUE_UNKNOWN
from pyisy.helpers import NodeProperty from pyisy.helpers import NodeProperty
@ -70,7 +70,7 @@ class ISYLightEntity(ISYNodeEntity, LightEntity, RestoreEntity):
return None return None
# Special Case for ISY Z-Wave Devices using % instead of 0-255: # Special Case for ISY Z-Wave Devices using % instead of 0-255:
if self._node.uom == UOM_PERCENTAGE: 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) return int(self._node.status)
async def async_turn_off(self, **kwargs: Any) -> None: async def async_turn_off(self, **kwargs: Any) -> None: