synesthesiam / rhasspy

Rhasspy voice assistant for offline home automation
https://rhasspy.readthedocs.io
MIT License
944 stars 101 forks source link

Unable to enable Intent Handling #110

Closed UnderpantsGnome closed 4 years ago

UnderpantsGnome commented 4 years ago

Raspberry Pi 4B Raspbian buster Rhasspy version

git log -n 1
commit 268c2c5295dd0328483012d004c321adf2d5b37c (HEAD -> master, origin/master, origin/HEAD)
Author: Michael Hansen <hansen.mike@gmail.com>
Date:   Sat Dec 21 16:09:06 2019 -0500

    Bump rhasspynlu version. Remove kaldi online.conf check

Rhasspy config

{
    "mqtt": {
        "enabled": true
    },
    "wake": {
        "system": "porcupine"
    }
}

No matter witch intent recognition option I chose, it always shows as disabled after the restart. I don't have any "Problems" shown in the UI nor anything in the logs. Not sure where to look.

frkos commented 4 years ago

Looks like it's related to my issue https://github.com/synesthesiam/rhasspy/issues/104

As a workaround try to edit your profile.json directly (advanced in settings or just open it in a text editor) and add there required values: https://rhasspy.readthedocs.io/en/latest/intent-handling/

It works for me

UnderpantsGnome commented 4 years ago

@frkos yea I realized I had my Intent verbs mixed up yesterday. Even after looking at the defaults I'm not sure what I need in my profile.json to get it to send intents to a local MQTT broker. 🤷🏼‍♂️

frkos commented 4 years ago

According to Rhasspy docs you should add the following *with your host,user and password

"mqtt": {
    "enabled": true,
    "host": "localhost",
    "username": "",
    "password": "",
    "port": 1883,
    "reconnect_sec": 5,
    "site_id": "default",
    "publish_intents": true
}
UnderpantsGnome commented 4 years ago

@frkos yea I added that stuff, well the enabled part, the rest are the defaults so it strips that from the profile, but Intent Handling is still disabled. I guess I'll just wait until the UI is fixed. I just set his up the other day so it's not like a working system is broken 🙂

tobycheese commented 4 years ago

Seems to be a regression. I have two installations, with 2.4.13 I can enable intent handling, with 2.4.14 I cannot.

frkos commented 4 years ago

Despite I do not have it in the interface, I've just enabled intent handling for Home assistant and it works So I believe editing profile.json should work for all of us @UnderpantsGnome try to provide your MQTT IP address instead of localhost. Do you see anything in the log?

And do not forget to press Ctrl+R... My Chrome stores previous settings in cache =\

UnderpantsGnome commented 4 years ago

This may be a misunderstanding on my part, I'm not using Home Assistant, I have an MQTT broker running on the pi collecting temp/humidity from sensors around the house. I was thinking (hoping) that checking Enable MQTT and Publish intents over MQTT would just work and I could handle the intents there. I do have the below that shows up in the logs, the python error repeats ~5 times.

DEBUG:__main__:{"intent": {"name": "GetTime", "confidence": 1.0}, "entities": [], "text": "what time is it", "raw_text": "what time is it", "recognize_seconds": 0.0018868890001613181, "tokens": ["what", "time", "is", "it"], "raw_tokens": ["what", "time", "is", "it"], "speech_confidence": 1, "slots": {}, "wakeId": "", "siteId": "default", "time_sec": 0.010148286819458008}
[2019-12-23 15:24:54,490] 10.0.0.44:58907 POST /api/text-to-intent 1.1 200 326 20535
INFO:quart.serving:10.0.0.44:58907 POST /api/text-to-intent 1.1 200 326 20535
[2019-12-23 15:24:54,495] 10.0.0.44:58731 GET /api/events/log 1.1 101 - 198917890
INFO:quart.serving:10.0.0.44:58731 GET /api/events/log 1.1 101 - 198917890
[2019-12-23 15:24:54,499] 10.0.0.44:58773 GET /api/events/log 1.1 101 - 114575937
INFO:quart.serving:10.0.0.44:58773 GET /api/events/log 1.1 101 - 114575937
[2019-12-23 15:24:54,503] 10.0.0.44:58788 GET /api/events/log 1.1 101 - 38931895
INFO:quart.serving:10.0.0.44:58788 GET /api/events/log 1.1 101 - 38931895
ERROR:__main__:api_events_log
Traceback (most recent call last):
  File "app.py", line 1139, in api_events_log
    text = await q.get()
  File "/usr/lib/python3.7/asyncio/queues.py", line 159, in get
    await getter
concurrent.futures._base.CancelledError
[2019-12-23 15:24:54,594] Error in ASGI Framework
Traceback (most recent call last):
  File "/home/pi/apps/rhasspy/.venv/lib/python3.7/site-packages/hypercorn/asgi/wsproto.py", line 91, in handle_asgi_app
    await asgi_instance(self.asgi_receive, self.asgi_send)
  File "/home/pi/apps/rhasspy/.venv/lib/python3.7/site-packages/quart/asgi.py", line 106, in __call__
    await _cancel_tasks(pending)
  File "/home/pi/apps/rhasspy/.venv/lib/python3.7/site-packages/quart/asgi.py", line 189, in _cancel_tasks
    raise task.exception()
  File "/home/pi/apps/rhasspy/.venv/lib/python3.7/site-packages/quart/asgi.py", line 157, in handle_websocket
    'code': 1000,
  File "/home/pi/apps/rhasspy/.venv/lib/python3.7/site-packages/hypercorn/asgi/wsproto.py", line 149, in asgi_send
    await self.asend(CloseConnection(code=int(message["code"])))
  File "/home/pi/apps/rhasspy/.venv/lib/python3.7/site-packages/hypercorn/asyncio/wsproto.py", line 93, in asend
    self.write(self.connection.send(event))
  File "/home/pi/apps/rhasspy/.venv/lib/python3.7/site-packages/wsproto/__init__.py", line 64, in send
    data += self.connection.send(event)
  File "/home/pi/apps/rhasspy/.venv/lib/python3.7/site-packages/wsproto/connection.py", line 101, in send
    "Connection cannot be closed in state %s" % self.state
wsproto.utilities.LocalProtocolError: Connection cannot be closed in state ConnectionState.CLOSED

It looks like I may be better off just using the WebSockets and Node-RED, instead of funneling it through MQTT.

synesthesiam commented 4 years ago

Finally tracked down the source of this problem. Silly problem in my Vue code. Any web developers want to take over the Rhasspy web UI? ;)