Use assignment expression for alexa init (#81242)

pull/82606/head
Kevin Stillhammer 2022-11-23 20:54:16 +01:00 committed by GitHub
parent 8bd4125390
commit f43f0c4bcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,8 @@
"""Support for Alexa skill service end point."""
from __future__ import annotations
from typing import Any
import voluptuous as vol
from homeassistant.const import (
@ -87,18 +91,14 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
config = config[DOMAIN]
flash_briefings_config = config.get(CONF_FLASH_BRIEFINGS)
intent.async_setup(hass)
if flash_briefings_config:
if flash_briefings_config := config.get(CONF_FLASH_BRIEFINGS):
flash_briefings.async_setup(hass, flash_briefings_config)
try:
smart_home_config = config[CONF_SMART_HOME]
except KeyError:
pass
else:
# smart_home being absent is not the same as smart_home being None
if CONF_SMART_HOME in config:
smart_home_config: dict[str, Any] | None = config[CONF_SMART_HOME]
smart_home_config = smart_home_config or SMART_HOME_SCHEMA({})
await smart_home_http.async_setup(hass, smart_home_config)