mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 04:50:05 +00:00
Avoid matching entity_id/domain attributes in logbook when there is no entities_filter (#71825)
This commit is contained in:
@@ -1761,13 +1761,21 @@ async def test_fire_logbook_entries(hass, hass_client, recorder_mock):
|
||||
logbook.EVENT_LOGBOOK_ENTRY,
|
||||
{},
|
||||
)
|
||||
hass.bus.async_fire(
|
||||
logbook.EVENT_LOGBOOK_ENTRY,
|
||||
{
|
||||
logbook.ATTR_NAME: "Alarm",
|
||||
logbook.ATTR_MESSAGE: "is triggered",
|
||||
logbook.ATTR_DOMAIN: "switch",
|
||||
},
|
||||
)
|
||||
await async_wait_recording_done(hass)
|
||||
|
||||
client = await hass_client()
|
||||
response_json = await _async_fetch_logbook(client)
|
||||
|
||||
# The empty events should be skipped
|
||||
assert len(response_json) == 10
|
||||
assert len(response_json) == 11
|
||||
|
||||
|
||||
async def test_exclude_events_domain(hass, hass_client, recorder_mock):
|
||||
@@ -1986,6 +1994,15 @@ async def test_include_events_domain_glob(hass, hass_client, recorder_mock):
|
||||
)
|
||||
await async_recorder_block_till_done(hass)
|
||||
|
||||
# Should get excluded by domain
|
||||
hass.bus.async_fire(
|
||||
logbook.EVENT_LOGBOOK_ENTRY,
|
||||
{
|
||||
logbook.ATTR_NAME: "Alarm",
|
||||
logbook.ATTR_MESSAGE: "is triggered",
|
||||
logbook.ATTR_DOMAIN: "switch",
|
||||
},
|
||||
)
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_START)
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_STARTED)
|
||||
hass.bus.async_fire(
|
||||
|
||||
Reference in New Issue
Block a user