mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 02:07:54 +00:00
Fix unneeded dict values for MATCH_ALL recorder attrs exclude (#120804)
* Small cleanup to handling MATCH_ALL recorder attrs exclude * Fix unneeded dict values for MATCH_ALL recorder attrs exclude The exclude is a set so the dict values were not needed * Fix unneeded dict values for MATCH_ALL recorder attrs exclude The exclude is a set so the dict values were not needed * Fix unneeded dict values for MATCH_ALL recorder attrs exclude The exclude is a set so the dict values were not needed
This commit is contained in:
parent
d4ecbc91c3
commit
0dfb5bd7d9
@ -142,6 +142,13 @@ _DEFAULT_TABLE_ARGS = {
|
|||||||
"mariadb_engine": MYSQL_ENGINE,
|
"mariadb_engine": MYSQL_ENGINE,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_MATCH_ALL_KEEP = {
|
||||||
|
ATTR_DEVICE_CLASS,
|
||||||
|
ATTR_STATE_CLASS,
|
||||||
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
|
ATTR_FRIENDLY_NAME,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class UnusedDateTime(DateTime):
|
class UnusedDateTime(DateTime):
|
||||||
"""An unused column type that behaves like a datetime."""
|
"""An unused column type that behaves like a datetime."""
|
||||||
@ -597,19 +604,8 @@ class StateAttributes(Base):
|
|||||||
if MATCH_ALL in unrecorded_attributes:
|
if MATCH_ALL in unrecorded_attributes:
|
||||||
# Don't exclude device class, state class, unit of measurement
|
# Don't exclude device class, state class, unit of measurement
|
||||||
# or friendly name when using the MATCH_ALL exclude constant
|
# or friendly name when using the MATCH_ALL exclude constant
|
||||||
_exclude_attributes = {
|
exclude_attrs.update(state.attributes)
|
||||||
k: v
|
exclude_attrs -= _MATCH_ALL_KEEP
|
||||||
for k, v in state.attributes.items()
|
|
||||||
if k
|
|
||||||
not in (
|
|
||||||
ATTR_DEVICE_CLASS,
|
|
||||||
ATTR_STATE_CLASS,
|
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
|
||||||
ATTR_FRIENDLY_NAME,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
exclude_attrs.update(_exclude_attributes)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
exclude_attrs = ALL_DOMAIN_EXCLUDE_ATTRS
|
exclude_attrs = ALL_DOMAIN_EXCLUDE_ATTRS
|
||||||
encoder = json_bytes_strip_null if dialect == PSQL_DIALECT else json_bytes
|
encoder = json_bytes_strip_null if dialect == PSQL_DIALECT else json_bytes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user