Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for streaming (push) history #85892

Merged
merged 39 commits into from
Jan 22, 2023
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
980b672
Add support for streaming (push) history
bdraco Jan 14, 2023
3095055
Update homeassistant/components/history/__init__.py
bdraco Jan 14, 2023
7fae8cd
merge filter
bdraco Jan 14, 2023
96566e9
Merge remote-tracking branch 'origin/history_stream' into history_stream
bdraco Jan 14, 2023
6ab7af6
expose new api
bdraco Jan 14, 2023
8017359
expose new api
bdraco Jan 14, 2023
9b4f96d
expose new api
bdraco Jan 14, 2023
9efca7b
expose new api
bdraco Jan 14, 2023
839b80e
coverage
bdraco Jan 14, 2023
170013a
tests
bdraco Jan 14, 2023
f7b7516
fixes
bdraco Jan 15, 2023
3c2ffdf
tweak
bdraco Jan 15, 2023
695b55b
tweak
bdraco Jan 15, 2023
9f7c13b
tweak
bdraco Jan 15, 2023
2c7c359
DRY
bdraco Jan 15, 2023
9886945
leaky
bdraco Jan 15, 2023
d05e8f6
Merge branch 'dev' into history_stream
bdraco Jan 15, 2023
3f49518
test for specific entities
bdraco Jan 15, 2023
f66d56e
test for specific entities
bdraco Jan 15, 2023
015dc5c
test for specific entities
bdraco Jan 15, 2023
ee1aab4
test for specific entities
bdraco Jan 15, 2023
86dced4
test for specific entities
bdraco Jan 15, 2023
0dd0e03
Merge remote-tracking branch 'origin/history_stream' into history_stream
bdraco Jan 15, 2023
f8399b3
cover
bdraco Jan 15, 2023
7e5e69c
cover
bdraco Jan 15, 2023
b7aad92
more cover
bdraco Jan 15, 2023
098489e
tweak
bdraco Jan 15, 2023
3a938c5
make sure it works before history starts
bdraco Jan 15, 2023
b163830
fix test
bdraco Jan 15, 2023
451283e
cover
bdraco Jan 15, 2023
e0d257a
tweak
bdraco Jan 15, 2023
d9c06a5
make sure we unsub on overflow
bdraco Jan 16, 2023
3209482
Update homeassistant/components/history/__init__.py
bdraco Jan 16, 2023
f0a56f5
Update homeassistant/components/history/__init__.py
bdraco Jan 16, 2023
3e5331a
fix race in test
bdraco Jan 16, 2023
dc2e823
Merge remote-tracking branch 'origin/history_stream' into history_stream
bdraco Jan 16, 2023
bad23c5
Merge branch 'dev' into history_stream
bdraco Jan 16, 2023
727e4e3
fix db executor access
bdraco Jan 16, 2023
191353d
relo above task creation
bdraco Jan 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cover
  • Loading branch information
bdraco committed Jan 15, 2023
commit 7e5e69c2aa95249d9114d902efbd87a67f47e129
11 changes: 5 additions & 6 deletions homeassistant/components/history/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,19 +555,18 @@ def _async_subscribe_events(
@callback
def _forward_state_events_filtered(event: Event) -> None:
"""Filter state events and forward them."""
if (new_state := event.data.get("new_state")) is None:
if (new_state := event.data.get("new_state")) is None or (
old_state := event.data.get("old_state")
) is None:
return
assert isinstance(new_state, State)
if entities_filter and not entities_filter(new_state.entity_id):
return
if (old_state := event.data.get("old_state")) is None:
return
assert isinstance(old_state, State)
state_changed = new_state.state != old_state.state
if (
not state_changed
(significant_changes_only or minimal_response)
and new_state.state == old_state.state
and not new_state.domain not in history.SIGNIFICANT_DOMAINS
and (significant_changes_only or minimal_response)
):
return
target(event)
Expand Down