mirror of
https://github.com/home-assistant/core.git
synced 2025-04-30 12:17:52 +00:00
Prevent live logbook from sending state changed events when we only want device ids (#72780)
This commit is contained in:
parent
7854aaa746
commit
35ee4ad55b
@ -132,6 +132,12 @@ def async_subscribe_events(
|
|||||||
if not _is_state_filtered(ent_reg, state):
|
if not _is_state_filtered(ent_reg, state):
|
||||||
target(event)
|
target(event)
|
||||||
|
|
||||||
|
if device_ids and not entity_ids:
|
||||||
|
# No entities to subscribe to but we are filtering
|
||||||
|
# on device ids so we do not want to get any state
|
||||||
|
# changed events
|
||||||
|
return
|
||||||
|
|
||||||
if entity_ids:
|
if entity_ids:
|
||||||
subscriptions.append(
|
subscriptions.append(
|
||||||
async_track_state_change_event(
|
async_track_state_change_event(
|
||||||
|
@ -1743,6 +1743,8 @@ async def test_subscribe_unsubscribe_logbook_stream_device(
|
|||||||
assert msg["type"] == "event"
|
assert msg["type"] == "event"
|
||||||
assert msg["event"]["events"] == []
|
assert msg["event"]["events"] == []
|
||||||
|
|
||||||
|
hass.states.async_set("binary_sensor.should_not_appear", STATE_ON)
|
||||||
|
hass.states.async_set("binary_sensor.should_not_appear", STATE_OFF)
|
||||||
hass.bus.async_fire("mock_event", {"device_id": device.id})
|
hass.bus.async_fire("mock_event", {"device_id": device.id})
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user