https://github.com/maartenpaauw/magic-mirror-vcgencmd
Manage your MagicMirror display through a rest API
https://github.com/maartenpaauw/magic-mirror-vcgencmd
homeassistant magicmirror magicmirror2
Last synced: 17 days ago
JSON representation
Manage your MagicMirror display through a rest API
- Host: GitHub
- URL: https://github.com/maartenpaauw/magic-mirror-vcgencmd
- Owner: maartenpaauw
- License: gpl-3.0
- Created: 2018-09-11T19:51:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-28T20:17:38.000Z (over 7 years ago)
- Last Synced: 2025-10-14T02:14:12.188Z (8 months ago)
- Topics: homeassistant, magicmirror, magicmirror2
- Language: JavaScript
- Homepage:
- Size: 24.4 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# MagicMirror vcgencmd
Turn the display on or off through a REST API.
## Getting Started
These instructions will get you a copy of the project up and running on your MagicMirror.
### Prerequisites
What things you need to install the software and how to install them
PM2 needs to be installed globally.
```bash
$ npm install pm2 -g
```
### Installing
Follow these steps to get it installed on the MagicMirror.
Clone the repository.
```bash
$ git clone https://github.com/maartenpaauw/magic-mirror-vcgencmd.git
```
Install the Node modules.
```bash
$ cd magic-mirror-vcgencmd
$ npm install
```
Run the webserver with PM2.
```bash
$ pm2 start pm2.json
```
Save the PM2 state.
```bash
$ pm2 save
```
The webserver will start when the Raspberry Pi reboots.
#### Home Assistant
```yaml
- platform: rest
name: magic_mirror
resource: http://magicmirror.local:3000/api/v1/magic-mirror/display
method: post
body_on: '{"state": "true"}'
body_off: '{"state": "false"}'
is_on_template: "{{ value_json.state }}"
headers:
Content-Type: application/json
```
## API endpoints
### GET /api/v1/magic-mirror/display
Will return the current state.
#### Returns
```javascript
{
"state": false // or true
}
```
### POST /api/v1/magic-mirror/display
Will turn the display on or off and return the current state.
#### Body
```javascript
{
"state": false // or true
}
```
#### Returns
```javascript
{
"state": false // or true
}
```
#### Built With
* [Express.js](https://expressjs.com/) - The web framework used
* [vcgencmd](https://www.elinux.org/RPI_vcgencmd_usage) - Linux package that manage the display
## Authors
* Maarten Paauw - *Initial work* - [maartenpaauw](https://github.com/maartenpaauw)
## License
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE.md](https://github.com/maartenpaauw/magic-mirror-vcgencmd/blob/master/LICENSE.md) file for details