mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
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:
parent
93f3bc6c2b
commit
70c6bceaee
@ -149,6 +149,7 @@ class NWSWeather(CoordinatorWeatherEntity):
|
|||||||
self.station = self.nws.station
|
self.station = self.nws.station
|
||||||
|
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
|
self._attr_entity_registry_enabled_default = mode == DAYNIGHT
|
||||||
|
|
||||||
self.observation: dict[str, Any] | None = None
|
self.observation: dict[str, Any] | None = None
|
||||||
self._forecast_hourly: list[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.async_request_refresh()
|
||||||
await self.coordinator_forecast_legacy.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
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user