Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Feature Request: Support loading entities using "Voice assistants" and Aliases #46

Open
tam481 opened this issue Jun 10, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@tam481
Copy link

tam481 commented Jun 10, 2024

Hi @t0bst4r
Please consider loading entities by using the Voice assistants and associated aliases feature in HASS.

I'm sure you have your own plans for what you want to do but I thought I would get my requests in first :-)

@t0bst4r
Copy link
Owner

t0bst4r commented Jun 10, 2024

I have also thought about that, but Home assistant does not populate this information via their websocket API.

Instead I would need to query the REST API for each entity to get its metadata. And probably additional requests to get the Voice assistant config.

i wanted to make the communications between my app and HA as easy as possible and used a similar include/exclude mechanism as Alexa and Apple Home configurations (except for the improvement from the other issue 😁 ).

Let’s keep that issue as a reminder for a future improvement. But I’ll not do that in the next days.

@t0bst4r t0bst4r added the enhancement New feature or request label Jun 10, 2024
@Jibbonator
Copy link

Jibbonator commented Jun 19, 2024

Sry confused the github site. Would be feasable for the homeassitant addon.

I have a potential idea.
I´m just gonna leave my thoughts here...

Does the Addon have access to config.storage.core\entity_registry?

I have created a Node-RED flow(with help of GPT), I read this file, filter for entries where {"should_expose": true}, and then generate a configuration file tailored to my needs. This flag indicates whether the entity is configured for Assistants.

You might consider creating a configuration file using a similar approach.
I know your approach is a bit different with filters for entitys and groups, but since you´re experimenting with a config file this Flag would be easy to set for the users.

An if this idea is a nogo for you someone could still make a node red flow when the addon allows for a config file.

here´s an example of my filter function:
It creates a config file for the homeassistant alexa integration.

const data = msg.payload && msg.payload.data;
const entities = data && data.entities;

if (Array.isArray(entities)) {
    const filteredEntities = entities
        .filter(entity => entity.entity_id && entity.options && entity.options.conversation && entity.options.conversation.should_expose === true);

    const includeEntities = filteredEntities
        .map(entity => `      - ${entity.entity_id}`)
        .join('\n');

    let entityConfig = 'entity_config:';

    filteredEntities
        .filter(entity => entity.aliases)
        .forEach(entity => {
            entity.aliases.forEach(alias => {
                entityConfig += `\n    ${entity.entity_id}:\n      name: "${alias}"`;
            });
        });

    msg.filename = '/config/alexa_expose/generated_smart_home.yaml';
    msg.payload = `smart_home:\n  locale: de-DE\n  endpoint: https://api.eu.amazonalexa.com/v3/events\n  client_id: !secret alexa_client_id\n  client_secret: !secret alexa_client_secret\n  filter:\n    include_entities:\n${includeEntities}\n\n  ${entityConfig}`;
} else {
    msg.payload = '';
}

return msg;

@t0bst4r
Copy link
Owner

t0bst4r commented Jun 19, 2024

Yes, using the registry is exactly what I intended to do 😁
I am already combining entity state with the registry state to detect the "hidden" state.

I don’t think I need another config file.

As a next step i wanted to use that "conversation.expose" property. So, having that in mind, but other stuff was higher priority yet 😅

Copy link
Contributor

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Jul 20, 2024
@t0bst4r t0bst4r removed the stale label Jul 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants