mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +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
|
||||
|
||||
self.event_session.add(dbevent)
|
||||
if event.event_type == EVENT_STATE_CHANGED:
|
||||
if event.event_type != EVENT_STATE_CHANGED:
|
||||
return
|
||||
|
||||
try:
|
||||
dbstate = States.from_event(event)
|
||||
shared_attrs = StateAttributes.shared_attrs_from_event(
|
||||
@ -1179,9 +1181,7 @@ class Recorder(threading.Thread):
|
||||
attr_hash = StateAttributes.hash_shared_attrs(shared_attrs)
|
||||
# Matching attributes found in the database
|
||||
if (
|
||||
attributes := self.event_session.query(
|
||||
StateAttributes.attributes_id
|
||||
)
|
||||
attributes := self.event_session.query(StateAttributes.attributes_id)
|
||||
.filter(StateAttributes.hash == attr_hash)
|
||||
.filter(StateAttributes.shared_attrs == shared_attrs)
|
||||
.first()
|
||||
|
Loading…
x
Reference in New Issue
Block a user