Adjust registry access in intent (#88881)

This commit is contained in:
epenet 2023-03-01 03:58:19 +01:00 committed by GitHub
parent 1bed5c7775
commit 54f709f704
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 25 deletions

View file

@ -9,7 +9,7 @@ import voluptuous as vol
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_ON
from homeassistant.core import HomeAssistant
from homeassistant.helpers import area_registry, config_validation as cv, intent
from homeassistant.helpers import area_registry as ar, config_validation as cv, intent
import homeassistant.util.color as color_util
from . import (
@ -56,9 +56,9 @@ class SetIntentHandler(intent.IntentHandler):
# Look up area first to fail early
area_name = slots.get("area", {}).get("value")
area: area_registry.AreaEntry | None = None
area: ar.AreaEntry | None = None
if area_name is not None:
areas = area_registry.async_get(hass)
areas = ar.async_get(hass)
area = areas.async_get_area(area_name) or areas.async_get_area_by_name(
area_name
)