Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
c81d5a1a
Unverified
Commit
c81d5a1a
authored
9 months ago
by
J. Nick Koston
Committed by
GitHub
9 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Handle empty entity_id in the recorder filter (#121681)
fixes #111745
parent
8b729e3c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
homeassistant/components/recorder/core.py
+2
-3
2 additions, 3 deletions
homeassistant/components/recorder/core.py
tests/components/recorder/test_init.py
+17
-0
17 additions, 0 deletions
tests/components/recorder/test_init.py
with
19 additions
and
3 deletions
homeassistant/components/recorder/core.py
+
2
−
3
View file @
c81d5a1a
...
@@ -319,9 +319,8 @@ class Recorder(threading.Thread):
...
@@ -319,9 +319,8 @@ class Recorder(threading.Thread):
if
event
.
event_type
in
exclude_event_types
:
if
event
.
event_type
in
exclude_event_types
:
return
return
if
(
if
entity_filter
is
None
or
not
(
entity_filter
is
None
entity_id
:
=
event
.
data
.
get
(
ATTR_ENTITY_ID
)
or
(
entity_id
:
=
event
.
data
.
get
(
ATTR_ENTITY_ID
))
is
None
):
):
queue_put
(
event
)
queue_put
(
event
)
return
return
...
...
This diff is collapsed.
Click to expand it.
tests/components/recorder/test_init.py
+
17
−
0
View file @
c81d5a1a
...
@@ -2700,3 +2700,20 @@ async def test_all_tables_use_default_table_args(hass: HomeAssistant) -> None:
...
@@ -2700,3 +2700,20 @@ async def test_all_tables_use_default_table_args(hass: HomeAssistant) -> None:
"""
Test that all tables use the default table args.
"""
"""
Test that all tables use the default table args.
"""
for
table
in
db_schema
.
Base
.
metadata
.
tables
.
values
():
for
table
in
db_schema
.
Base
.
metadata
.
tables
.
values
():
assert
table
.
kwargs
.
items
()
>=
db_schema
.
_DEFAULT_TABLE_ARGS
.
items
()
assert
table
.
kwargs
.
items
()
>=
db_schema
.
_DEFAULT_TABLE_ARGS
.
items
()
async
def
test_empty_entity_id
(
hass
:
HomeAssistant
,
async_setup_recorder_instance
:
RecorderInstanceGenerator
,
caplog
:
pytest
.
LogCaptureFixture
,
)
->
None
:
"""
Test the recorder can handle an empty entity_id.
"""
await
async_setup_recorder_instance
(
hass
,
{
"
exclude
"
:
{
"
domains
"
:
"
hidden_domain
"
},
},
)
hass
.
bus
.
async_fire
(
"
hello
"
,
{
"
entity_id
"
:
""
})
await
async_wait_recording_done
(
hass
)
assert
"
Invalid entity ID
"
not
in
caplog
.
text
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment