home-assistant / intents

Intents to be used with Home Assistant
https://developers.home-assistant.io/docs/voice/overview/
Creative Commons Attribution 4.0 International
427 stars 489 forks source link

2024.06 update has damaged some functions of custom sentences #2212

Open mitrokun opened 1 month ago

mitrokun commented 1 month ago

After the 2024.06 update, my custom sentences stopped accepting the alias of the area.
And in intent_script, the area_name(area) construction began to give the value None.

Use this code (simple sentence and a intent script ) to check if you have same problem.

  tempstat:
    data:
      - sentences:
          - "Tell me the temperature in the {area}"

tempstat:
  action:
    []
  speech:
    text: "temperature in the {{ area_name(area) }} {{  states.sensor|selectattr('attributes.device_class', 'eq', 'temperature')|selectattr('entity_id', 'in', area_entities(area))|map(attribute='state')|min|int  }}" 

aliases continue to work with a built-in intents

synesthesiam commented 1 month ago

Area is now passed in by name instead of id.

mitrokun commented 1 month ago

Thanks for the information. Replacing {{area_name(area) }} with {{ area }} allowed to get the value names of rooms. But the system reports an error when using aliases of area in the request.

Built-in intents do not have this problem and response returns the required form (I use them for case forms of the name).

Which expression format should be used to return this functionality to custom sentences?

_//added an explanation. As Michael pointed out, the areaentities(area) in the filter also returns none, which breaks the answer. We don't often use those constructions in the response of built-in sentences, so they are not affected by this problem.

synesthesiam commented 1 month ago

Ah, this is a deeper problem that needs to be addressed. The area_id template function doesn't handle aliases as the moment, but I think it should. I will be creating a PR for this soon.