Skip to content

Commit

Permalink
higher timeouts and cut headline, add integration attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Dec 25, 2019
1 parent c18976c commit 705c1d6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions custom_components/weatheralerts/sensor.py
Expand Up @@ -38,7 +38,7 @@ async def async_setup_platform(

# Check the zoneid
try:
async with async_timeout.timeout(5, loop=hass.loop):
async with async_timeout.timeout(10, loop=hass.loop):
response = await session.get(URL.format(zoneid))
data = await response.json()

Expand Down Expand Up @@ -71,7 +71,7 @@ async def async_update(self):
alerts = []

try:
async with async_timeout.timeout(5, loop=self.hass.loop):
async with async_timeout.timeout(10, loop=self.hass.loop):
response = await self.session.get(URL.format(self.zoneid))
data = await response.json()

Expand All @@ -90,13 +90,15 @@ async def async_update(self):
"response": properties["response"],
"sent": properties["sent"],
"severity": properties["severity"],
"title": properties["headline"],
"title": properties["headline"].split(" issued ")[
0
],
"urgency": properties["urgency"],
}
)

self._state = len(alerts)
self._attr = {"alerts": alerts}
self._attr = {"alerts": alerts, "integration": "weatheralerts"}
except Exception as exception: # pylint: disable=broad-except
_LOGGER.error(exception)

Expand Down

0 comments on commit 705c1d6

Please sign in to comment.