Skip to content

Commit 9fc3edf

Browse files
committed
remove error message on last_log choice
1 parent 639166c commit 9fc3edf

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

custom_components/remote_logger/remote_logger.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,12 @@ async def handle_flush(domain_data: dict[str, Any], _call: ServiceCall) -> None:
175175
@callback
176176
def handle_last_log(domain_data: dict[str, Any], call: ServiceCall) -> dict[str, Any]:
177177
entry_id: str | None = call.data.get("config_entry_id")
178-
if entry_id is None and domain_data:
179-
entry = next(v for v in domain_data.values())
180-
elif entry_id is not None:
178+
entry = None
179+
if entry_id:
181180
entry = domain_data.get(entry_id)
182-
else:
183-
entry = None
184181
if entry is None:
185-
raise ValueError(f"No remote_logger config entry found with id {entry_id!r}")
186-
submission: LogSubmission = entry[REF_EXPORTER].last_sent_payload
182+
return {}
183+
submission: LogSubmission | None = entry[REF_EXPORTER].last_sent_payload
187184
if submission is None:
188185
return {}
189186
return submission.for_display()

0 commit comments

Comments
 (0)