MycroftAI / skill-homeassistant

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

Home-assistant skill not starting/working when language is set to french #66

Closed antipiot closed 2 years ago

antipiot commented 3 years ago

Describe the bug Changing the language to french makes the Home assistant skill not working

To Reproduce Steps to reproduce the behavior: Install Mycroft - stable or dev ---- The following steps can be swapped between them to reproduce ---- set mycroft language to french: mycroft-config set lang "fr-fr" install home-assistant skill: mycroft-msm install home-assistant try to use Home-assistant skill

Expected behavior You can enjoy Home assistant skill in french :-) Bonjour

Log files skills.log

image

Environment (please complete the following information):

Additional context I'm very new to Mykroft, i feels there's something wrong but it looks like it's not on my side this time :-) i hope to be mistaken

b-mq commented 3 years ago

same happens with german as default language mycroft-config edit user { "max_allowed_core_version": 20.8, "lang": "de-de", "tts": { "module": "google", "google": { "lang": "de" } } }

Tony763 commented 3 years ago

Hi, from log I see, problem is with regex, I have a pending PR #53, if it will be accepted, I will send another one that will remove regex completely, because it will be not use anymore. For DE, all intents should be translated, but for FR, there will be need for help.

antipiot commented 3 years ago

@Tony763 Thanks for help and PR, May i help a bit for french? if yes - how?

Tony763 commented 3 years ago

Hi @antipiot, yes. It depend how familiar you are with git and HA plugin. You can fork my repo, make changes and send them as PR to me. Or I can send you links to files that need translation and you can translate them and upload them there in zip file, I will add them to PR.

antipiot commented 3 years ago

@Tony763 I wouldnt say i'm used to git but i can make a PR :-) not used to ha plugin tho.

Wich repo needs to be translated? if it's more easy to have file for me - im fine with it

Tony763 commented 3 years ago

https://github.com/Tony763/mycroft-homeassistant/tree/patch-4

from directory dialog/en-us: homeassistant.scene.on.dialog homeassistant.shopping.list.dialog

from directory vocab/en-us: *.intent (two should be already translated)

antipiot commented 3 years ago

@tony763: thoses files should go in dialog/fr-fr/ if i'm not mistaken - right? I should make the PR there isn'it?

All files that exist in us should exist translated in fr right?

Tony763 commented 3 years ago

Yes, copy them to fr-fr. For dialog, yes it should be 1:1, for vocab no, as only *.intent files will be used. After PR is accepted, I will make a clean up to remove all non used files.

antipiot commented 3 years ago

@Tony763 it should be ok if i did understood the synthax right :-/ May discuss some formulations as french may be tricky but it should be a good start

Tony763 commented 3 years ago

Translation do not have to be 100% same as original in English. I know from Czech, I could made a 1:1 translation, but users would never trigger intents as we use a different formulation and position of words.

Tony763 commented 3 years ago

@antipiot Merged, could you pull my branch and test it?

antipiot commented 3 years ago

@antipiot Merged, could you pull my branch and test it?

Man, how can i do that :-) Apologizes for being a noob.

Tony763 commented 3 years ago

No problem, you can navigate to folder where skills are located (for me it is /srv/mycroft-opt/skills), move skill-homeassistant.mycroftai somewhere safe and issue command

git clone -b patch-4 https://github.com/Tony763/mycroft-homeassistant.git
mv mycroft-homeassistant skill-homeassistant.mycroftai
antipiot commented 3 years ago

So: in case of need: on pi3b the skills are located in: /opt/mycroft/skills/ Actually the pull does not looks to contain the new files using: "git clone -b patch-4 https://github.com/Tony763/mycroft-homeassistant.git"

image This is the full content of /opt/mycroft/skills/homeassistant.mycroftai/dialog/fr-fr/

