I am using the Alexa Smart Home Skill integration as well as the Alexa Device control custom integration.
Both are working flawlessly.
However, ASHS is announcing all the switches and sensors to Alexa that it discovers from the Echo devices. In other words, Alexa is sortof seeing itself in a loop.
I know that I can exclude entities by adding them to the exclude list.
However, do I need to add dozens of entities one by one, or can I do something like a wildcard.
This was a great start for me, but my alexa integration returned devices that did not include the alexa / echo name. So I figured I should be able to filter by “platform” / “integration”.
I couldn’t find a way to do that in JINJA, but using the entity tracker file and some JSON magic, I was able to get all devices by “platform”
Found this old thread and hoped it would solve a very similar problem I’m having. However the YAML parser is being particularly sensitive to whitespace and I can only get it pass as follows:
alexa:
smart_home:
filter:
include_entities: >
{% for s in states if s.attributes.expose -%}
- {{ s.entity_id }}
{% endfor %}
However I get the following error in the log:
Invalid config for [alexa]: Entity ID {% for s in states if s.attributes.expose -%} - {{ s.entity_id }} {% endfor %} is an invalid entity id for dictionary value @ data['alexa']['smart_home']['filter']['include_entities']. Got '{% for s in states if s.attributes.expose -%} - {{ s.entity_id }} {% endfor %}\n'. (See /config/configuration.yaml, line 31).
Other approaches like {{ states | selectattr('attributes.expose') | map(attribute='entity_id') | list | join(', ') }} don’t work either.
Any ideas?
EDIT: Does “use the template editor” mean generate the config and copy and paste it into the config? Is there no way at all to do it dynamically / programmatically?
No, I gave up on this, but I can’t recall if it was because it was a limitation of what could be enumerated or because attributes wouldn’t be set by the time the integration needed the device names. @petro’s post suggests that filtering is possible to some extent, but it likely didn’t meet my needs.
Oh I think I remember now. I think I resolved that @petro literally meant to use the template editor to run the script and then copy/paste the result in the config. No dynamic solution possible without a change to the integration.