The hass.io container has the mosquitto broker add-on installed. The configuration includes a certificate and private key (you can use openssl to create a simple self-signed certificate for initial setup). Also set a username and password in the config. Under the “Network” settings, blank out the settings for 1883 and 1884. Be sure 8883 and 8884 are set. Create two files in the share/mosquitto directory for hass.io (install the samba share if you don’t have other access). The two files are:
— end file—
Replace <username> with the username you set in the config earlier.
Now, on to the snips setup. Set up your snips server and satellite and make sure that’s working first. Next, if you’re running your hass.io docker container on the same system as your snips server (in a docker or not), there’s some additional setup and non-standard settings to use. Otherwise, you can follow any of the myriad of directions for bridging MQTT between snips and Home Assistant (but don’t bother publishing topics other than “hermes/intent/#”, and maybe the TTS topics, if hass.io needs to respond verbally, in which case, adjust the ACL above).
Now, for a use case like mine, you’ll need to set up the bridge. This means you need to install mosquitto on the snips server (ignore all the comments about how snips does this for you; they’re either out-dated or just plain wrong, AFAICT). Make sure to connect to the proper IP address of your add-on container, and port 8883. Copy the certificate you created above to someplace on your snips server, and specify that as bridge_cafile (note: if you aren’t using a self-signed certificate, configure the appropriate root certificate instead). Comment out any listener and protocol lines for the mosquitto configuration, too.
snips.toml on the snips server should be configured properly already, since you had the satellite working. Don’t mess with it.
Now, because you’ve got a docker container running mosquitto on port 1883 and your snips server is also running mosquitto on port 1883, there will be problems. If you’re not running the snips server in another container, you’ll have to see if you can convince mosquitto to NOT listen on port 1883 (it seems like a bug to me, but I couldn’t do that – it always listened on port 1883, no matter what I configured). So, when I start the docker container for the snips server, I re-direct port 1883 to port 9883. Additionally, I make sure it’s on the same network as the hass.io containers (–net hassio when starting the container). Additionally, in your docker file, make sure you don’t EXPOSE 1883/tcp. It might not hurt, but it won’t help anything.
Finally, because you now expose the snips server’s mosquitto on port 9883, instead of 1883, you’ll have to change snips.toml on the satellite. Simply change the mqtt setting in snips-common to point to port 9883.
Additionally, I don’t use the snips add-on for hass.io – it doesn’t include snips-injection, is out of date (last I checked), and the container itself isn’t as configurable as I’d like. The major draw-back to that is that when you install your assistant, any skills for home assistant have to manually installed. It’s not hard, and this part isn’t really documented nicely.
Installing the skills – you need to ensure that the skills are installed correctly on the snips server (assuming you’ve set up your snips server correctly, this is easy). Then copy the skills from the snips server’s /var/lib/snips/skills/ directories, and place them in the config/python_scripts for hass.io (again, the samba share add-on can help you locate the config directory, and you probably need to create python_scripts). You’ll need to add the “python_script” and “snips” components to your HomeAssistant configuration.yaml file. They don’t need to be configured, just add them to the file. Finally, you need add the intent_script component. I set mine to like this:
intent_script: !include intent_script.yaml
That lets me keep all of the intent scripts in a separate configuration file. Be sure to read the documentation to configure the intent scripts correctly. It’s excellent documentation, but there’s nothing to tell you that this (along with the other two components) are what you need to enable all this stuff. Like a lot of what I’ve found, HomeAssistant and snips both have a lot of good documentation for individual parts, but almost nothing that tells you how to put it all together.
Finally, restart everything. I usually make sure hass.io is running first, but I’ve restarted it several times while the satellite and snips server are running without any issues. Likewise, I’ve restarted the snips server with the satellite and hass.io running without any problems. I almost never have to touch the satellite – I don’t run any skills on it, and it’s the one piece that “just works”.