mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Remove redundant coordinator reference in OpenWeatherMap sensor (#144548)
Remove redundant coordinator reference
This commit is contained in:
parent
47455fee41
commit
031b25cd1e
@ -50,7 +50,6 @@ from .const import (
|
|||||||
MANUFACTURER,
|
MANUFACTURER,
|
||||||
OWM_MODE_FREE_FORECAST,
|
OWM_MODE_FREE_FORECAST,
|
||||||
)
|
)
|
||||||
from .coordinator import WeatherUpdateCoordinator
|
|
||||||
|
|
||||||
WEATHER_SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
WEATHER_SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
@ -229,20 +228,7 @@ class AbstractOpenWeatherMapSensor(SensorEntity):
|
|||||||
class OpenWeatherMapSensor(AbstractOpenWeatherMapSensor):
|
class OpenWeatherMapSensor(AbstractOpenWeatherMapSensor):
|
||||||
"""Implementation of an OpenWeatherMap sensor."""
|
"""Implementation of an OpenWeatherMap sensor."""
|
||||||
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
name: str,
|
|
||||||
unique_id: str,
|
|
||||||
description: SensorEntityDescription,
|
|
||||||
weather_coordinator: WeatherUpdateCoordinator,
|
|
||||||
) -> None:
|
|
||||||
"""Initialize the sensor."""
|
|
||||||
super().__init__(name, unique_id, description, weather_coordinator)
|
|
||||||
self._weather_coordinator = weather_coordinator
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> StateType:
|
def native_value(self) -> StateType:
|
||||||
"""Return the state of the device."""
|
"""Return the state of the device."""
|
||||||
return self._weather_coordinator.data[ATTR_API_CURRENT].get(
|
return self._coordinator.data[ATTR_API_CURRENT].get(self.entity_description.key)
|
||||||
self.entity_description.key
|
|
||||||
)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user