Skip to content

Commit cc9615d

Browse files
committed
deal with old_value/value is None
1 parent a591ddc commit cc9615d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

custom_components/pyscript/trigger.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,12 @@ def ident_any_values_changed(self, func_args):
662662
if len(var_pieces) == 3 and f"{var_pieces[0]}.{var_pieces[1]}" == var_name:
663663
if var_pieces[2] == "*":
664664
# catch all has been requested, check all attributes for change
665-
all_attributes = (set(value.__dict__.keys()) | set(old_value.__dict__.keys())) - {"last_updated", "last_changed"}
665+
all_attributes = set()
666+
if value is not None:
667+
all_attributes |= set(value.__dict__.keys())
668+
if old_value is not None:
669+
all_attributes |= set(old_value.__dict__.keys())
670+
all_attributes -= {"last_updated", "last_changed"}
666671
for attribute in all_attributes:
667672
attrib_val = getattr(value, attribute, None)
668673
attrib_old_val = getattr(old_value, attribute, None)

0 commit comments

Comments
 (0)