Intent handle : allow multiple handles

If I put this into profile:

    "handle": {
            "command": {
                "program": "$RHASSPY_PROFILE_DIR/intentDispatcher.py"
            },
            "remote": {
                "url": "http://x.x.x.x:80/core/api/jeeApi.php?plugin=jeerhasspy&apikey=--key--&plugin=jeerhasspy&type=jeerhasspy"
            },
            "system": "remote"
        },

I can use either remote or command but not both.

Would it be possible to set several handles, with order ?
For example "system": "remote,command"

Actually if I do this, here is the error:

[ERROR:71284553] DialogueManager: started
Traceback (most recent call last):
File “/usr/share/rhasspy/rhasspy/actor.py”, line 159, in on_receive
self.transition(“started”)
File “/usr/share/rhasspy/rhasspy/actor.py”, line 230, in transition
getattr(self, transition_method)(from_state)
File “/usr/share/rhasspy/rhasspy/dialogue.py”, line 309, in to_started
self.transition(“loading”)
File “/usr/share/rhasspy/rhasspy/actor.py”, line 230, in transition
getattr(self, transition_method)(from_state)
File “/usr/share/rhasspy/rhasspy/dialogue.py”, line 345, in to_loading
self.load_actors()
File “/usr/share/rhasspy/rhasspy/dialogue.py”, line 874, in load_actors
self.handler_class = get_intent_handler_class(handler_system)
File “/usr/share/rhasspy/rhasspy/intent_handler.py”, line 59, in get_intent_handler_class
“Invalid intent handler system: %s” % system
AssertionError: Invalid intent handler system: remote,command

Dunno anyway if it would be easy to implement this, as it seems to ask for one service/class per task.
If it is too mush work, which seems so, can anyone could help in getting system command python file to get the intent ? Actually even a simple python file writing another file to check it is run create stderror.

Hello @KiboOst,

I have a similar problem. I want to handle different events with different intend handlers. (e.g. GetTime with script and SwitchLamp with Homeassistant)

I would even go further and would say: You can define an intend handler per intend, so the rhasspy intend handler actually can work as an dispatcher and dispatches the event to the correspinding event handler.

@synesthesiam:
If you are interested, I can try to come up with a concept how this might look like and how this could be designed.
The Idea has, in my opinion, a couple of advantages. If you have events, which shall be handeled locally - e.g. GetTime, or Speak Weather forecast (like someone posted in the forum) - and events which shall be handled by WebServer/Homeassistant, this would be possible without further development.
This could even open the way to a community based IntendHandler/Skill repository.

If you are interested, just give me a word, and I see with what I can come up.

1 Like

Sure, I’d be interested to see what you’d come up with. Some constraints to keep in mind: all of Rhasspy’s services start up together and listen on the same broker. So I don’t think it’d be easy to control ordering of intent handling. However, rhasspy-supervisor could pass an intent whitelist/blacklist to each intent handling service as long as this is kept in the profile.

Did I get this right, @orca8119?
If you have full control over each intent’s handler, you could start Python scripts in for example “Home/Pi” and console commands for Raspbian directly out of Rhasspy and hand other intents over to home assistant. This would be a very nice feature.