Websocket + Appdaemon

Hello everyone!

I would like to have a visual feedback instead of the wavs when rhasspy detects a wakeword, recognizes (/fails to) an intend. I was thinking about doing this with the provided websockets. So far i found a python script for the detection of a wakeword, but I would like to integrate it into my appdaemon apps.
I’m not sure this is the right way to go, since i need the websocket to run forever and wait for a trigger inside it. So far I tried this, but it blocks the start of appdaemon, since the initialization can never finish.

import hassapi as hass
import websocket
import time
import requests
from matrix_lite import led

class OnWake(hass.Hass):

  def initialize(self):
    ws= websocket.WebSocketApp("ws://localhost:12101/api/events/wake",
                                on_message = self.on_wake)
    ws.on_open = self.log("\n**Connected**\n")
    ws.run_forever()

  def on_wake(ws, message):
      led.set((0,50,150,0))
      print("set glow") 

Any thoughts?

I’m currently working on a system containing the Raspi3 B+, Matrix Creator as mic/ Leds, Rhasspy 2.4.20 in a docker, Home assistant and appdaemon in seperate virtual environments.
Sorry for all my questions.

If you don’t want to code it yourself, you can take a look at https://github.com/project-alice-assistant/HermesLedControl, I think it could work for your setup

I would suggest to connect to the MQTT topics of Rhasspy for wake up events and other events.