Hi Jason,
i tried your script but i have the following error :
ModuleNotFoundError: No module named 'rhasspyclient'
Indeed i can not find a rhasspyclient.py file in Git 
Hi Jason,
i tried your script but i have the following error :
ModuleNotFoundError: No module named 'rhasspyclient'
Indeed i can not find a rhasspyclient.py file in Git 
pip3 install rhasspyclient
pip3 install rhasspyclient
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting rhasspyclient
Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/rhasspyclient/
package name is rhasspy-client 
Thx, error is gone but now i have this one :
Command '['/home/pi/intentDispatcher.py']' returned non-zero exit status 1.
script runs (for ever) without error in the shell
Here are my logs :
[INFO:8485438] quart.serving: 192.168.1.17:61453 POST /api/text-to-intent 1.1 200 423 1105846
[ERROR:8485428] CommandIntentHandler: in_started
Traceback (most recent call last):
File "/home/pi/rhasspy/rhasspy/intent_handler.py", line 323, in in_ready
self.command, check=True, input=json_input, stdout=subprocess.PIPE
File "/usr/lib/python3.7/subprocess.py", line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/home/pi/intentDispatcher.py']' returned non-zero exit status 1.
[ERROR:8484402] __main__: api_events_intent
Traceback (most recent call last):
File "app.py", line 1122, in api_events_intent
text = await q.get()
File "/usr/lib/python3.7/asyncio/queues.py", line 159, in get
await getter
concurrent.futures._base.CancelledError
[INFO:8484387] quart.serving: 127.0.0.1:51632 GET /api/events/intent 1.1 101 - 166374865
[DEBUG:8484383] HermesMqtt: Published intent to hermes/intent/GetTime
[DEBUG:8484356] CommandIntentHandler: ['/home/pi/intentDispatcher.py']
[DEBUG:8484345] __main__: {"intent": {"name": "GetTime", "confidence": 1.0}, "entities": [], "text": "quelle heure est-il", "raw_text": "quelle heure est-il", "recognize_seconds": 0.002108573000441538, "tokens": ["quelle", "heure", "est-il"], "raw_tokens": ["quelle", "heure", "est-il"], "speech_confidence": 1, "slots": {}, "wakeId": "", "siteId": "default", "time_sec": 0.009440422058105469}
@duch, I wrote the script intending it to be a standalone script that runs continuously, handling intents that Rhasspy detects. I took this approach because I am not running home assistant in my project. Rhasspy needs to also be running (I run it in docker).
What is your context? How you are calling this script?
that’s what i thought reading the code but i don’t know python, i’m more a node guy.
anyway, i tried to call this script from rhasspy using the command system : https://rhasspy.readthedocs.io/en/latest/intent-handling/#command
completely off topic
i’ll try to run your script as a service and see what’s going on.
it’s alive ! But seems that something has changed with rhasspy-client :
python3 intentDispatcher.py
Got unhandled command:
Let me check. It is 5 45.
Task exception was never retrieved
future: <Task finished coro=<speak() done, defined at intentDispatcher.py:13> exception=AttributeError("'RhasspyClient' object has no attribute 'text_to_speech'")>
Traceback (most recent call last):
File "intentDispatcher.py", line 18, in speak
await client.text_to_speech(text)
AttributeError: 'RhasspyClient' object has no attribute 'text_to_speech'
that’s weird since i can see it in the code
The package hasn’t been updated since I added that method.
@synesthesiam can you update the package on pypi?
Thx, i pip uninstalled rhasspy-client and installed from source, it’s working.
now i wonder, which is better conceptually? Have a daemon that listens to Rhasspy thanks to the client or use the Command mechanism, great Dilemma
Sorry about that. Merged some of my own changes too and bumped the version to 1.1.0 on pypi.
Could someone please share their intent hanlder? Would be very helpful building one’s own! Appreciate it!
Cheers
I get the same error, did you manage to solve it? 
This is how a basic python handler could look like:
https://pastecode.xyz/view/784c3bd1
It implements “GetDate” and “Hello” intents.
awaesome, should be in the doc !
I’ve made a pull request
That’s great, thanks a lot!
Hey @Sam, when running your code I get this error:
Command ‘[’/intenthandler.py’]’ returned non-zero exit status 1.
Did you have the same problem?
Yes, it’s working here. I run a deployment with the official docker container. Have you looked at the server logs? The python error is printed there if there is one.
I have the same problem though the script works perfectly in command line when i feed it with the json found in the logs.
No error triggered in rhasspy logs 
Here they are
[INFO:1674335] quart.serving: 192.168.1.17:57945 POST /api/text-to-intent 1.1 200 461 313683
[DEBUG:1674319] CommandIntentHandler: forwarding -> ready
[DEBUG:1674318] HomeAssistantIntentHandler: POSTed intent to http://localhost:8123/api/events/rhasspy_Hello
[DEBUG:1674311] urllib3.connectionpool: http://localhost:8123 "POST /api/events/rhasspy_Hello HTTP/1.1" 200 43
[DEBUG:1674296] urllib3.connectionpool: Starting new HTTP connection (1): localhost:8123
[DEBUG:1674285] CommandIntentHandler: ready -> forwarding
[ERROR:1674283] CommandIntentHandler: in_started
Traceback (most recent call last):
File "/home/pi/rhasspy/rhasspy/intent_handler.py", line 328, in in_ready
self.command, check=True, input=json_input, stdout=subprocess.PIPE
File "/usr/lib/python3.7/subprocess.py", line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/home/pi/intentHandler.py']' returned non-zero exit status 1.
[DEBUG:1674041] CommandIntentHandler: ['/home/pi/intentHandler.py']
[DEBUG:1674034] __main__: {"intent": {"name": "Hello", "confidence": 1.0}, "entities": [], "text": "bonjour", "raw_text": "bonjour", "recognize_seconds": 0.001742455999192316, "tokens": ["bonjour"], "raw_tokens": ["bonjour"], "speech_confidence": 1, "slots": {}, "wakeId": "", "siteId": "default", "time_sec": 0.008512496948242188}
EDIT : i found the answer, i added a dependency to pytz but it was not installed in venv
also make sure that the script has exec permission:
chmod +x handler.py