diff --git a/homeassistant/components/logbook.py b/homeassistant/components/logbook.py
index d0b944793c4b50d11b83c4bc2d89f8a5610a31a6..1c3e8ed1f19607ace9274bfadcb5a2b0fc836964 100644
--- a/homeassistant/components/logbook.py
+++ b/homeassistant/components/logbook.py
@@ -139,9 +139,12 @@ class LogbookView(HomeAssistantView):
         end_day = start_day + timedelta(days=1)
         hass = request.app['hass']
 
-        events = yield from hass.async_add_job(
-            _get_events, hass, self.config, start_day, end_day)
-        response = yield from hass.async_add_job(self.json, events)
+        def json_events():
+            """Fetch events and generate JSON."""
+            return self.json(list(
+                _get_events(hass, self.config, start_day, end_day)))
+
+        response = yield from hass.async_add_job(json_events)
         return response
 
 
diff --git a/homeassistant/components/recorder/__init__.py b/homeassistant/components/recorder/__init__.py
index 392bccb56d4b397329a739750af9240d49c23c52..23c073ff80a3a9b8d73893d5a6c5d03740e208bf 100644
--- a/homeassistant/components/recorder/__init__.py
+++ b/homeassistant/components/recorder/__init__.py
@@ -29,6 +29,7 @@ import homeassistant.helpers.config_validation as cv
 from homeassistant.helpers.entityfilter import generate_filter
 from homeassistant.helpers.typing import ConfigType
 import homeassistant.util.dt as dt_util
+from homeassistant.loader import bind_hass
 
 from . import migration, purge
 from .const import DATA_INSTANCE
@@ -87,14 +88,10 @@ CONFIG_SCHEMA = vol.Schema({
 }, extra=vol.ALLOW_EXTRA)
 
 
-@asyncio.coroutine
-def wait_connection_ready(hass):
-    """
-    Wait till the connection is ready.
-
-    Returns a coroutine object.
-    """
-    return (yield from hass.data[DATA_INSTANCE].async_db_ready)
+@bind_hass
+async def wait_connection_ready(hass):
+    """Wait till the connection is ready."""
+    return await hass.data[DATA_INSTANCE].async_db_ready
 
 
 def run_information(hass, point_in_time: Optional[datetime] = None):
diff --git a/tests/components/test_history.py b/tests/components/test_history.py
index be768f5ec69ea9a851e3b091417113959cf5bb04..bea2af396cbc5efb4648cfafbffc68cea9a312e6 100644
--- a/tests/components/test_history.py
+++ b/tests/components/test_history.py
@@ -483,11 +483,13 @@ class TestComponentHistory(unittest.TestCase):
         return zero, four, states
 
 
-async def test_fetch_period_api(hass, test_client):
+async def test_fetch_period_api(hass, aiohttp_client):
     """Test the fetch period view for history."""
     await hass.async_add_job(init_recorder_component, hass)
     await async_setup_component(hass, 'history', {})
-    client = await test_client(hass.http.app)
+    await hass.components.recorder.wait_connection_ready()
+    await hass.async_add_job(hass.data[recorder.DATA_INSTANCE].block_till_done)
+    client = await aiohttp_client(hass.http.app)
     response = await client.get(
         '/api/history/period/{}'.format(dt_util.utcnow().isoformat()))
     assert response.status == 200
diff --git a/tests/components/test_logbook.py b/tests/components/test_logbook.py
index bd10416c7a28ae8e746416d9c2f2bb1decd342da..6c71a263afa39d0fac84728f829420aee82a7f53 100644
--- a/tests/components/test_logbook.py
+++ b/tests/components/test_logbook.py
@@ -10,8 +10,8 @@ from homeassistant.const import (
     EVENT_STATE_CHANGED, EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP,
     ATTR_HIDDEN, STATE_NOT_HOME, STATE_ON, STATE_OFF)
 import homeassistant.util.dt as dt_util
-from homeassistant.components import logbook
-from homeassistant.setup import setup_component
+from homeassistant.components import logbook, recorder
+from homeassistant.setup import setup_component, async_setup_component
 
 from tests.common import (
     init_recorder_component, get_test_home_assistant)
@@ -555,3 +555,15 @@ class TestComponentLogbook(unittest.TestCase):
             'old_state': state,
             'new_state': state,
         }, time_fired=event_time_fired)
+
+
+async def test_logbook_view(hass, aiohttp_client):
+    """Test the logbook view."""
+    await hass.async_add_job(init_recorder_component, hass)
+    await async_setup_component(hass, 'logbook', {})
+    await hass.components.recorder.wait_connection_ready()
+    await hass.async_add_job(hass.data[recorder.DATA_INSTANCE].block_till_done)
+    client = await aiohttp_client(hass.http.app)
+    response = await client.get(
+        '/api/logbook/{}'.format(dt_util.utcnow().isoformat()))
+    assert response.status == 200