diff --git a/homeassistant/components/rflink/__init__.py b/homeassistant/components/rflink/__init__.py
index c218bc271ce7c9f0f4f4d60058fd690f4a8c0b09..b3e1d2b16b7617338c7b00c97f489aad3b3d3b38 100644
--- a/homeassistant/components/rflink/__init__.py
+++ b/homeassistant/components/rflink/__init__.py
@@ -2,8 +2,10 @@
 import asyncio
 from collections import defaultdict
 import logging
-import async_timeout
 
+import async_timeout
+from rflink.protocol import create_rflink_connection
+from serial import SerialException
 import voluptuous as vol
 
 from homeassistant.const import (
@@ -11,18 +13,18 @@ from homeassistant.const import (
     CONF_COMMAND,
     CONF_HOST,
     CONF_PORT,
-    STATE_ON,
     EVENT_HOMEASSISTANT_STOP,
+    STATE_ON,
 )
 from homeassistant.core import CoreState, callback
 from homeassistant.exceptions import HomeAssistantError
 import homeassistant.helpers.config_validation as cv
 from homeassistant.helpers.deprecation import get_deprecated
-from homeassistant.helpers.entity import Entity
 from homeassistant.helpers.dispatcher import (
-    async_dispatcher_send,
     async_dispatcher_connect,
+    async_dispatcher_send,
 )
+from homeassistant.helpers.entity import Entity
 from homeassistant.helpers.restore_state import RestoreEntity
 
 _LOGGER = logging.getLogger(__name__)
@@ -118,9 +120,6 @@ def identify_event_type(event):
 
 async def async_setup(hass, config):
     """Set up the Rflink component."""
-    from rflink.protocol import create_rflink_connection
-    import serial
-
     # Allow entities to register themselves by device_id to be looked up when
     # new rflink events arrive to be handled
     hass.data[DATA_ENTITY_LOOKUP] = {
@@ -239,7 +238,7 @@ async def async_setup(hass, config):
                 transport, protocol = await connection
 
         except (
-            serial.serialutil.SerialException,
+            SerialException,
             ConnectionRefusedError,
             TimeoutError,
             OSError,
diff --git a/homeassistant/components/rflink/sensor.py b/homeassistant/components/rflink/sensor.py
index 48484621c4d80e903a4b7a3bc75f3112bbd57e19..aa0ef4f9c62b6f88f74b16111524b0fea1640216 100644
--- a/homeassistant/components/rflink/sensor.py
+++ b/homeassistant/components/rflink/sensor.py
@@ -1,6 +1,7 @@
 """Support for Rflink sensors."""
 import logging
 
+from rflink.parser import PACKET_FIELDS, UNITS
 import voluptuous as vol
 
 from homeassistant.components.sensor import PLATFORM_SCHEMA
@@ -66,8 +67,6 @@ def lookup_unit_for_sensor_type(sensor_type):
 
     Async friendly.
     """
-    from rflink.parser import UNITS, PACKET_FIELDS
-
     field_abbrev = {v: k for k, v in PACKET_FIELDS.items()}
 
     return UNITS.get(field_abbrev.get(sensor_type))
diff --git a/tests/components/rflink/test_binary_sensor.py b/tests/components/rflink/test_binary_sensor.py
index 442ebebdffe9329ed3b4d52b89b79c0696347046..d1fdec579c9db88f692d5137afd444956e57f012 100644
--- a/tests/components/rflink/test_binary_sensor.py
+++ b/tests/components/rflink/test_binary_sensor.py
@@ -8,14 +8,13 @@ from datetime import timedelta
 from unittest.mock import patch
 
 from homeassistant.components.rflink import CONF_RECONNECT_INTERVAL
-
-import homeassistant.core as ha
 from homeassistant.const import (
     EVENT_STATE_CHANGED,
-    STATE_ON,
     STATE_OFF,
+    STATE_ON,
     STATE_UNAVAILABLE,
 )
+import homeassistant.core as ha
 import homeassistant.util.dt as dt_util
 
 from tests.common import async_fire_time_changed
diff --git a/tests/components/rflink/test_cover.py b/tests/components/rflink/test_cover.py
index 858258e7efd0c4b6bf823f8be4a6ab45e1af5900..dc286502068b68bff6eb02e48be52030dcfd9ea2 100644
--- a/tests/components/rflink/test_cover.py
+++ b/tests/components/rflink/test_cover.py
@@ -9,13 +9,13 @@ import logging
 
 from homeassistant.components.rflink import EVENT_BUTTON_PRESSED
 from homeassistant.const import (
-    SERVICE_OPEN_COVER,
+    ATTR_ENTITY_ID,
     SERVICE_CLOSE_COVER,
-    STATE_OPEN,
+    SERVICE_OPEN_COVER,
     STATE_CLOSED,
-    ATTR_ENTITY_ID,
+    STATE_OPEN,
 )
-from homeassistant.core import callback, State, CoreState
+from homeassistant.core import CoreState, State, callback
 
 from tests.common import mock_restore_cache
 from tests.components.rflink.test_init import mock_rflink
diff --git a/tests/components/rflink/test_init.py b/tests/components/rflink/test_init.py
index 5e821fbdeb225ac1709a312c7713f552f5e81e42..df96b0e87aea9cd3fe591bc87af79b9dcda65e72 100644
--- a/tests/components/rflink/test_init.py
+++ b/tests/components/rflink/test_init.py
@@ -5,14 +5,14 @@ from unittest.mock import Mock
 from homeassistant.bootstrap import async_setup_component
 from homeassistant.components.rflink import (
     CONF_RECONNECT_INTERVAL,
-    SERVICE_SEND_COMMAND,
-    RflinkCommand,
-    TMP_ENTITY,
     DATA_ENTITY_LOOKUP,
     EVENT_KEY_COMMAND,
     EVENT_KEY_SENSOR,
+    SERVICE_SEND_COMMAND,
+    TMP_ENTITY,
+    RflinkCommand,
 )
-from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_STOP_COVER
+from homeassistant.const import ATTR_ENTITY_ID, SERVICE_STOP_COVER, SERVICE_TURN_OFF
 
 
 async def mock_rflink(
@@ -46,7 +46,9 @@ async def mock_rflink(
             return transport, protocol
 
     mock_create = Mock(wraps=create_rflink_connection)
-    monkeypatch.setattr("rflink.protocol.create_rflink_connection", mock_create)
+    monkeypatch.setattr(
+        "homeassistant.components.rflink.create_rflink_connection", mock_create
+    )
 
     await async_setup_component(hass, "rflink", config)
     await async_setup_component(hass, domain, config)
diff --git a/tests/components/rflink/test_light.py b/tests/components/rflink/test_light.py
index a22e7680ac846adaebe72d890d50fed60aa72f18..b22730a331093bd8f8d0e39d4af1980e3c957d8c 100644
--- a/tests/components/rflink/test_light.py
+++ b/tests/components/rflink/test_light.py
@@ -11,10 +11,10 @@ from homeassistant.const import (
     ATTR_ENTITY_ID,
     SERVICE_TURN_OFF,
     SERVICE_TURN_ON,
-    STATE_ON,
     STATE_OFF,
+    STATE_ON,
 )
-from homeassistant.core import callback, State, CoreState
+from homeassistant.core import CoreState, State, callback
 
 from tests.common import mock_restore_cache
 from tests.components.rflink.test_init import mock_rflink
diff --git a/tests/components/rflink/test_sensor.py b/tests/components/rflink/test_sensor.py
index bf6c9e03fbc39516637da35aa54f622b0e70ea23..3fea3ef6ef4cda11dd30120ab766792fa74484bf 100644
--- a/tests/components/rflink/test_sensor.py
+++ b/tests/components/rflink/test_sensor.py
@@ -7,12 +7,13 @@ automatic sensor creation.
 
 from homeassistant.components.rflink import (
     CONF_RECONNECT_INTERVAL,
-    TMP_ENTITY,
     DATA_ENTITY_LOOKUP,
     EVENT_KEY_COMMAND,
     EVENT_KEY_SENSOR,
+    TMP_ENTITY,
 )
 from homeassistant.const import STATE_UNKNOWN
+
 from tests.components.rflink.test_init import mock_rflink
 
 DOMAIN = "sensor"
diff --git a/tests/components/rflink/test_switch.py b/tests/components/rflink/test_switch.py
index 4503f1a232f29a50f2ea82f8b792c93deabd240e..d1fced3320807e0575e908e5a99d05ec22b65fa9 100644
--- a/tests/components/rflink/test_switch.py
+++ b/tests/components/rflink/test_switch.py
@@ -10,10 +10,10 @@ from homeassistant.const import (
     ATTR_ENTITY_ID,
     SERVICE_TURN_OFF,
     SERVICE_TURN_ON,
-    STATE_ON,
     STATE_OFF,
+    STATE_ON,
 )
-from homeassistant.core import callback, State, CoreState
+from homeassistant.core import CoreState, State, callback
 
 from tests.common import mock_restore_cache
 from tests.components.rflink.test_init import mock_rflink