Private Voice Assistant in Norwegian (or any other obscure language)

I am probably above average concerned with privacy, so I would never want one of the public voice assistants, like google voice or alexa, in my house. I do not trust them at all. That being said, I have been envious of the possibility to make things happen with voice. Especially adding things to a shopping list and turning off the television, but for me to adopt it, it would need to be private. This has been fully possible for some languages like english for some time, using mycroft or rhasspy. Rhasspy is fully off cloud private, which is really nice. Mycroft is cloud dependent, but still private, as the data towards google is funneled through their service. Registering with a dummy email, it is at least no possibility to be identified. The problem for me is that I wanted this voice assistant to work in my mother tongue, Norwegian. Then the options was limited. So I created this MyQTT skill for Mycroft, and moved all the logic to Node-Red. The skill is here:

Video is in Norwegian:

The MyQTT-skill uses a list of words as trigger, and whenever you say one of these words, MyQTT will send the whole sentence to your mqtt broker. Here it is picked up by Node-Red and here is where all the logic happens. Whether it is turning on or off lights, TV or heating, or adding/removing things from your shopping list, or answering questions regarding sensor data, like what temperature it is outside or inside.

Best thing for me is that it works in Norwegian (and any other language google voice supports).

Hardware
I’m using a RPi 4 for Picroft. RPi 3 is supposedly also supported.
You also need a good microphone. I’ve tested different types.

  • Cheap old-style USB-mic
    • No good, sound quality is just to bad.
  • Raspi Voice Hat
    • Could not get this to work properly
  • Sennheiser SP20
    • Probably the sleakest setup, as you have mic and speaker in one unit. Mic works good.
  • Respeaker 4-mic array

If you are not going for a conference-style mic with speaker, you also need an external speaker with some sort of amplifier. I initially wanted to create one single unit in a box using the respeaker 4-mic and a cheap phono-connected speaker. This did not work. The noise from the RPi processing was leaking through the sound card to the amplifier and created awful humming and buzzing sounds. I could bypass the problem using different power supplies or it could probably be solved using some sort of filtering setup. The easiest was using a conference microphone like the sennheiser.

Software
First off, you need Home Assistant and an MQTT broker. I am using the Mosquitto add-on in HA. This works well.

Then you need Mycroft (Picroft if using RPi). Get it from:
Mycroft
Follow their guide to install it to your RPi.
Then you need to install the MyQTT skill for Mycroft. SSH in and:

mycroft-msm install https://github.com/erikkt/myqtt.git

Then configure the skill in your account at home.mycroft.ai

  • Ensure MQTT is enabled.
  • Create a custom base topic name <base_topic>. This can be any MQTT formatted topic.
  • Set IP Address of your broker
  • Set the websocket Port of your broker.
  • Set username/password of your broker
  • The <location_id> is automatically obtained from the Device websettings “Placement”.

You also need to make Home Assistant able to reply to Mycroft:

# Example configuration.yaml entry
mycroft:
  host: 0.0.0.0 (Mycroft IP address)

# Example configuration.yaml entry
notify:
  - platform: mycroft
    name: mycroft

Then you need Node Red. It is here the logic happens after your spoken sentence is sent to your MQTT broker. I’ve created some examples in github that can be used as a proof of concept:
Node Red examples
They include turning on/off lights and TV, adding/removing items from the HA shopping list, casting to a media device and reporting temperature sensor value.

Lastly some tips if you are using an Mycroft unsupported language like Norwegian.
To avoid the “not.loaded” error when not hitting the correct commands, do the following:

cd ~/mycroft-core/skills/fallback-unknown.mycroftai/vocab
cp -r en-us/ no-no/
cd ~/mycroft-core/skills/fallback-unknown.mycroftai/dialog
cp -r en-us/ no-no/
nano no-no/unknown.dialog

Edit the file and translate it to Norwegian (or your language). This is also wise to do on the “volume” skill, so that you can turn up and down the volume on Mycroft using voice commands.

5 Likes

Have you looked at Rasspy? It is private and supports quite a few languages

https://rhasspy.readthedocs.io/en/latest/

Yes. I mentioned Rhasspy in my text. It does not support Norwegian.

Sorry I skimmed too fast!

thanks for this awesome Mycroft Skill! works like a charm, the only problem is that the response service doesn’t work for me… everytime homeassistant gives an API error and I don’t know why… I use Mycroft v20.8.1 and HA core-2021.3.4. IP address of mycroft device is right. Do you know, how I could solve this issue?

grafik

EDIT: found the problem by myself… the problem was host: 192.168.1.98 and then the command… with host: 192.168.1.98 it’s working! :smiley:

That’s great :slight_smile:
Thanks for testing it!

Thanks for this awesome skill!! do you know, is it possible to add more than one mycroft instance to the configuration yaml?

It should be, but I haven’t tested it:
https://github.com/ruth-connect/hass-multi-mycroft

thanks, works like a charm! :smiley: now i have to think about, what is the best way to seperate both mycroft devices for incoming mqtt and outgoing messages :slight_smile: