From 70c6bceaee828cedf7f5328b2de92828e2dc312f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 12 Sep 2023 13:12:14 -0500 Subject: [PATCH] Use short hand entity_registry_enabled_default in nws (#100227) * Use short hand entity_registry_enabled_default in nws see https://github.com/home-assistant/core/pull/95315 * Update homeassistant/components/nws/sensor.py --- homeassistant/components/nws/weather.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/homeassistant/components/nws/weather.py b/homeassistant/components/nws/weather.py index d68b1fc745c..9d41e54ccd0 100644 --- a/homeassistant/components/nws/weather.py +++ b/homeassistant/components/nws/weather.py @@ -149,6 +149,7 @@ class NWSWeather(CoordinatorWeatherEntity): self.station = self.nws.station self.mode = mode + self._attr_entity_registry_enabled_default = mode == DAYNIGHT self.observation: dict[str, Any] | None = None self._forecast_hourly: list[dict[str, Any]] | None = None @@ -352,8 +353,3 @@ class NWSWeather(CoordinatorWeatherEntity): """ await self.coordinator.async_request_refresh() await self.coordinator_forecast_legacy.async_request_refresh() - - @property - def entity_registry_enabled_default(self) -> bool: - """Return if the entity should be enabled when first added to the entity registry.""" - return self.mode == DAYNIGHT