Fix logbook JSON serialize issue (#13229)
* Fix logbook JSON serialize issue * Address flakiness * Lint * deflake ? * Deflake 2
This commit is contained in:
1 parent
ee6d6a8859
commit
170b8671b9
4 files changed
+29
-15
No files matched your search
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in new issue
Block a user