mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Include binary_sensor in default Assist exposed domains (#88682)
This commit is contained in:
parent
301144993c
commit
d5f1713498
@ -3,6 +3,7 @@
|
|||||||
DOMAIN = "conversation"
|
DOMAIN = "conversation"
|
||||||
|
|
||||||
DEFAULT_EXPOSED_DOMAINS = {
|
DEFAULT_EXPOSED_DOMAINS = {
|
||||||
|
"binary_sensor",
|
||||||
"climate",
|
"climate",
|
||||||
"cover",
|
"cover",
|
||||||
"fan",
|
"fan",
|
||||||
@ -16,3 +17,5 @@ DEFAULT_EXPOSED_DOMAINS = {
|
|||||||
"vacuum",
|
"vacuum",
|
||||||
"water_heater",
|
"water_heater",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFAULT_EXPOSED_ATTRIBUTES = {"device_class"}
|
||||||
|
@ -28,7 +28,7 @@ from homeassistant.helpers import (
|
|||||||
from homeassistant.util.json import JsonObjectType, json_loads_object
|
from homeassistant.util.json import JsonObjectType, json_loads_object
|
||||||
|
|
||||||
from .agent import AbstractConversationAgent, ConversationInput, ConversationResult
|
from .agent import AbstractConversationAgent, ConversationInput, ConversationResult
|
||||||
from .const import DEFAULT_EXPOSED_DOMAINS, DOMAIN
|
from .const import DEFAULT_EXPOSED_ATTRIBUTES, DEFAULT_EXPOSED_DOMAINS, DOMAIN
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
_DEFAULT_ERROR_TEXT = "Sorry, I couldn't understand that"
|
_DEFAULT_ERROR_TEXT = "Sorry, I couldn't understand that"
|
||||||
@ -467,6 +467,12 @@ class DefaultAgent(AbstractConversationAgent):
|
|||||||
for state in states:
|
for state in states:
|
||||||
# Checked against "requires_context" and "excludes_context" in hassil
|
# Checked against "requires_context" and "excludes_context" in hassil
|
||||||
context = {"domain": state.domain}
|
context = {"domain": state.domain}
|
||||||
|
if state.attributes:
|
||||||
|
# Include some attributes
|
||||||
|
for attr_key, attr_value in state.attributes.items():
|
||||||
|
if attr_key not in DEFAULT_EXPOSED_ATTRIBUTES:
|
||||||
|
continue
|
||||||
|
context[attr_key] = attr_value
|
||||||
|
|
||||||
entity = entities.async_get(state.entity_id)
|
entity = entities.async_get(state.entity_id)
|
||||||
if entity is not None:
|
if entity is not None:
|
||||||
@ -506,6 +512,9 @@ class DefaultAgent(AbstractConversationAgent):
|
|||||||
for alias in area.aliases:
|
for alias in area.aliases:
|
||||||
area_names.append((alias, area.id))
|
area_names.append((alias, area.id))
|
||||||
|
|
||||||
|
_LOGGER.debug("Exposed areas: %s", area_names)
|
||||||
|
_LOGGER.debug("Exposed entities: %s", entity_names)
|
||||||
|
|
||||||
self._slot_lists = {
|
self._slot_lists = {
|
||||||
"area": TextSlotList.from_tuples(area_names, allow_template=False),
|
"area": TextSlotList.from_tuples(area_names, allow_template=False),
|
||||||
"name": TextSlotList.from_tuples(entity_names, allow_template=False),
|
"name": TextSlotList.from_tuples(entity_names, allow_template=False),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user