Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the case of covers, the "which" / "how many" questions do not work. #1948

Open
v1k70rk4 opened this issue Feb 10, 2024 · 2 comments
Open

Comments

@v1k70rk4
Copy link
Member

Hello, I noticed something that I think used to work:
If I ask whether the living room door is open, I get a correct answer that it is.
But if I ask how many doors are open, it says 0 and it's as if it doesn't see a single door at all.
The question seems to be language-independent because I get a similar result in English as well.

Q: A nappali ajtó nyitva van? [living room door is open] R: yes

intent:
  name: HassGetState
slots:
  name: nappali ajtó
  state: nyitva
  domain: binary_sensor
  device_class: door
details:
  name:
    name: name
    value: Nappali ajtó
    text: nappali ajtó
  state:
    name: state
    value: 'on'
    text: nyitva
  domain:
    name: domain
    value: binary_sensor
    text: ''
  device_class:
    name: device_class
    value: door
    text: ''
targets:
  binary_sensor.nyitaserzekelo_nappali_ajto_contact:
    matched: true
match: true
sentence_template: <name> {bs_door_states:state} van [<area>]
unmatched_slots: {}
source: builtin

Q: Hány ajtó van nyitva? [ how many doors are open] R: 0
It shows here that there are no targets even though there are 3 doors that I am monitoring.

intent:
  name: HassGetState
slots:
  device_class: ajtó
  state: nyitva
  domain: cover
details:
  device_class:
    name: device_class
    value: door
    text: ajtó
  state:
    name: state
    value: open
    text: nyitva
  domain:
    name: domain
    value: cover
    text: ''
targets: {}
match: true
sentence_template: <mennyi> {cover_classes:device_class} van {cover_states:state} [<area>]
unmatched_slots: {}
source: builtin
@tetele
Copy link
Contributor

tetele commented Feb 12, 2024

There are a few types of devices for which the entity selection is difficult, the implementation lacking and, thus, they produce unexpected result.

The root of the issue is selecting entities across multiple "filters" (e.g. domain or domain+device_class). Let's say we're talking about windows and you want to know "how many windows are open".

In HA there are 2 types of "windows"

A comprehensive query would take all of these entities, filter on state and count all of the matched entities. However, due to the way the recognition engine is set up, we can only have a single "filter" defined by requires_context/excludes_context and the current implementation (for windows, at least) is to count all cover entities, having no equivalent for binary_sensor.

It is indeed an issue, but the solution is not in the intents repo, but rather in how we should query for entities.

@v1k70rk4
Copy link
Member Author

Hi, now I understand everything. Should I open a bug in the core for this, or should we consider it correct behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants