Fix Prezzibenzina doing I/O in the event loop (#35881)

* Fix Prezzibenzina doing I/O in the event loop

* Linting
pull/36070/head
Aaron Bach 2020-05-20 16:09:00 -06:00 committed by Franck Nijhof
parent 534fcefae1
commit 43ec35ee17
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
1 changed files with 3 additions and 3 deletions

View File

@ -42,7 +42,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
)
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the PrezziBenzina sensor platform."""
station = config[CONF_STATION]
@ -65,7 +65,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
)
)
async_add_entities(dev, True)
add_entities(dev, True)
class PrezziBenzinaSensor(Entity):
@ -114,6 +114,6 @@ class PrezziBenzinaSensor(Entity):
}
return attrs
async def async_update(self):
def update(self):
"""Get the latest data and updates the states."""
self._data = self._client.get_by_id(self._station)[self._index]