MycroftAI / skill-homeassistant

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

Unable to start skill-homeassistant when Mycroft is configured in French #98

Closed guillaumenibert closed 2 years ago

guillaumenibert commented 2 years ago

Hello, I have some problems with the skill when I turn my Mycroft assistant into French language. Here is the problem:

Description of the bug skill-homeassistant initialisation fails if Mycroft is configured in French

To Reproduce Steps to reproduce the behavior:

  1. Set Mycroft to English mycroft-config edit user
    
    {
    "max_allowed_core_version": 21.2,
    "lang": "en-us",
    "stt": {
    "module": "mycroft",
    "mycroft": {
      "lang": "en-gb"
    }
    },
    "tts": {
    "module": "google",
    "google": {
      "lang": "en-gb"
    }
    }
    }
2. Reload the conf `mycroft-config reload` and reboot
3. skill-homeassistant works!

4. Set Mycroft to French `mycroft-config edit user`
```json
{
  "max_allowed_core_version": 21.2,
  "lang": "fr-fr",
  "stt": {
    "module": "mycroft",
    "mycroft": {
      "lang": "fr-fr"
    }
  },
  "tts": {
    "module": "google",
    "google": {
      "lang": "fr"
    }
  }
}
  1. Reload the conf mycroft-config reload and reboot
  2. See error log (skills.log):
    23:01:43.771 | ERROR    |   960 | mycroft.skills.skill_loader:_communicate_load_status:351 | Skill mycroft-stock.mycroftai failed to load
    23:01:43.788 | INFO     |   960 | mycroft.skills.skill_loader:load:185 | ATTEMPTING TO LOAD SKILL: homeassistant.mycroftai
    23:01:43.873 | INFO     |   960 | mycroft.skills.settings:get_local_settings:83 | /home/pi/.config/mycroft/skills/homeassistant.mycroftai/settings.json
    23:01:43.880 | INFO     |   960 | mycroft.skills.settings:get_local_settings:83 | /home/pi/.config/mycroft/skills/homeassistant.mycroftai/settings.json
    23:01:44.234 | INFO     |   960 | HomeAssistantSkill | Removing all handlers...
    23:01:44.239 | WARNING  |   960 | mycroft.skills.fallback_skill:remove_fallback:185 | Could not find matching fallback handler
    23:01:44.249 | ERROR    |   960 | mycroft.skills.skill_loader:_create_skill_instance:313 | Skill initialization failed with error('unterminated character set at position 26')
    Traceback (most recent call last):
    File "/home/pi/mycroft-core/mycroft/skills/skill_loader.py", line 302, in _create_skill_instance
    self.instance.load_data_files()
    File "/home/pi/mycroft-core/mycroft/skills/mycroft_skill/mycroft_skill.py", line 1276, in load_data_files
    self.load_regex_files(root_directory)
    File "/home/pi/mycroft-core/mycroft/skills/mycroft_skill/mycroft_skill.py", line 1313, in load_regex_files
    regexes = load_regex(regex_dir, self.skill_id)
    File "/home/pi/mycroft-core/mycroft/skills/skill_data.py", line 107, in load_regex
    regexes += load_regex_from_file(join(path, f), skill_id)
    File "/home/pi/mycroft-core/mycroft/skills/skill_data.py", line 68, in load_regex_from_file
    re.compile(regex)
    File "/usr/lib/python3.7/re.py", line 234, in compile
    return _compile(pattern, flags)
    File "/usr/lib/python3.7/re.py", line 286, in _compile
    p = sre_compile.compile(pattern, flags)
    File "/usr/lib/python3.7/sre_compile.py", line 764, in compile
    p = sre_parse.parse(p, flags)
    File "/usr/lib/python3.7/sre_parse.py", line 930, in parse
    p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
    File "/usr/lib/python3.7/sre_parse.py", line 426, in _parse_sub
    not nested and not items))
    File "/usr/lib/python3.7/sre_parse.py", line 816, in _parse
    p = _parse_sub(source, state, sub_verbose, nested + 1)
    File "/usr/lib/python3.7/sre_parse.py", line 426, in _parse_sub
    not nested and not items))
    File "/usr/lib/python3.7/sre_parse.py", line 532, in _parse
    source.tell() - here)
    re.error: unterminated character set at position 26
    23:01:44.270 | ERROR    |   960 | mycroft.skills.skill_loader:_communicate_load_status:351 | Skill homeassistant.mycroftai failed to load

Environment:

Best regards,

Guillaume Nibert

Tony763 commented 2 years ago

Hi @guillaumenibert, I think You installed skill by msm, right?

guillaumenibert commented 2 years ago

Yes, of course.

Tony763 commented 2 years ago

Then this is a known and fixed bug. :slightly_smiling_face: Yet version in msm is not updated due to conflict with "Where is" skill. PR fixing that is almost done and I wanted to have this done by last week, but I had some other tasks to care off. Hope this will be done this week. You can wait or use skill directly from git.

Tony763 commented 2 years ago

If you try version from git, please let me know if it work for you.

guillaumenibert commented 2 years ago

Thank you for your help, the git version works! However there is another bug: turn off the light doesn't work because the imperative form for "turn off" in French is "éteins" not "éteint" as written in the vocab/fr-fr/turn.off.intent file.

Tony763 commented 2 years ago

Great :slightly_smiling_face: You can open PR with fix or I will do it tomorrow.

guillaumenibert commented 2 years ago

It's a detail, everything else seems to work! Thank you ;)

guillaumenibert commented 2 years ago

Great slightly_smiling_face You can open PR with fix or I will do it tomorrow.

I checked other verbs, here is the merge request: #99