From 072bbcf203202ac0398eec838db9ae0ee7928d59 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Thu, 24 Nov 2022 13:46:39 +0100 Subject: [PATCH] Fix round typing [homewizard] (#82628) --- homeassistant/components/homewizard/number.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/homewizard/number.py b/homeassistant/components/homewizard/number.py index 43dccc364bd..6acbbcfa37b 100644 --- a/homeassistant/components/homewizard/number.py +++ b/homeassistant/components/homewizard/number.py @@ -1,6 +1,8 @@ """Creates HomeWizard Number entities.""" from __future__ import annotations +from typing import Optional, cast + from homeassistant.components.number import NumberEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import PERCENTAGE @@ -60,6 +62,7 @@ class HWEnergyNumberEntity( @property def native_value(self) -> float | None: """Return the current value.""" - if self.coordinator.data["state"].brightness is None: + brightness = cast(Optional[float], self.coordinator.data["state"].brightness) + if brightness is None: return None - return round(self.coordinator.data["state"].brightness * (100 / 255)) + return round(brightness * (100 / 255))