File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/frequenz/client/microgrid/component Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,16 @@ def active(self) -> bool:
117117 """Whether this component is currently active."""
118118 return self .active_at (datetime .now (timezone .utc ))
119119
120+ @property
121+ def identity (self ) -> tuple [ComponentId , MicrogridId ]:
122+ """The identity of this component.
123+
124+ This uses the component ID and microgrid ID to identify a component
125+ without considering the other attributes, so even if a component state
126+ changed, the identity remains the same.
127+ """
128+ return (self .id , self .microgrid_id )
129+
120130 def __str__ (self ) -> str :
121131 """Return a human-readable string representation of this instance."""
122132 name = f":{ self .name } " if self .name else ""
You can’t perform that action at this time.
0 commit comments