Add live streaming logbook websocket endpoint (#72258)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
parent
3390d62b3d
commit
9c3f949165
17 changed files with 2592 additions and 733 deletions
|
@ -5,6 +5,7 @@ import json
|
|||
from typing import Any
|
||||
|
||||
from homeassistant.components import logbook
|
||||
from homeassistant.components.logbook import processor
|
||||
from homeassistant.components.recorder.models import process_timestamp_to_utc_isoformat
|
||||
from homeassistant.core import Context
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
@ -50,16 +51,26 @@ class MockRow:
|
|||
|
||||
def mock_humanify(hass_, rows):
|
||||
"""Wrap humanify with mocked logbook objects."""
|
||||
entity_name_cache = logbook.EntityNameCache(hass_)
|
||||
entity_name_cache = processor.EntityNameCache(hass_)
|
||||
ent_reg = er.async_get(hass_)
|
||||
event_cache = processor.EventCache({})
|
||||
context_lookup = processor.ContextLookup(hass_)
|
||||
external_events = hass_.data.get(logbook.DOMAIN, {})
|
||||
logbook_run = processor.LogbookRun(
|
||||
context_lookup,
|
||||
external_events,
|
||||
event_cache,
|
||||
entity_name_cache,
|
||||
include_entity_name=True,
|
||||
format_time=processor._row_time_fired_isoformat,
|
||||
)
|
||||
context_augmenter = processor.ContextAugmenter(logbook_run)
|
||||
return list(
|
||||
logbook._humanify(
|
||||
processor._humanify(
|
||||
rows,
|
||||
None,
|
||||
ent_reg,
|
||||
external_events,
|
||||
entity_name_cache,
|
||||
logbook._row_time_fired_isoformat,
|
||||
logbook_run,
|
||||
context_augmenter,
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue