mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Upgrade python_opendata_transport to 0.1.0 (#14652)
This commit is contained in:
parent
cc2437614b
commit
bff1e1ff6c
@ -4,7 +4,6 @@ Support for transport.opendata.ch.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/sensor.swiss_public_transport/
|
https://home-assistant.io/components/sensor.swiss_public_transport/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -17,7 +16,7 @@ import homeassistant.helpers.config_validation as cv
|
|||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
REQUIREMENTS = ['python_opendata_transport==0.0.3']
|
REQUIREMENTS = ['python_opendata_transport==0.1.0']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -48,8 +47,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
hass, config, async_add_devices, discovery_info=None):
|
||||||
"""Set up the Swiss public transport sensor."""
|
"""Set up the Swiss public transport sensor."""
|
||||||
from opendata_transport import OpendataTransport, exceptions
|
from opendata_transport import OpendataTransport, exceptions
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
opendata = OpendataTransport(start, destination, hass.loop, session)
|
opendata = OpendataTransport(start, destination, hass.loop, session)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
yield from opendata.async_get_data()
|
await opendata.async_get_data()
|
||||||
except exceptions.OpendataTransportError:
|
except exceptions.OpendataTransportError:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Check at http://transport.opendata.ch/examples/stationboard.html "
|
"Check at http://transport.opendata.ch/examples/stationboard.html "
|
||||||
@ -122,12 +121,11 @@ class SwissPublicTransportSensor(Entity):
|
|||||||
"""Icon to use in the frontend, if any."""
|
"""Icon to use in the frontend, if any."""
|
||||||
return ICON
|
return ICON
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_update(self):
|
||||||
def async_update(self):
|
|
||||||
"""Get the latest data from opendata.ch and update the states."""
|
"""Get the latest data from opendata.ch and update the states."""
|
||||||
from opendata_transport.exceptions import OpendataTransportError
|
from opendata_transport.exceptions import OpendataTransportError
|
||||||
|
|
||||||
try:
|
try:
|
||||||
yield from self._opendata.async_get_data()
|
await self._opendata.async_get_data()
|
||||||
except OpendataTransportError:
|
except OpendataTransportError:
|
||||||
_LOGGER.error("Unable to retrieve data from transport.opendata.ch")
|
_LOGGER.error("Unable to retrieve data from transport.opendata.ch")
|
||||||
|
@ -1069,7 +1069,7 @@ python-vlc==1.1.2
|
|||||||
python-wink==1.7.3
|
python-wink==1.7.3
|
||||||
|
|
||||||
# homeassistant.components.sensor.swiss_public_transport
|
# homeassistant.components.sensor.swiss_public_transport
|
||||||
python_opendata_transport==0.0.3
|
python_opendata_transport==0.1.0
|
||||||
|
|
||||||
# homeassistant.components.zwave
|
# homeassistant.components.zwave
|
||||||
python_openzwave==0.4.3
|
python_openzwave==0.4.3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user