Move imports in vera component (#27477)

This commit is contained in:
Quentame 2019-10-12 21:55:40 +02:00 committed by Paulus Schoutsen
parent eaf855286b
commit bac337889f
2 changed files with 3 additions and 4 deletions

View file

@ -2,6 +2,7 @@
import logging import logging
from collections import defaultdict from collections import defaultdict
import pyvera as veraApi
import voluptuous as vol import voluptuous as vol
from requests.exceptions import RequestException from requests.exceptions import RequestException
@ -65,7 +66,6 @@ VERA_COMPONENTS = [
def setup(hass, base_config): def setup(hass, base_config):
"""Set up for Vera devices.""" """Set up for Vera devices."""
import pyvera as veraApi
def stop_subscription(event): def stop_subscription(event):
"""Shutdown Vera subscriptions and subscription thread on exit.""" """Shutdown Vera subscriptions and subscription thread on exit."""
@ -118,7 +118,6 @@ def setup(hass, base_config):
def map_vera_device(vera_device, remap): def map_vera_device(vera_device, remap):
"""Map vera classes to Home Assistant types.""" """Map vera classes to Home Assistant types."""
import pyvera as veraApi
if isinstance(vera_device, veraApi.VeraDimmer): if isinstance(vera_device, veraApi.VeraDimmer):
return "light" return "light"

View file

@ -2,6 +2,8 @@
from datetime import timedelta from datetime import timedelta
import logging import logging
import pyvera as veraApi
from homeassistant.components.sensor import ENTITY_ID_FORMAT from homeassistant.components.sensor import ENTITY_ID_FORMAT
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
@ -44,7 +46,6 @@ class VeraSensor(VeraDevice, Entity):
@property @property
def unit_of_measurement(self): def unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any.""" """Return the unit of measurement of this entity, if any."""
import pyvera as veraApi
if self.vera_device.category == veraApi.CATEGORY_TEMPERATURE_SENSOR: if self.vera_device.category == veraApi.CATEGORY_TEMPERATURE_SENSOR:
return self._temperature_units return self._temperature_units
@ -59,7 +60,6 @@ class VeraSensor(VeraDevice, Entity):
def update(self): def update(self):
"""Update the state.""" """Update the state."""
import pyvera as veraApi
if self.vera_device.category == veraApi.CATEGORY_TEMPERATURE_SENSOR: if self.vera_device.category == veraApi.CATEGORY_TEMPERATURE_SENSOR:
self.current_value = self.vera_device.temperature self.current_value = self.vera_device.temperature