Simplify get pipeline method (#93865)

This commit is contained in:
Paulus Schoutsen
2023-05-31 11:06:03 -04:00
committed by GitHub
parent 4bade86dcc
commit 927b59fe5a
5 changed files with 38 additions and 15 deletions

View File

@@ -17,6 +17,7 @@ from homeassistant.helpers import config_validation as cv
from homeassistant.util import language as language_util
from .const import DOMAIN
from .error import PipelineNotFound
from .pipeline import (
PipelineData,
PipelineError,
@@ -85,8 +86,9 @@ async def websocket_run(
) -> None:
"""Run a pipeline."""
pipeline_id = msg.get("pipeline")
pipeline = async_get_pipeline(hass, pipeline_id=pipeline_id)
if pipeline is None:
try:
pipeline = async_get_pipeline(hass, pipeline_id=pipeline_id)
except PipelineNotFound:
connection.send_error(
msg["id"],
"pipeline-not-found",