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
This commit is contained in:
J. Nick Koston 2023-09-12 13:12:14 -05:00 committed by GitHub
parent 93f3bc6c2b
commit 70c6bceaee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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