move imports in serial component (#27971)

pull/27980/head
David Bonnes 2019-10-20 19:46:24 +01:00 committed by Fabian Affolter
parent 57b6c2c6b0
commit 6951d78874
1 changed files with 3 additions and 4 deletions

View File

@ -1,12 +1,13 @@
"""Support for reading data from a serial port."""
import logging
import json
import logging
import serial_asyncio
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_NAME, CONF_VALUE_TEMPLATE, EVENT_HOMEASSISTANT_STOP
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
@ -64,8 +65,6 @@ class SerialSensor(Entity):
async def serial_read(self, device, rate, **kwargs):
"""Read the data from the port."""
import serial_asyncio
reader, _ = await serial_asyncio.open_serial_connection(
url=device, baudrate=rate, **kwargs
)