Only check known attributes in significant change support (#106572)
only check known attributes
This commit is contained in:
parent
648afe121d
commit
756847eea8
9 changed files with 72 additions and 47 deletions
|
@ -26,13 +26,16 @@ def async_check_significant_change(
|
|||
if old_state != new_state:
|
||||
return True
|
||||
|
||||
old_attrs_s = set(old_attrs.items())
|
||||
new_attrs_s = set(new_attrs.items())
|
||||
old_attrs_s = set(
|
||||
{k: v for k, v in old_attrs.items() if k in SIGNIFICANT_ATTRIBUTES}.items()
|
||||
)
|
||||
new_attrs_s = set(
|
||||
{k: v for k, v in new_attrs.items() if k in SIGNIFICANT_ATTRIBUTES}.items()
|
||||
)
|
||||
changed_attrs: set[str] = {item[0] for item in old_attrs_s ^ new_attrs_s}
|
||||
|
||||
for attr_name in changed_attrs:
|
||||
if attr_name in SIGNIFICANT_ATTRIBUTES:
|
||||
return True
|
||||
if changed_attrs:
|
||||
return True
|
||||
|
||||
# no significant attribute change detected
|
||||
return False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue