HAClient.fetch_logbook (src/hatty/client.py:268-280) sends the entity filter as
params["entity_id"]:
url = f"{self.base_url}/api/logbook/{start}"
params: dict = {"end_time": end.isoformat()}
if entity_ids:
params["entity_id"] = ",".join(entity_ids)
Home Assistant's /api/logbook/<start> REST endpoint reads the filter from entity,
not entity_id (homeassistant/components/logbook/rest_api.py: request.query.get("entity")
→ cv.entity_ids(...), comma-separated; when absent, entity_ids = None and the query is
unrestricted). The sibling history fetcher gets it right — _fetch_raw_history
(client.py:291) uses filter_entity_id, which is why graphs show the correct entity but
the activity log doesn't.
Effect: every activity log — the main screen's a/A/i and the fullscreen graph's
a — silently degrades to a whole-instance logbook query. ActivityLogPanel.load_history
does no client-side filtering, so it renders everything HA returns, and the 2000-line cap
on the Log widget truncates it further. This is why the log appears to show "related
entities instead of the one trying to view contents for," and why the actual entity's
history may not even make it into the visible window.
Nothing in the test suite catches this: tests/unit/test_client_logbook.py only asserts
end_time/start, tests/conftest.py's FakeHAClient.fetch_logbook fakes the method
directly (no URL/params built), and --demo mode filters in Python
(demo_data.demo_logbook) rather than building a real query — so the bug is invisible in
demo mode and only shows up against a real HA instance.
Fix: rename the query param to entity in fetch_logbook.
HAClient.fetch_logbook(src/hatty/client.py:268-280) sends the entity filter asparams["entity_id"]:Home Assistant's
/api/logbook/<start>REST endpoint reads the filter fromentity,not
entity_id(homeassistant/components/logbook/rest_api.py:request.query.get("entity")→
cv.entity_ids(...), comma-separated; when absent,entity_ids = Noneand the query isunrestricted). The sibling history fetcher gets it right —
_fetch_raw_history(
client.py:291) usesfilter_entity_id, which is why graphs show the correct entity butthe activity log doesn't.
Effect: every activity log — the main screen's
a/A/iand the fullscreen graph'sa— silently degrades to a whole-instance logbook query.ActivityLogPanel.load_historydoes no client-side filtering, so it renders everything HA returns, and the 2000-line cap
on the
Logwidget truncates it further. This is why the log appears to show "relatedentities instead of the one trying to view contents for," and why the actual entity's
history may not even make it into the visible window.
Nothing in the test suite catches this:
tests/unit/test_client_logbook.pyonly assertsend_time/start,tests/conftest.py'sFakeHAClient.fetch_logbookfakes the methoddirectly (no URL/params built), and
--demomode filters in Python(
demo_data.demo_logbook) rather than building a real query — so the bug is invisible indemo mode and only shows up against a real HA instance.
Fix: rename the query param to
entityinfetch_logbook.