MycroftAI / skill-homeassistant

Mycroft Skill/Integration for Homeassistant
GNU Lesser General Public License v3.0
114 stars 62 forks source link

Mycroft controls wrong entity #46

Closed gaganpreet closed 2 years ago

gaganpreet commented 3 years ago

I've Tado (climate) and Hue (lamp) devices in my home, and for this particular issue: both define entities named "Bedroom"

I tried a few variations of these phrases to get Mycroft to control the hue lamp in my bedroom:

In all scenarios, Mycroft affects my Tado entity in my bedroom instead of the lamps as expected.

Looking in code, the issue is in handle_switch_intent, which looks in all entities including climate: https://github.com/MycroftAI/mycroft-homeassistant/blob/e5abeab32dc1c8cb3ea6d5737e883dbc3f74a0e8/__init__.py#L180-L190

The context about lights is dismissed at this point and Mycroft proceeds to affect any best matching entity named "bedroom" in home assistant, which in this ends up being my bedroom's climate control, not the lights.

I don't need Mycroft to control my climate sensors (yet), so a quick fix for me was to remove the "climate" value from the find_entity call but I'd love to see Mycroft being more aware of my intent in this case.

Tony763 commented 3 years ago

For English it would be easy. Intents for turn on/off are:

Can you turn on {Entity} please?
I'd like to turn on {Entity}
I would like {Entity} on

To add check if returned entity contain two words and check them against list of groups would be easy. Problem will be with others languages as we use different order of words. Bedroom light => (Direct translate) Ložnicové světlo => (Correct translate) Světlo v ložnici For workaround this I name all entities with full name = light.svetlo_v_loznici

stratus-ss commented 2 years ago

closing due to inactivity