Bridging Hassio / Snips MQTT

Can anyone assist me with bridging the MQTT? Following SkyHyperV’s example (https://www.youtube.com/watch?v=x4bo7ru9q2M&t=356s) when I edit the Snips mosquitto.conf Mosquitto goes Active (exiting) with a error of duplicate pid_file. I have followed the instructions to letter except I’m not using passwords and allow_anonymous true. I have tried moving mosquitto.conf into conf.d folder and leaving it within mosquitto but all the same. Any advice would be fantastic

1 Like

Just a option because I’m not a guru that can help with this but… I followed every tutorial I could find to try and bridge hass with snips and just couldnt get it to work. In the end the simple answer for me was just use a mqtt node in node red to listen to the snips server then do all your snips actions in node red. And use another mqtt node to publish to homeassistant. No config file bridging required and … node red rocks :grin:

Also I followed this video about 50 times and although spoken clearly I couldnt get it to work. However the issue your facing I did strike myself now that I recall. Leave the conf file where it was in /etc/mosquitto/ then when copying his mosquitto file to conf.d make sure you comment out ANYTHING in his conf.d file that is listed in the original /etc/mosquitto/mosquitto.conf file. (Like the pid line ) Try not to modify the original conf file only the one in conf.d.

Ps I’m not on the PC at the moment so I might of answered the paths wrong but you will hopefully understand what I mean :sunglasses:

@lazza Thanks Got it working by removing the IP reference in the moquitto.conf on the Snips server. Will return to this tomorrow with your config and see report back. Yours looks like a better option than my ‘hack’

Nodered seems to be a a better option for one off builds but I have a few hundred to build so coding would be the better way

However, looking with interest at the API option and seeing how that develops

Do you have snips and HA installed on the same device? Then you cannot follow that video to the last bit. This is intended for bridging MQTT between two devices.

On one device, just point snips to the HA MQTT bus, or the other way around. (Probably pointing one of them to 127.0.0.1:1833 should work)

Different devices (Hassio on Odroid XU4 and Snips on Pi 4+) hence the original query :slight_smile:

Hello lazza,

your setup sounds interesting. I also want to connect my home-assistant to Snips via MQTT and use node-red in HA. Could you provide further details or maybe an article on how to configure MQTT on Snips-device, that i can listen on the intends on my seperate HA-raspi?

Best regards

Nicolas

hi Nicolas, Turns out that it’s a simple process actually. Happy to do a more in depth article on it separately if you need but the basics are

For ease of the below guide lets assume you have …

  1. A raspberry PI setup independently with SNIPS on it and a assistant installed. and for the below example lets assume the IP of the SNIPS Pi is 10.0.1.230

  2. Another separate Raspberry pi running HassIO ( home assistant ) with the MQTT addon installed and the Node Red addon installed.

Configure Node red to talk to SNIPS via MQTT

  1. Jump into your Node red screen on Homeassistant

  2. Drag a “MQTT IN” node onto the screen and double click on it to open the properties screen of the node.

  3. At the end of the “server” field click the pencil icon to edit the properties. This is where you’ll be adding the details for your SNIPS pi. On the connection tab of this screen add your snips Pi address… for this example we would use 10.0.1.230. For the name field call it “SNIPS”. Unless you have a password set up on your snips MQTT broker then there is no more you need to fill in on this screen so click the RED update or save button to exit that screen. If your MQTT broker has a password set up then fill those details in on the security tab.

  4. Now you should be back on the “properties screen” of the MQTT In node. now instead of the pencil icon click the drop arrow of the server field and select SNIPS". For the “topic” field add " hermes/intent/# " (without the “”) . What this is saying is listen to all intents coming from the SNIPS broker. Now click “done” to close that properties window.

You have now effectively bridged SNIPS Pi to the HassIO pi. Messages from SNIPS will now be relayed to the Node you just setup so now you can use homeassistant nodes to turn on or off switches.

Taking it a step further

  1. Now drag a “YAML” node to the screen and link it to the “MQTT Node”. What this is doing is changing the incoming payload from snips to something we can tweak and modify further in the flow of node red.

  2. now drag a “SWITCH” node into the screen and configure it as this.

the property field needs to be set to " msg.payload.intent.intentName "
and the field under that should be "== your snips username and intent name " EG : == LazzaWA:TurnlightOn

Now when ever the incoming intent called TurnlightOn arrives it will continue the flow from the top ouput of the switch node allowing you to do what ever you want with it. Keep adding rows to make more outputs.

Hope that makes sense.

For clarity and ease i’ve also made up a example of the flow above that you can import into node red

Import this example flow

[{“id”:“487f4a6c.15c50c”,“type”:“switch”,“z”:“d8b2d6eb.641028”,“name”:"",“property”:“payload.intent.intentName”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“LazzaWA:TurnlightOn”,“vt”:“str”},{“t”:“eq”,“v”:“LazzaWA:TurnlightOff”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:2,“x”:419,“y”:87,“wires”:[[“caf171c5.8a8728”,“570736a3.386f9”],[]]}]

Not sure how familiar you are with node red so in case you want some ideas on that as well,
There’s also one of my node red flows on my github repo if you wanted to import that to get some ideas

Enjoy :slight_smile:

Thank you so much for your support. As i don’t have enough time now, i’ll try it in about 2 weeks and reply to you.:slight_smile:
I was also wondering, if the Snips MQTT Broker by default only publishes messages on it’s own device and therefore needs further configuration. Seems like i’ve been wrong.