1
mirror of https://github.com/home-assistant/core synced 2024-09-28 03:04:04 +02:00

Small code clean up (#103603)

This commit is contained in:
Michael Hansen 2023-11-07 13:52:58 -06:00 committed by GitHub
parent 0d63e2f9b5
commit 9c2febc72e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 7 deletions

View File

@ -79,13 +79,16 @@ class OnOffIntentHandler(intent.ServiceIntentHandler):
if state.domain == COVER_DOMAIN:
# on = open
# off = close
if self.service == SERVICE_TURN_ON:
service_name = SERVICE_OPEN_COVER
else:
service_name = SERVICE_CLOSE_COVER
await self._run_then_background(
hass.async_create_task(
hass.services.async_call(
COVER_DOMAIN,
SERVICE_OPEN_COVER
if self.service == SERVICE_TURN_ON
else SERVICE_CLOSE_COVER,
service_name,
{ATTR_ENTITY_ID: state.entity_id},
context=intent_obj.context,
blocking=True,
@ -97,13 +100,16 @@ class OnOffIntentHandler(intent.ServiceIntentHandler):
if state.domain == LOCK_DOMAIN:
# on = lock
# off = unlock
if self.service == SERVICE_TURN_ON:
service_name = SERVICE_LOCK
else:
service_name = SERVICE_UNLOCK
await self._run_then_background(
hass.async_create_task(
hass.services.async_call(
LOCK_DOMAIN,
SERVICE_LOCK
if self.service == SERVICE_TURN_ON
else SERVICE_UNLOCK,
service_name,
{ATTR_ENTITY_ID: state.entity_id},
context=intent_obj.context,
blocking=True,

View File

@ -278,7 +278,8 @@ def _convert_audio(
if proc.returncode != 0:
_LOGGER.error(stderr.decode())
raise RuntimeError(
f"Unexpected error while running ffmpeg with arguments: {command}. See log for details."
f"Unexpected error while running ffmpeg with arguments: {command}."
"See log for details."
)
output_file.seek(0)