Tony763 commented 3 years ago
cd /opt/mycroft/skills/
rm -r homeassistant.mycroft
git clone -b patch-4 https://github.com/Tony763/mycroft-homeassistant.git
mv mycroft-homeassistant homeassistant.mycroftai
$ ls ./homeassistant.mycroftai/dialog/fr-fr
homeassistant.automation.trigger.dialog
homeassistant.brightness.badreq.dialog
homeassistant.brightness.cantdim.dimmable.dialog
homeassistant.brightness.cantdim.off.dialog
homeassistant.brightness.decreased.dialog
homeassistant.brightness.dimmed.dialog
homeassistant.brightness.increased.dialog
homeassistant.device.already.dialog
homeassistant.device.off.dialog
homeassistant.device.on.dialog
homeassistant.device.toggle.dialog
homeassistant.device.unknown.dialog
homeassistant.error.dialog
homeassistant.error.http.dialog
homeassistant.error.invalidurl.dialog
homeassistant.error.needurl.dialog
homeassistant.error.offline.dialog
homeassistant.error.setup.dialog
homeassistant.error.sorry.dialog
homeassistant.error.ssl.dialog
homeassistant.error.wrong_password.dialog
homeassistant.scene.on.dialog
homeassistant.sensor.dialog
homeassistant.set.thermostat.dialog
homeassistant.shopping.list.dialog
homeassistant.tracker.found.dialog

$ ls ./homeassistant.mycroftai/vocab/fr-fr
add.item.shopping.list.intent
AutomationActionKeyword.voc
ClimateKeyword.voc
decrease.light.brightness.intent
DecreaseVerb.voc
DeviceTrackerKeyword.voc
increase.light.brightness.intent
IncreaseVerb.voc
LightBrightenVerb.voc
LightDimVerb.voc
LightsKeyword.voc
sensor.intent
SensorStatusKeyword.voc
set.climate.intent
set.light.brightness.intent
SetVerb.voc
SwitchActionKeyword.voc
toggle.intent
tracker.intent
turn.off.intent
turn.on.intent
antipiot commented 3 years ago

i'm tired - thanks. sadly there are still errors when starting with fr-fr: please find log attached skills.log

Tony763 commented 3 years ago

Me too, it's kinda late :smiley: Turned my Mycroft to fr-fr and Found it! Please remove directory regex and try it. Even if regex are no longer used in my branch, Mycroft still loads them and one of them in fr is broken ( not happening in en, cs).

Also if you could, translate also automation.intent and send it to me as PR. Thanks

antipiot commented 3 years ago

@Tony763 i've translated automation.intent. tried to delete regex but has still fails to load: skills.log

Tony763 commented 3 years ago

My mistake, pull latest version of my repo.

antipiot commented 3 years ago

Good news! it does work after pull and delete regex. Still unable to trigger anything as it fails to match actual entities but the skill loads.

Good job.

xoxopeter commented 3 years ago

Hi Tony763,

I tried your solution and the home assistant skill startup with the fr language, but when i tried to do an action "Hey Microft, Turn on the office light" i'am getting the message that the HA server did not accept the configured password.

I also tried to generate manually the settings.json file under /opt/mycroft/skills/homeassistant.mycroftai

by adding : {"__mycroft_skill_firstrun" : false, "ssl" : false, "host" : "homeassistant_ip_adress", "token" : "long-lived-token", "verify" : false, "portnum" : 8123, "enable_fallback" : true}

But I still get the same message and these logs: 2021-05-10 13:50:48 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 192.168.xxx.xxx (192.168.xxx.xxx). (python-requests/2.25.1) Logger: homeassistant.components.http.ban Source: components/http/ban.py:116

(The long live token is already configured on the user HA profile)

Do you have any idea?

Tony763 commented 3 years ago

Hi @xoxopeter which version of skill You are using, the one from my repo or original skill from Mycroft. All changes are not officially rolled out as there are some collisions with other skills.

xoxopeter commented 3 years ago

Thanks for the quickly reply,

Initially I installed the skill from the official repo then since the FR version was not working (failed for loading the skills), I retrieved the content from your repo. So I deleted the content of the official repo under /opt/mycroft/skills/homeassistant.mycroftai and I put all your files. Then I deleted the en-fr file in the regex folder.

Tony763 commented 3 years ago

Try to restart HA or try to change ip if you can, as it talks about ban, it can by placed on IP for some time period.

Tony763 commented 3 years ago

Hi @antipiot, PR is merged, could you try it and if it works, close the issue, please?

stratus-ss commented 2 years ago

I'm closing this as the fix was merged and the user has not responded to the request for testing.

I don't have this issue in German