mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Bump pyipma to 3.0.5 (#78936)
* fix #78928 and review of #78332 * address comment
This commit is contained in:
parent
08ebb9f31a
commit
67779089cd
@ -1,4 +1,5 @@
|
|||||||
"""Component for the Portuguese weather service - IPMA."""
|
"""Component for the Portuguese weather service - IPMA."""
|
||||||
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import async_timeout
|
import async_timeout
|
||||||
@ -22,22 +23,21 @@ PLATFORMS = [Platform.WEATHER]
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_get_api(hass):
|
|
||||||
"""Get the pyipma api object."""
|
|
||||||
websession = async_get_clientsession(hass)
|
|
||||||
return IPMA_API(websession)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||||
"""Set up IPMA station as config entry."""
|
"""Set up IPMA station as config entry."""
|
||||||
|
|
||||||
latitude = config_entry.data[CONF_LATITUDE]
|
latitude = config_entry.data[CONF_LATITUDE]
|
||||||
longitude = config_entry.data[CONF_LONGITUDE]
|
longitude = config_entry.data[CONF_LONGITUDE]
|
||||||
|
|
||||||
api = await async_get_api(hass)
|
api = IPMA_API(async_get_clientsession(hass))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with async_timeout.timeout(30):
|
async with async_timeout.timeout(30):
|
||||||
location = await Location.get(api, float(latitude), float(longitude))
|
location = await Location.get(api, float(latitude), float(longitude))
|
||||||
|
except (IPMAException, asyncio.TimeoutError) as err:
|
||||||
|
raise ConfigEntryNotReady(
|
||||||
|
f"Could not get location for ({latitude},{longitude})"
|
||||||
|
) from err
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Initializing for coordinates %s, %s -> station %s (%d, %d)",
|
"Initializing for coordinates %s, %s -> station %s (%d, %d)",
|
||||||
@ -47,10 +47,6 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
|||||||
location.id_station,
|
location.id_station,
|
||||||
location.global_id_local,
|
location.global_id_local,
|
||||||
)
|
)
|
||||||
except IPMAException as err:
|
|
||||||
raise ConfigEntryNotReady(
|
|
||||||
f"Could not get location for ({latitude},{longitude})"
|
|
||||||
) from err
|
|
||||||
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][config_entry.entry_id] = {DATA_API: api, DATA_LOCATION: location}
|
hass.data[DOMAIN][config_entry.entry_id] = {DATA_API: api, DATA_LOCATION: location}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Instituto Portugu\u00eas do Mar e Atmosfera (IPMA)",
|
"name": "Instituto Portugu\u00eas do Mar e Atmosfera (IPMA)",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/ipma",
|
"documentation": "https://www.home-assistant.io/integrations/ipma",
|
||||||
"requirements": ["pyipma==3.0.4"],
|
"requirements": ["pyipma==3.0.5"],
|
||||||
"codeowners": ["@dgomes", "@abmantis"],
|
"codeowners": ["@dgomes", "@abmantis"],
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"loggers": ["geopy", "pyipma"]
|
"loggers": ["geopy", "pyipma"]
|
||||||
|
@ -1622,7 +1622,7 @@ pyinsteon==1.2.0
|
|||||||
pyintesishome==1.8.0
|
pyintesishome==1.8.0
|
||||||
|
|
||||||
# homeassistant.components.ipma
|
# homeassistant.components.ipma
|
||||||
pyipma==3.0.4
|
pyipma==3.0.5
|
||||||
|
|
||||||
# homeassistant.components.ipp
|
# homeassistant.components.ipp
|
||||||
pyipp==0.11.0
|
pyipp==0.11.0
|
||||||
|
@ -1132,7 +1132,7 @@ pyicloud==1.0.0
|
|||||||
pyinsteon==1.2.0
|
pyinsteon==1.2.0
|
||||||
|
|
||||||
# homeassistant.components.ipma
|
# homeassistant.components.ipma
|
||||||
pyipma==3.0.4
|
pyipma==3.0.5
|
||||||
|
|
||||||
# homeassistant.components.ipp
|
# homeassistant.components.ipp
|
||||||
pyipp==0.11.0
|
pyipp==0.11.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user