In order to make my Jabra 510 USB speaker to work with Snips, I need to change the setting in /root/.asoundrc by adding some lines regarding to sampling rate. Otherwise, its tts always play 16000Hz wav file at faster speed which is too weird to be understood.
However, the Snips addon only allows modifying device&subdevice numbers of mic&speaker in options. Is there any way to replace the file “.asoundrc” with my own version in the container “armhf_addon_snips”? Or maybe replace original run.sh with modified one (add some lines to copy new .asoundrc to replace original one)?
I finally create my local snips addon based on the official one. With local addon, you can then add/replace/modify any file and rebuild the docker image file for local use. Be remember to remove the line to specify image file in config.json. Otherwise, hass.io will always download image file instead build local one.
Create a directory like “mysnips” in /addons of hass.io and copy all files of snips add-on to the new directory.
Create asound.conf in mysnips. For Jabra 510, the asound.conf should be:
type asym
playback.pcm {
type plug
slave {
pcm “hw:0,0”
rate 48000
}
}
capture.pcm {
type plug
slave.pcm “hw:1,0”
}
}
modify Dockerfile by adding the following line in section “#Copy data”
COPY asound.rc /etc/
modify config.json, delete the last line and the comma before it.
{
“name”: “Snips.AI”,
“version”: “4”,
“slug”: “snips”,
“description”: “Local voice control platform”,
“url”: “https://home-assistant.io/addons/snips/”,
“startup”: “application”,
“boot”: “auto”,
“arch”: [“armhf”, “amd64”],
“map”: [“share”],
“tmpfs”: “size=10m”,
“audio”: true,
“services”: [“mqtt:need”],
“homeassistant_api”: true,
“options”: {
“assistant”: “assistant.zip”,
“language”: “en”,
“custom_tts”: {
“active”: false,
“platform”: “amazon_polly”
}
},
“schema”: {
“assistant”: “str”,
“language”: “match(en|de|fr)”,
“custom_tts”: {
“active”: “bool”,
“platform”: “str”
}
}, <=== delete the comma
“image”: “homeassistant/{arch}-addon-snips” <=== delete this line
}
If config.json is modified correctly, you can find the new local add-on in the section of local add-ons in Add-on store. Build the addon and then run it. It will take some minutes because it will download the original image file and then rebuild the docker image file.
what a instruction, I was playing a little bit with ssh addon to reach the container but I understand this is better approach.
I get these faults when I try to build.
Blockquote18-11-14 19:15:14 INFO (SyncWorker_5) [hassio.docker.addon] Start build local/armhf-addon-snips:4
18-11-14 19:15:23 ERROR (SyncWorker_5) [hassio.docker.addon] Can’t build local/armhf-addon-snips:4: COPY failed: stat /var/lib/docker/tmp/docker-builder589001555/asound.rc: no such file or directory
18-11-14 19:15:37 INFO (SyncWorker_3) [hassio.docker.addon] Start build local/armhf-addon-snips:4
18-11-14 19:15:39 ERROR (SyncWorker_3) [hassio.docker.addon] Can’t build local/armhf-addon-snips:4: COPY failed: stat /var/lib/docker/tmp/docker-builder991709568/asound.rc: no such file or directory
I did only create the asound.conf so I understand if it complain of asound.rc
shall it be asound.conf instead in the docker file or do I need to add asound,rc?
changed to asound.conf and now I get this, does it mean that I cant run the latest version of Snips (i´m running resinos). do i need to take a older version but that seems strange as it´s the same as the official one… 58.3?
BlockquoteRROR:snips_nlu : Unable to read file ‘/usr/share/snips/assistant/nlu_engine/nlu_engine.json’
→ caused by: Expected model version 0.16.0 but found 0.17.0
1542224599: Socket error on client 651aaab53d564dcb88fc6c3261064bd1, disconnecting.
2018-11-14 20:43:19,184 INFO exited: snips-nlu (exit status 1; not expected)
2018-11-14 20:43:20,187 INFO gave up: snips-nlu entered FATAL state, too many start retries too quickly
Getting the same error after updating the snips addon to version 4.0. I think its because the assistant is created with a later version than the snips addon is running.
I created a local version of the snips addon as well, but can’t figure out how to update the snips version. The only reference to the version I can find is in the build.json file, but simply changing that to a later version breaks the addon.
Edit2:
There is already a pull request to update the snips version. Looking at the commit it looks like it should be enought to change the version in the build.json. Only problem is that one must also include a new arm image.
Yes, the latest snips is 0.60.1. However, they does not release ARM-version docker image file but only X86 version this time. So rebuilding local add-on by changing version will fail. Official snips add-on only download v0.58.3 image file which use v0.16 nlu engine. But the snips console is updated for v0.60.1. The new assistant file generated by the new console seems not to be compatible with v0.16 nlu. I guess that’s why you have problem. I think you may find some response if submitting your question in snips forum in discord.
The assistant-**.zip in the official snips add-on are removed. I guess there is the same compatible issue so that the add-on owner removed them. So you have to get assistant files from snips console which is already updated to nlu V0.17. But nlu V0.17 is for snips V0.60.1, not V0.58.3. I don’t have the compatibility issue because my own assistant files were created before the console was updated.
By the way, here is Snips V0.60.1 known issues. I think that’s why there is no ARM image file. Unless you have assistant files compatible with nlu v0.16, you probably have to wait for next update.
Known issues
Jessie distribution is not supported in this build.
Jackd audio support is not supported in this build for raspbian stretch.
Don’t install this update on raspberry pi zero, the platform will no longer work. A fix will be publish ASAP.