mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Reduce indent in recorder event processing (#69659)
This commit is contained in:
parent
72fffde77a
commit
5076437413
@ -1154,7 +1154,9 @@ class Recorder(threading.Thread):
|
|||||||
return
|
return
|
||||||
|
|
||||||
self.event_session.add(dbevent)
|
self.event_session.add(dbevent)
|
||||||
if event.event_type == EVENT_STATE_CHANGED:
|
if event.event_type != EVENT_STATE_CHANGED:
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
dbstate = States.from_event(event)
|
dbstate = States.from_event(event)
|
||||||
shared_attrs = StateAttributes.shared_attrs_from_event(
|
shared_attrs = StateAttributes.shared_attrs_from_event(
|
||||||
@ -1179,9 +1181,7 @@ class Recorder(threading.Thread):
|
|||||||
attr_hash = StateAttributes.hash_shared_attrs(shared_attrs)
|
attr_hash = StateAttributes.hash_shared_attrs(shared_attrs)
|
||||||
# Matching attributes found in the database
|
# Matching attributes found in the database
|
||||||
if (
|
if (
|
||||||
attributes := self.event_session.query(
|
attributes := self.event_session.query(StateAttributes.attributes_id)
|
||||||
StateAttributes.attributes_id
|
|
||||||
)
|
|
||||||
.filter(StateAttributes.hash == attr_hash)
|
.filter(StateAttributes.hash == attr_hash)
|
||||||
.filter(StateAttributes.shared_attrs == shared_attrs)
|
.filter(StateAttributes.shared_attrs == shared_attrs)
|
||||||
.first()
|
.first()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user