Small code clean up (#103603)
parent
0d63e2f9b5
commit
9c2febc72e
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue