I have a lot of things in my house connected using a Raspberry Pi mosquitto broker and Node-RED so I wanted to add simple publish commands to my AIY Project.
The code is hosted at Github here: https://github.com/ktinkerer/aiyprojects-raspbian/tree/mqtt
For this you will just need to copy the action.py file to your ~voice-recognizer-raspi/src/ folder.
For it to work you need to install paho-mqtt:
sudo pip install paho-mqtt
I’ve set this up as an example to swich lights on and off so you will need to tweak it to suit your own setup.