From 06f3f61351343955559655c5d3040ef22dea2ecb Mon Sep 17 00:00:00 2001 From: James Smith Date: Wed, 8 Jan 2025 13:29:59 -0800 Subject: [PATCH] Fix a couple of typing issues --- custom_components/vantage/config_flow.py | 7 ++++--- custom_components/vantage/sensor.py | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/custom_components/vantage/config_flow.py b/custom_components/vantage/config_flow.py index 5210037..507e3f0 100644 --- a/custom_components/vantage/config_flow.py +++ b/custom_components/vantage/config_flow.py @@ -181,9 +181,10 @@ async def async_step_reauth( self, _entry_data: dict[str, Any] | None = None ) -> ConfigFlowResult: """Perform reauth after controller authentication error.""" - self.reauth_entry = self.hass.config_entries.async_get_entry( - self.context["entry_id"] - ) + if not (entry_id := self.context.get("entry_id")): + return self.async_abort(reason="unknown") + + self.reauth_entry = self.hass.config_entries.async_get_entry(entry_id) return await self.async_step_reauth_confirm() diff --git a/custom_components/vantage/sensor.py b/custom_components/vantage/sensor.py index 49cb5cd..ed07568 100644 --- a/custom_components/vantage/sensor.py +++ b/custom_components/vantage/sensor.py @@ -121,6 +121,8 @@ def __post_init__(self) -> None: case "Temperature": self._attr_device_class = SensorDeviceClass.TEMPERATURE self._attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS + case _: + pass @property def native_value(self) -> int | Decimal | None: