Appdaemon with rhasspy events and MATRIX

Hello everyone!

I’m quite new to Rhasspy and appdaemon and already have a couple of questions.
I’m currently working on a system containing the Raspi3 B+, Matrix Creator as mic, Rhasspy 2.4.20 in a docker, Home assistant and appdaemon in virtual environments.
I got appdaemon partly running - the basic example sending a message in the log file and switching lights home assistant off with a timer are working, so I guess the setup is correct.
However, when I want an action to be triggered by a rhasspy event like rhasspy_Party i can’t get it working. A working example of this would be awesome!

Also my final goal is to use the sensors and actors of the Matrix device upon a voice command. (Using it as an Remote control to turn on the tv and stereo, giving feedback with the builtin LEDs, …)
With appdaemon i got the error, that the python-matrix modules were missing, although they are installed on the pi. I thought of a workaround calling a .py in the appdaemon file, when i don’t need interaction.
Do you have suggestions of a setup for the scenario I described? Maybe there are options I havent thought of yet? (I haven’t grasped the use of MQTT for example)

I would be thankful for any help or remarks!

Hi,

i think that should work.

import appdaemon.plugins.hass.hassapi as hass

class timer(hass.Hass):

def initialize(self):

    self.listen_event(self.rhasspy_light, "rhasspy_Light") #Eventname from Rhasspsy


def rhasspy_light(self, event_id, payload_event, *args):
    self.log(payload_event)
    entity = payload_event['lights']
    servicerhasspy = payload_event['service']
    domain, service = servicerhasspy.split('.')
   
    self.call_service(
        f"{domain}/{service}", entity_id=entity   #dont't know if this working? haven't try before
    )
    
    self.call_service(
        "light/turn_on", entity_id='light.your_light  #should work
    )

For the LED Feedback you should take a look at hermes Led

Thanks, I was missing a 4th argument in the rhasspy_light() :+1: