Permission error in rhasspy profile directory?

I’m running rhasspy on docker on Ubuntu 20.04. I tried to set up the program with home assistant per the directions here: https://rhasspy.readthedocs.io/en/latest/usage/#home-assistant. I used the home assistant example files here to setup my sentences. Now, when I click Save Sentences, the following error appears at the bottom of the screen:

PermissionError: [Errno 13] Permission denied: '/profiles/en/slot_programs/hass/entities'

It looks like when docker creates the rhasspy profiles directory, it is owned by root. I also had to used elevated file explorer to add the slot_programs directory, this command from the rhasspy docs did not work either:

slot_programs="${HOME}/.config/rhasspy/profiles/en/slot_programs"
mkdir -p "${slot_programs}"

Here is my rhasspy error log:

[ERROR:2020-08-12 00:58:16,355] rhasspyserver_hermes: [Errno 13] Permission denied: '/profiles/en/slot_programs/hass/entities'
Traceback (most recent call last):
  File "/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/quart/app.py", line 1821, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/quart/app.py", line 1869, in dispatch_request
    return await handler(**request_.view_args)
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__main__.py", line 1235, in api_train
    result = await core.train()
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__init__.py", line 359, in train
    word_transform=word_transform,
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/train.py", line 87, in sentences_to_graph
    slot_visitor=word_visitor,
  File "/usr/lib/rhasspy/rhasspy-nlu/rhasspynlu/slots.py", line 87, in get_slot_replacements
    slot_command, universal_newlines=True
  File "/usr/lib/python3.7/subprocess.py", line 411, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.7/subprocess.py", line 488, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.7/subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/profiles/en/slot_programs/hass/entities'
[DEBUG:2020-08-12 00:58:16,346] rhasspynlu.slots: Running program for slot hass/entities,light: ['/profiles/en/slot_programs/hass/entities', 'light']
[DEBUG:2020-08-12 00:58:16,343] rhasspynlu.ini_jsgf: Loaded ini file
[DEBUG:2020-08-12 00:58:16,341] rhasspyserver_hermes: Generating intent graph
[DEBUG:2020-08-12 00:58:16,340] rhasspyserver_hermes: Loading sentences from [PosixPath('/profiles/en/sentences.ini')]
[INFO:2020-08-12 00:58:16,339] rhasspyserver_hermes: Starting training
[DEBUG:2020-08-12 00:58:15,336] rhasspyserver_hermes: Writing /profiles/en/sentences.ini

Can you make sure you made the program executable?
I have a slot_program folder and a custom slot program, and both are owned by root - no problem.

Make sure that they are both readable and executable by other users.
image
Cheers!
DeadEnd

Ok! So we’re getting somewhere. I had previously set the permissions to all users, but did not allow executable. Of course that would be necessary for running entities. D’oh!

Now, rhasspy just takes a very long time to train and I get this message:

AssertionError: No output from ['/profiles/en/slot_programs/hass/entities', 'switch']

I do have switches in my homeassistant though…

What intent recognizer are you using? Some of these compute all possible sentenses during training, others do it during recognition… I had this issue when my sentence count got to large and had to change from fuzzywuzzy to fsticuffs.

I haven’t looked at the program or its required setups… my guess is something is connecting correctly… I’ll see if I can read through it and get an idea of what is missing.

First:

You must add intent: to your Home Assistant configuration.yaml to enable the endpoint.

So did you add this, and have you restarted HA after adding it?
After changing configuration.yaml you always have to restart.

Hmmm, I’ve been using fsticuufs.

Here’s the error log:
[ERROR:2020-08-12 09:59:40,204] rhasspyserver_hermes: No output from [’/profiles/en/slot_programs/hass/entities’, ‘light’]
Traceback (most recent call last):
File “/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/quart/app.py”, line 1821, in full_dispatch_request
result = await self.dispatch_request(request_context)
File “/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/quart/app.py”, line 1869, in dispatch_request
return await handler(**request_.view_args)
File “/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/main.py”, line 1235, in api_train
result = await core.train()
File “/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/init.py”, line 359, in train
word_transform=word_transform,
File “/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/train.py”, line 87, in sentences_to_graph
slot_visitor=word_visitor,
File “/usr/lib/rhasspy/rhasspy-nlu/rhasspynlu/slots.py”, line 98, in get_slot_replacements
assert has_output, f"No output from {slot_command}"
AssertionError: No output from [’/profiles/en/slot_programs/hass/entities’, ‘light’]
[DEBUG:2020-08-12 09:59:40,163] rhasspynlu.slots: Running program for slot hass/entities,light: [’/profiles/en/slot_programs/hass/entities’, ‘light’]
[DEBUG:2020-08-12 09:59:40,155] rhasspynlu.slots: Loading slot hass/colors from /profiles/en/slots/hass/colors
[DEBUG:2020-08-12 09:59:40,152] rhasspynlu.ini_jsgf: Loaded ini file
[DEBUG:2020-08-12 09:59:40,151] rhasspyserver_hermes: Generating intent graph
[DEBUG:2020-08-12 09:59:40,150] rhasspyserver_hermes: Loading sentences from [PosixPath(’/profiles/en/sentences.ini’)]
[INFO:2020-08-12 09:59:40,149] rhasspyserver_hermes: Starting training

Two conditions I see in the slot program:

Assumes that you have configured Home Assistant in Rhasspy already, and that a long-lived access token is being used for authentication.
NOTE: This script will not currently work with a custom HTTPS certificate. Look at the 
 home_assistant.pem_file and home_assistant.key_file profile settings if you want to add it.

So, did you setup HA and add the long lived access token?
If you’re not sure, you probably haven’t.

And second, are you using HTTP or HTTPS with a cert?

That’s the funny part. I did setup HA under intent handling, and I added my long lives access token. My server address is http://localhost:8123

I’m not sure if you are using HA supervised with add-ons or HA core and spinning up your own containers. I mention this because I do the latter and using localhost doesn’t work for me because I believe it is looking inside the container.

Instead, try using the IP of your host and see if that fixes it. This is what I have to do anytime I am trying to map from one container to another.

1 Like

That did it! Thank you! I also had to remove references to switch and cover entities because I don’t have any of those devices in HA, and that caused an error as well. I only have light entities right now.

I am having this same problem but am using HTTPS (need it for other things so dont really want to go back to HTTP).

I am confused by the

Look at the home_assistant.pem_file and home_assistant.key_file profile
# settings if you want to add it.

Not entirely sure what it is asking me to do here. Any suggestions?