MagicMirror/README.md

179 lines
11 KiB
Markdown
Raw Normal View History

2016-04-10 17:11:31 -04:00
![MagicMirror²: The open source modular smart mirror platform. ](.github/header.png)
2016-04-10 20:39:42 +02:00
2016-04-10 17:06:21 -04:00
<p align="center">
2016-05-12 13:01:44 +02:00
<a href="https://david-dm.org/MichMich/MagicMirror"><img src="https://david-dm.org/MichMich/MagicMirror.svg" alt="Dependency Status"></a>
<a href="https://david-dm.org/MichMich/MagicMirror#info=devDependencies"><img src="https://david-dm.org/MichMich/MagicMirror/dev-status.svg" alt="devDependency Status"></a>
2016-09-02 21:58:22 -04:00
<a href="https://bestpractices.coreinfrastructure.org/projects/347"><img src="https://bestpractices.coreinfrastructure.org/projects/347/badge"></a>
2016-04-10 17:11:31 -04:00
<a href="http://choosealicense.com/licenses/mit"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
2016-05-12 13:01:44 +02:00
<a href="https://travis-ci.org/MichMich/MagicMirror"><img src="https://travis-ci.org/MichMich/MagicMirror.svg" alt="Travis"></a>
<a href="https://snyk.io/test/github/MichMich/MagicMirror"><img src="https://snyk.io/test/github/MichMich/MagicMirror/badge.svg" alt="Known Vulnerabilities" data-canonical-src="https://snyk.io/test/github/MichMich/MagicMirror" style="max-width:100%;"></a>
2016-04-10 17:06:21 -04:00
</p>
2016-07-27 12:50:59 +02:00
**MagicMirror²** is an open source modular smart mirror platform. With a growing list of installable modules, the **MagicMirror²** allows you to convert your hallway or bathroom mirror into your personal assistant. **MagicMirror²** is built by the creator of [the original MagicMirror](http://michaelteeuw.nl/tagged/magicmirror) with the incredible help of a [growing community of contributors](https://github.com/MichMich/MagicMirror/graphs/contributors).
2016-04-10 20:39:42 +02:00
MagicMirror² focuses on a modular plugin system and uses [Electron](http://electron.atom.io/) as an application wrapper. So no more web server or browser installs necessary!
2016-03-28 13:47:40 +02:00
2016-04-10 17:11:31 -04:00
## Table Of Contents
2016-04-09 15:59:05 +02:00
- [Usage](#usage)
- [Configuration](#configuration)
- [Modules](#modules)
2016-04-11 11:35:56 +02:00
- [Known Issues](#known-issues)
2017-01-10 16:11:29 -03:00
- [Community](#community)
2016-04-09 15:59:05 +02:00
- [Contributing Guidelines](#contributing-guidelines)
2016-07-27 12:50:59 +02:00
## Usage
2016-09-10 16:41:57 -04:00
### Raspberry Pi Support
2016-04-24 14:18:41 +02:00
Electron, the app wrapper around MagicMirror², only supports the Raspberry Pi 2 & 3. The Raspberry Pi 1 is currently **not** supported. If you want to run this on a Raspberry Pi 1, use the [server only](#server-only) feature and setup a fullscreen browser yourself.
2016-09-10 16:41:57 -04:00
### Automatic Installer (Raspberry Pi Only!)
2016-04-09 15:14:01 +02:00
Execute the following command on your Raspberry Pi to install MagicMirror²:
````
bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh)"
2016-04-09 15:14:01 +02:00
````
2016-09-10 16:41:57 -04:00
### Manual Installation
2016-04-09 15:14:01 +02:00
1. Download and install the latest Node.js version.
2. Clone the repository and check out the master branch: `git clone https://github.com/MichMich/MagicMirror`
2016-04-09 15:15:27 +02:00
3. Enter the repository: `cd ~/MagicMirror`
2016-04-24 14:18:41 +02:00
4. Install and run the app: `npm install && npm start`
2016-04-03 17:46:09 +02:00
2016-04-07 21:04:24 -04:00
**Important:** `npm start` does **not** work via SSH, use `DISPLAY=:0 nohup npm start &` instead. This starts the mirror on the remote display.
2016-03-28 13:47:40 +02:00
2016-07-30 09:42:31 -04:00
**Note:** if you want to debug on Raspberry Pi you can use `npm start dev` which will start the MagicMirror app with Dev Tools enabled.
2016-09-10 16:41:57 -04:00
### Server Only
In some cases, you want to start the application without an actual app window. In this case, you can start MagicMirror² in server only mode by manually running `node serveronly` or using Docker. This will start the server, after which you can open the application in your browser of choice. Detailed description below.
2016-04-08 22:16:22 +02:00
2017-01-31 11:41:40 +01:00
#### Docker
2017-01-31 16:36:01 +01:00
MagicMirror² in server only mode can be deployed using [Docker](https://docker.com). After a successful [Docker installation](https://docs.docker.com/engine/installation/) you just need to execute the following command in the shell:
2017-01-31 11:41:40 +01:00
```bash
docker run -d \
--publish 80:8080 \
--restart always \
2017-01-31 16:36:01 +01:00
--volume ~/magic_mirror/config:/opt/magic_mirror/config \
--volume ~/magic_mirror/modules:/opt/magic_mirror/modules \
2017-01-31 11:41:40 +01:00
--name magic_mirror \
2017-01-31 16:36:01 +01:00
MichMich/MagicMirror
```
| **Volumes** | **Description** |
| --- | --- |
| `/opt/magic_mirror/config` | Mount this volume to insert your own config into the docker container. |
| `/opt/magic_mirror/modules` | Mount this volume to add your own custom modules into the docker container. |
You may need to add your Docker Host IP to your `ipWhitelist` option. If you have some issues setting up this configuration, check [this forum post](https://forum.magicmirror.builders/topic/1326/ipwhitelist-howto).
```javascript
var config = {
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:172.17.0.1"]
};
2017-01-31 11:41:40 +01:00
```
#### Manual
1. Download and install the latest Node.js version.
2. Clone the repository and check out the master branch: `git clone https://github.com/MichMich/MagicMirror`
2017-01-31 11:41:40 +01:00
3. Enter the repository: `cd ~/MagicMirror`
4. Install and run the app: `npm install && node serveronly`
2016-04-08 22:16:22 +02:00
2016-09-10 16:41:57 -04:00
### Raspberry Configuration & Auto Start.
2016-04-10 20:39:42 +02:00
2016-04-12 20:16:04 +03:00
The following wiki links are helpful in the configuration of your MagicMirror² operating system:
2016-04-10 20:39:42 +02:00
- [Configuring the Raspberry Pi](https://github.com/MichMich/MagicMirror/wiki/Configuring-the-Raspberry-Pi)
- [Auto Starting MagicMirror](https://github.com/MichMich/MagicMirror/wiki/Auto-Starting-MagicMirror)
2016-04-10 20:39:42 +02:00
2016-09-10 16:41:57 -04:00
### Updating your MagicMirror²
2016-04-21 09:16:53 +02:00
If you want to update your MagicMirror² to the latest version, use your terminal to go to your Magic Mirror folder and type the following command:
2016-09-10 16:41:57 -04:00
```bash
2016-10-04 16:19:33 +02:00
git pull && npm install
2016-09-10 16:41:57 -04:00
```
2016-04-21 09:16:53 +02:00
2016-07-27 12:50:59 +02:00
If you changed nothing more than the config or the modules, this should work without any problems.
2016-04-21 09:16:53 +02:00
Type `git status` to see your changes, if there are any, you can reset them with `git reset --hard`. After that, git pull should be possible.
## Configuration
1. Duplicate `config/config.js.sample` to `config/config.js`. **Note:** If you used the installer script. This step is already done for you.
2. Modify your required settings.
Note: You'll can check your configuration running the follow command:
```bash
npm run config:check
```
2016-04-09 15:59:05 +02:00
The following properties can be configured:
2016-04-10 17:59:31 -04:00
| **Option** | **Description** |
2016-04-10 17:14:19 -04:00
| --- | --- |
2016-04-10 17:59:31 -04:00
| `port` | The port on which the MagicMirror² server will run on. The default value is `8080`. |
2016-11-25 20:14:34 -03:00
| `address` | The ip address the accept connections. The default open bind `::` is IPv6 is available or `0.0.0.0` IPv4 run on. Example config: `192.168.10.100`. |
| `ipWhitelist` | The list of IPs from which you are allowed to access the MagicMirror². The default value is `["127.0.0.1", "::ffff:127.0.0.1", "::1"]`. It is possible to specify IPs with subnet masks (`["127.0.0.1", "127.0.0.1/24"]`) or define ip ranges (`["127.0.0.1", ["192.168.0.1", "192.168.0.100"]]`). Set `[]` to allow all IP addresses. For more information about how configure this directive see the [follow post ipWhitelist HowTo](https://forum.magicmirror.builders/topic/1326/ipwhitelist-howto) |
| `zoom` | This allows to scale the mirror contents with a given zoom factor. The default value is `1.0`|
2016-04-10 17:59:31 -04:00
| `language` | The language of the interface. (Note: Not all elements will be localized.) Possible values are `en`, `nl`, `ru`, `fr`, etc., but the default value is `en`. |
| `timeFormat` | The form of time notation that will be used. Possible values are `12` or `24`. The default is `24`. |
| `units` | The units that will be used in the default weather modules. Possible values are `metric` or `imperial`. The default is `metric`. |
2016-04-10 17:59:31 -04:00
| `modules` | An array of active modules. **The array must contain objects. See the next table below for more information.** |
| `electronOptions` | An optional array of Electron (browser) options. This allows configuration of e.g. the browser screen size and position (example: `electronOptions: { fullscreen: false, width: 800, height: 600 }`). Kiosk mode can be enabled by setting `kiosk = true`, `autoHideMenuBar = false` and `fullscreen = false`. More options can be found [here](https://github.com/electron/electron/blob/master/docs/api/browser-window.md). |
2016-04-10 17:59:31 -04:00
2016-10-04 16:25:39 +02:00
2016-04-09 15:59:05 +02:00
Module configuration:
2016-04-10 18:02:03 -04:00
| **Option** | **Description** |
2016-04-10 17:14:19 -04:00
| --- | --- |
2016-04-10 17:59:31 -04:00
| `module` | The name of the module. This can also contain the subfolder. Valid examples include `clock`, `default/calendar` and `custommodules/mymodule`. |
| `position` | The location of the module in which the module will be loaded. Possible values are `top_ bar`, `top_left`, `top_center`, `top_right`, `upper_third`, `middle_center`, `lower_third`, `bottom_left`, `bottom_center`, `bottom_right`, `bottom_bar`, `fullscreen_above`, and `fullscreen_below`. This field is optional but most modules require this field to set. Check the documentation of the module for more information. Multiple modules with the same position will be ordered based on the order in the configuration file. |
| `classes` | Additional classes which are passed to the module. The field is optional. |
| `header` | To display a header text above the module, add the header property. This field is optional. |
| `disabled` | Set disabled to `true` to skip creating the module. This field is optional. |
2016-04-10 17:59:31 -04:00
| `config` | An object with the module configuration properties. Check the documentation of the module for more information. This field is optional, unless the module requires extra configuration. |
2016-04-01 10:47:16 +02:00
## Modules
2016-03-30 15:20:14 +02:00
The following modules are installed by default.
2016-03-30 15:13:46 +02:00
2016-04-01 17:35:29 +02:00
- [**Clock**](modules/default/clock)
- [**Calendar**](modules/default/calendar)
- [**Current Weather**](modules/default/currentweather)
- [**Weather Forecast**](modules/default/weatherforecast)
- [**News Feed**](modules/default/newsfeed)
- [**Compliments**](modules/default/compliments)
- [**Hello World**](modules/default/helloworld)
2016-04-03 13:02:49 +02:00
- [**Alert**](modules/default/alert)
2016-03-31 11:08:06 +02:00
2016-05-04 15:25:23 +02:00
For more available modules, check out out the wiki page: [MagicMirror² Modules](https://github.com/MichMich/MagicMirror/wiki/MagicMirror²-Modules). If you want to build your own modules, check out the [MagicMirror² Module Development Documentation](modules) and don't forget to add it to the wiki and the [forum](https://forum.magicmirror.builders/category/7/showcase)!
2016-04-09 20:58:07 +02:00
2016-04-11 11:35:56 +02:00
## Known issues
- Electron seems to have some issues on certain Raspberry Pi 2's. See [#145](https://github.com/MichMich/MagicMirror/issues/145).
2016-07-27 12:50:59 +02:00
- MagicMirror² (Electron) sometimes quits without an error after an extended period of use. See [#150](https://github.com/MichMich/MagicMirror/issues/150).
2016-04-11 11:35:56 +02:00
2016-05-02 17:02:03 +02:00
## Community
The community around the MagicMirror² is constantly growing. We even have a [forum](https://forum.magicmirror.builders) now where you can share your ideas, ask questions, help others and get inspired by other builders. We would love to see you there!
2016-04-09 15:59:05 +02:00
## Contributing Guidelines
2016-04-03 20:27:55 +02:00
Contributions of all kinds are welcome, not only in the form of code but also with regards bug reports and documentation.
Please keep the following in mind:
2016-04-03 20:27:55 +02:00
2016-07-27 12:50:59 +02:00
- **Bug Reports**: Make sure you're running the latest version. If the issue(s) still persist: please open a clearly documented issue with a clear title.
2016-04-12 20:16:04 +03:00
- **Minor Bug Fixes**: Please send a pull request with a clear explanation of the issue or a link to the issue it solves.
- **Major Bug Fixes**: please discuss your approach in an GitHub issue before you start to alter a big part of the code.
- **New Features**: please please discuss in a GitHub issue before you start to alter a big part of the code. Without discussion upfront, the pull request will not be accepted / merged.
2016-04-03 20:27:55 +02:00
2016-07-27 12:50:59 +02:00
Thanks for your help in making MagicMirror² better!
2016-09-29 11:05:37 +02:00
<p align="center">
<br>
<a href="https://forum.magicmirror.builders/topic/728/magicmirror-is-voted-number-1-in-the-magpi-top-50"><img src="https://magicmirror.builders/img/magpi-best-watermark-custom.png" width="150" alt="MagPi Top 50"></a>
</p>