Move imports in recollect_waste component (#28089)
This commit is contained in:
parent
40fbfe7a93
commit
0193207b5c
1 changed files with 2 additions and 8 deletions
|
@ -1,11 +1,12 @@
|
||||||
"""Support for Recollect Waste curbside collection pickup."""
|
"""Support for Recollect Waste curbside collection pickup."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import recollect_waste
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -29,9 +30,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Recollect Waste platform."""
|
"""Set up the Recollect Waste platform."""
|
||||||
import recollect_waste
|
|
||||||
|
|
||||||
# pylint: disable=no-member
|
|
||||||
client = recollect_waste.RecollectWasteClient(
|
client = recollect_waste.RecollectWasteClient(
|
||||||
config[CONF_PLACE_ID], config[CONF_SERVICE_ID]
|
config[CONF_PLACE_ID], config[CONF_SERVICE_ID]
|
||||||
)
|
)
|
||||||
|
@ -40,7 +38,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
# with given place_id and service_id.
|
# with given place_id and service_id.
|
||||||
try:
|
try:
|
||||||
client.get_next_pickup()
|
client.get_next_pickup()
|
||||||
# pylint: disable=no-member
|
|
||||||
except recollect_waste.RecollectWasteException as ex:
|
except recollect_waste.RecollectWasteException as ex:
|
||||||
_LOGGER.error("Recollect Waste platform error. %s", ex)
|
_LOGGER.error("Recollect Waste platform error. %s", ex)
|
||||||
return
|
return
|
||||||
|
@ -85,8 +82,6 @@ class RecollectWasteSensor(Entity):
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Update device state."""
|
"""Update device state."""
|
||||||
import recollect_waste
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pickup_event = self.client.get_next_pickup()
|
pickup_event = self.client.get_next_pickup()
|
||||||
self._state = pickup_event.event_date
|
self._state = pickup_event.event_date
|
||||||
|
@ -96,6 +91,5 @@ class RecollectWasteSensor(Entity):
|
||||||
ATTR_AREA_NAME: pickup_event.area_name,
|
ATTR_AREA_NAME: pickup_event.area_name,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
# pylint: disable=no-member
|
|
||||||
except recollect_waste.RecollectWasteException as ex:
|
except recollect_waste.RecollectWasteException as ex:
|
||||||
_LOGGER.error("Recollect Waste platform error. %s", ex)
|
_LOGGER.error("Recollect Waste platform error. %s", ex)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue