Intent handling with command

Did you change the /path/to/program to actually point to your program?

That’s right, I change the path (via profile.json) of the Python file (it’s on the desktop). I said “Hello” and nothing happened, I’m doing something wrong?

Note 1: I change the patch manually from the file (profile.json), and also change it from the web (from the web I only change the patch and the file profile.json was automatically changed).

Note 2: With the 2nd code all the commands are executed correctly via websocket, but I guess it is not the right way to do it, right?

If you’re using Docker, make sure that you give the running container access to /path/to/program with a -v /path/to:/path/to in the docker run command.

1 Like

Honestly I do not understand what I should do. Imagine that my path is at: /home/pi/desktop/robot.py

What should I execute? (Sorry, I’m new using Docker)

Let’s start from the beginning :slight_smile:

What command did you start the Rhasspy docker with?

1 Like

Just this: New profile with Docker

Ok, with that command this folder:
$HOME/.config/rhasspy/profiles is mapped to /profiles in the container.

If you put robot.py into $HOME/.config/rhasspy/profiles, then you can set this in your profile:
“program”: “/profiles/robot.py”

At http://localhost:12101/settings
The option “Intent Handling” Select “Local Command”, in “Program” I wrote: /profiles/robot.py

I keep it and I went straight to the code to see that everything is fine, the following comes out:

"handle": {
    "command": {
        "program": "/profiles/robot.py"
    },
    "system": "command"
},

It does not do anything when I say a phrase, I am waiting for when I call the robot react according to the code (honestly I do not know what the typical operation is).

The code that I put on robot.py was this:

Under “Hello” I add that it reproduces an audio when you recognize it, but nothing happens.

What am I doing wrong? :confused:

What is the Rhasspy log?
What do you have as sentences in what language?

1 Like

rhasspyserver_hermes: Sent 421 char(s) to websocket
rhasspyserver_hermes: <- NluIntent(input=‘Hello’, intent=Intent(intent_name=‘Hello’, confidence_score=1.0), site_id=‘default’, id=None, slots=[], session_id=‘default-hey_robot’, custom_data=‘hey_robot’, asr_tokens=[[AsrToken(value=‘hello’, confidence=1.0, range_start=0, range_end=5, time=None)]], asr_confidence=0.00010727685683729188, raw_input=‘hello’, wakeword_id=‘hey_robot’, lang=None)

This is what comes out in the log, I assure you that the attempt that registers the log is the same as I place in the code:

Note: When I try the second code and I run the Python with Socket works well, the first code I do not run, I guess the first code I should not execute it.

Remember…
This is the 1st code:

This is the 2nd code:

With “Execute” I mean that in console I run Python3 + Path. The code 1 I do not run it, I suppose that Rhasspy does it and that’s why I must place the path in profile.json

The code 2 (the one you have socket) if I run and when I pronounced a phrase the robot recognizes it and runs the conditional that places in the code.

I say it because I want it to be clear what I do, so you can help me with a better precision. Also, because I do not know what “intent handling” of Rhaspy, so he would appreciate it if you explain me, please.

I could not find it in your text, but did you put robot.py here?

Yes, the file “robot.py” with code 1 I put it there: $HOME/.config/rhasspy/profiles
Is next to profile.json

Can you provide a bit more log from Rhasspy?
The intent log in not really the interesting part, since it is correctly recognized

What kind of log do you need?
Where do I find it?

If you haven’t yet, @principe_mestizo, make sure to mark your handling script has executable:

$ chmod +x /path/to/handle.py

The handler scripts don’t have to be Python programs, so Rhasspy just executes them as a program. This means you have to have:

  1. The “shebang” line at the top of your script (#!/usr/bin/env python3)
  2. The script file marked as executable (chmod +x ...)

From the log button.
Surely the intent log you posted is not the only log right?

@synesthesiam gives good pointers as well, I never used a python script as intent handler

I followed all the steps, and make sure to place the exact path. Do you think the code is the problem or where do you think is?

@synesthesiam @romkabouter

When I change the WAV files to one of my local patch, do not play even though my local patch has chmod 777 and chmod + x

I do not know if this problem is related.

Note with WAV I mean:
${RHASSPY_BASE_DIR}/etc/wav/beep_hi.wav
${RHASSPY_BASE_DIR}/etc/wav/beep_lo.wav
${RHASSPY_BASE_DIR}/etc/wav/beep_error.wav

With:
/home/pi/Desktop/example.mp3