Skip to content

Commit cce85bb

Browse files
committed
Make not having grid metadata a warning instead of an error
There is plenty we can still do without the metadata, so completely disabling access to the grid connection point if we don't have metadata is too strict. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent f559016 commit cce85bb

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/frequenz/sdk/timeseries/grid.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,17 +201,16 @@ def initialize(
201201
"No grid connection found for this microgrid. This is normal for an islanded microgrid."
202202
)
203203
case 1:
204-
if grid_connections[0].metadata is None:
205-
raise RuntimeError("Grid metadata is None")
206-
207-
if grid_connections[0].metadata.fuse is not None:
208-
fuse = Fuse(
209-
max_current=Current.from_amperes(
210-
grid_connections[0].metadata.fuse.max_current
211-
)
204+
metadata = grid_connections[0].metadata
205+
if metadata is not None and metadata.fuse is not None:
206+
fuse = Fuse(max_current=Current.from_amperes(metadata.fuse.max_current))
207+
208+
if metadata is None:
209+
_logger.warning(
210+
"Unable to get grid metadata, the grid connection point is "
211+
"considered to have no fuse"
212212
)
213-
214-
if fuse is None:
213+
elif fuse is None:
215214
_logger.warning("The grid connection point does not have a fuse")
216215
case _:
217216
raise RuntimeError(

0 commit comments

Comments
 (0)