Skip to content

Commit

Permalink
revert future changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AzonInc committed May 10, 2023
1 parent fe9d0b1 commit a1f058f
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions homeassistant/components/alexa/intent.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ def resolve_slot_data(key: str, request: dict[str, Any]) -> dict[str, str]:
# reference to the request object structure, see the Alexa docs:
# https://tinyurl.com/ybvm7jhs
resolved_data = {}
resolved_data["value_old"] = request["value"]
resolved_data["value"] = request["value"]
resolved_data["id"] = ""

Expand All @@ -207,23 +206,21 @@ def resolve_slot_data(key: str, request: dict[str, Any]) -> dict[str, str]:

possible_values.extend([item["value"] for item in entry["values"]])

# Always set nearest name and id if available, otherwise the spoken slot
# value and an empty string as id is used
# Always set id if available, otherwise an empty string is used as id
if len(possible_values) >= 1:
resolved_data["value"] = possible_values[0]["name"]
# Set ID if available
if "id" in possible_values[0]:
resolved_data["id"] = possible_values[0]["id"]

# If there is only one match use the resolved value, otherwise the
# resolution cannot be determined, so use the spoken slot value and empty string as id
if len(possible_values) == 1:
resolved_data["value_old"] = possible_values[0]["name"]
resolved_data["value"] = possible_values[0]["name"]
else:
_LOGGER.debug(
"Found multiple synonym resolutions for slot value: {%s: %s}",
key,
resolved_data["value_old"],
resolved_data["value"],
)

return resolved_data
Expand Down Expand Up @@ -252,8 +249,7 @@ def __init__(self, hass, intent_info):
_key = key.replace(".", "_")
_slot_data = resolve_slot_data(key, value)

# In a future release use: value instead of value_old
self.variables[_key] = _slot_data["value_old"]
self.variables[_key] = _slot_data["value"]
self.variables[_key + "_Id"] = _slot_data["id"]

def add_card(self, card_type, title, content):
Expand Down

0 comments on commit a1f058f

Please sign in to comment.