Avoid matching entity_id/domain attributes in logbook when there is no entities_filter (#71825)
This commit is contained in:
parent
08ee276277
commit
2a2a7a62c5
2 changed files with 45 additions and 31 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue