joselcaguilar / azure-openai-ha

Azure OpenAI Conversation for Home Assistant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there a way for this integration to see device and entity changes in real-time?

ubersandwich opened this issue · comments

Currently I use this template to read in various entities and their states:

{%- for area in areas() %}
  {%- set entities = area_entities(area) -%}
  {%- set area_info = namespace(printed=false) %}
  {%- if entities -%}
    {%- for entity_id in entities -%}
      {%- set entity_state = states.entity_id -%}
      {%- if entity_state is not none %}
        {%- if not area_info.printed %}
{{ area_name(area) }}:
          {%- set area_info.printed = true %}
        {%- endif %}
- {{ entity_id }}: {{ states(entity_id) }}
      {%- endif %}
    {%- endfor %}
  {%- endif %}
{%- endfor %}

This only updates entity states when the Azure OpenAI integration is reloaded, is there any way for this information to be read by the Azure OpenAI integration in real-time?

@ubersandwich You need to create a new session with Azure OpenAI unfortunately, because the initial states are read and sent at startup time, it's the same behaviour as the official OpenAI integration.

@ubersandwich I'm going to close this issue as it is not directly related as explained above, thanks for your feedback 😊