Mycroft [![Build Status](https://travis-ci.org/MycroftAI/mycroft-core.svg?branch=master)](https://travis-ci.org/MycroftAI/mycroft-core) [![Coverage Status](https://coveralls.io/repos/github/MycroftAI/mycroft-core/badge.svg?branch=dev)](https://coveralls.io/github/MycroftAI/mycroft-core?branch=dev)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
==========
Mycroft is a hackable open source voice assistant.
NOTE: The default branch for this repository is 'dev', which should be considered a working beta. If you want to clone a more stable version, switch over to the 'master' branch.
# Table of Contents
* [Getting Started](#getting-started)
* [Getting Involved](#getting-involved)
* [Creating a Skill](https://docs.mycroft.ai/skill.creation)
* [Documentation](https://docs.mycroft.ai)
* [Release Notes](https://docs.mycroft.ai/release-notes)
* [Pair Mycroft Device](https://home.mycroft.ai)
* [Mycroft Chat](https://chat.mycroft.ai)
* [Mycroft Forum](https://community.mycroft.ai)
* [Mycroft Blog](https://mycroft.ai/blog)
# Getting Started
### Ubuntu/Debian, Arch, or Fedora
- Run the build host setup script for your OS (Ubuntu/Debian: `build_host_setup_debian.sh`, Arch: `build_host_setup_arch.sh`, Fedora: `build_host_setup_fedora.sh`). This script installs necessary packages. Please read it!
- Run `dev_setup.sh` (Feel free to read it, as well).
- Restart session (Rebooting, or logging out and back in might work).
### Other Environments
The following packages are required for setting up the development environment and are installed by `build_host_setup` scripts:
- `git`
- `python 2`
- `python-setuptools`
- `python-virtualenv`
- `pygobject`
- `virtualenvwrapper`
- `libtool`
- `libffi`
- `openssl`
- `autoconf`
- `bison`
- `swig`
- `glib2.0`
- `s3cmd`
- `portaudio19`
- `mpg123`
- `flac`
- `curl`
- `fann`
## Home Device and Account Manager
Mycroft AI, Inc. maintains a device and account management system known as Mycroft Home. Developers may sign up at: https://home.mycroft.ai
By default, Mycroft software is configured to use Home. Upon any request such as "Hey Mycroft, what is the weather?", you will be informed that your device needs to be paired. Mycroft will speak a 6-digit code, which is entered into the pairing page within the [Mycroft Home site](https://home.mycroft.ai).
Once signed and paired, your unit will use Mycroft API keys for services such as STT (Speech-to-Text), weather, Wolfram-Alpha, and various other skills.
Pairing information generated by registering with Home is stored in:
`~/.mycroft/identity/identity2.json` <-- DO NOT SHARE THIS WITH OTHERS!
It is useful to know the location of this identity file when troubleshooting any device pairing issues.
## Using Mycroft Without Home.
If you do not wish to use the Mycroft Home service, you may insert your own API keys into the configuration files listed below in configuration.
The place to insert the API key looks like the following:
`[WeatherSkill]`
`api_key = ""`
Put a relevant key inside the quotes and Mycroft Core should begin to use the key immediately.
### API Key Services
These are the keys currently used in Mycroft Core:
- [STT API, Google STT](http://www.chromium.org/developers/how-tos/api-keys)
- [Weather Skill API, OpenWeatherMap](http://openweathermap.org/api)
- [Wolfram-Alpha Skill](http://products.wolframalpha.com/api/)
## Configuration
Mycroft configuration consists of 4 possible locations:
- `mycroft-core/mycroft/configuration/mycroft.conf`(Defaults)
- [Mycroft Home](https://home.mycroft.ai) (Remote)
- `/etc/mycroft/mycroft.conf`(Machine)
- `$HOME/.mycroft/mycroft.conf`(User)
When the configuration loader starts, it looks in these locations in this order, and loads ALL configurations. Keys that exist in multiple configuration files will be overridden by the last file to contain the value. This process results in a minimal amount being written for a specific device and user, without modifying default distribution files.
# Running Mycroft Quick Start
To start essential tasks, run `./mycroft.sh start`. This command will start the Mycroft service, skills, voice, and command line interface (cli) using `--quiet mode` in a detached screen. Output of these screens will be written to their respective log files (e.g. ./log/mycroft-service.log).
Optionally, you may run `./mycroft.sh start -v` which will start the Mycroft service, skills, and voice.
You may also run `./mycroft.sh start -c` which will start the Mycroft service, skills and command line interface.
To stop Mycroft, run `./mycroft.sh stop`. This command will terminate all detached screens.
To restart Mycroft, run `./mycroft.sh restart`.
# Quick Screen Tips
- Run `screen -list` to see all running screens.
- Run `screen -r [screen-name]` (e.g. `screen -r mycroft-service`) to reattach a screen.
- To detach a running screen, press `Ctrl + a, Ctrl + d`
See the [screen man page](http://man7.org/linux/man-pages/man1/screen.1.html) for more details.
# Running Mycroft
## With `start.sh`
Mycroft provides `start.sh` to run a large number of common tasks. This script uses a virtualenv created by `dev_setup.sh`. The usage statement lists all run targets, but to run a Mycroft stack out of a git checkout, the following processes should be started:
- Run `./start.sh service`
- Run `./start.sh skills`
- Run `./start.sh voice`
*Note: The above scripts are blocking, so each will need to be run in a separate terminal session.*
## Without `start.sh`
Activate your virtualenv.
With virtualenv-wrapper:
```
workon mycroft
```
Without virtualenv-wrapper:
```
source ~/.virtualenvs/mycroft/bin/activate
```
- Run `PYTHONPATH=. python client/speech/main.py` # Main speech detection loop, which prints events to stdout and broadcasts them to the message bus.
- Run `PYTHONPATH=. python client/messagebus/service/main.py` # Main message bus, implemented via web sockets.
- Run `PYTHONPATH=. python client/skills/main.py` # Main skills executable, loads all skills under skills directory.
*Note: The above scripts are blocking, so each will need to be run in a separate terminal session. Each terminal session will require that the virtualenv be activated. There are very few reasons to use this method.*
# Getting Involved
This is an open source project and we would love your help. We have prepared a [contributing](./CONTRIBUTING.md) guide to help you get started.
If this is your first PR or you're not sure where to get started,
say hi in [Mycroft Chat](https://chat.mycroft.ai/) and a team member would be happy to mentor you.
Join the [Mycroft Forum](https://community.mycroft.ai/) for questions and answers.
# FAQ / Common Errors
#### When running Mycroft, I get the error `mycroft.messagebus.client.ws - ERROR - Exception("Uncaught 'error' event.",)`
This means that you are not running the `./start.sh service` process. In order to fully run Mycroft, you must run `./start.sh service`, `./start.sh skills`, `./start.sh voice`, and `./start.sh cli` all at the same time. This can be done using different terminal windows, or by using the included `./mycroft.sh start` command, which runs all four process using `screen`.