mirror of
https://github.com/home-assistant/core.git
synced 2025-08-03 20:55:10 +02:00
address comments
This commit is contained in:
@@ -39,6 +39,8 @@ from homeassistant.util.distance import convert as convert_distance
|
|||||||
from homeassistant.util.pressure import convert as convert_pressure
|
from homeassistant.util.pressure import convert as convert_pressure
|
||||||
from homeassistant.util.temperature import convert as convert_temperature
|
from homeassistant.util.temperature import convert as convert_temperature
|
||||||
|
|
||||||
|
from pynws import SimpleNWS
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
ATTRIBUTION = "Data from National Weather Service/NOAA"
|
ATTRIBUTION = "Data from National Weather Service/NOAA"
|
||||||
@@ -161,7 +163,6 @@ def convert_condition(time, weather):
|
|||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
||||||
"""Set up the NWS weather platform."""
|
"""Set up the NWS weather platform."""
|
||||||
from pynws import SimpleNWS
|
|
||||||
|
|
||||||
latitude = config.get(CONF_LATITUDE, hass.config.latitude)
|
latitude = config.get(CONF_LATITUDE, hass.config.latitude)
|
||||||
longitude = config.get(CONF_LONGITUDE, hass.config.longitude)
|
longitude = config.get(CONF_LONGITUDE, hass.config.longitude)
|
||||||
@@ -171,7 +172,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||||||
|
|
||||||
if None in (latitude, longitude):
|
if None in (latitude, longitude):
|
||||||
_LOGGER.error("Latitude/longitude not set in Home Assistant config")
|
_LOGGER.error("Latitude/longitude not set in Home Assistant config")
|
||||||
return ConfigEntryNotReady
|
return
|
||||||
|
|
||||||
websession = async_get_clientsession(hass)
|
websession = async_get_clientsession(hass)
|
||||||
# ID request as being from HA, pynws prepends the api_key in addition
|
# ID request as being from HA, pynws prepends the api_key in addition
|
||||||
@@ -234,7 +235,6 @@ class NWSWeather(WeatherEntity):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self._forecast = self.nws.forecast
|
self._forecast = self.nws.forecast
|
||||||
return
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def attribution(self):
|
def attribution(self):
|
||||||
|
Reference in New Issue
Block a user