Skip to content

A MagicMirror module that creates Telegram commands to control a MagicMirror via the MirrorCommandLine tools. Requires MMM-TelegramBot.

License

Notifications You must be signed in to change notification settings

doctorfree/MMM-TelegramCommands

Repository files navigation

"The cosmic operating system uses a command line interface. It runs on something like a teletype, with lots of noise and heat; punched-out bits flutter down into its hopper like drifting stars. The demiurge sits at his teletype, pounding out one command line after another, specifying the values of fundamental constants of physics:

universe -G 6.672e-11 -e 1.602e-19 -h 6.626e-34 -protonmass 1.673e-27

and when he’s finished typing out the command line, his right pinky hesitates above the enter key for an aeon or two, wondering what’s going to happen; then down it comes—and the whack you hear is another Big Bang."

― Neal Stephenson, In the Beginning...Was the Command Line

MMM-TelegramCommands

MagicMirror is an open source modular smart mirror platform. The MirrorCommand repository is a suite of command-line tools to manage a MagicMirror.

This repository maintains a MagicMirror module that creates and manages Telegram commands to control a MagicMirror via the MirrorCommand tools. It works in conjunction with the MMM-TelegramBot module.

Table of contents

  1. Requirements
  2. Installation
    1. MirrorCommand
    2. TelegramBot
  3. Configuration
    1. TelegramBot integration
    2. TelegramBot installation
  4. TelegramCommands usage
  5. Author

Requirements

MMM-TelegramCommands requires the installation and configuration of the MMM-TelegramBot module and the MirrorCommand suite of command line utilites for the MagicMirror.

Installation

To install the MMM-TelegramCommands module:

cd ~/MagicMirror/modules
git clone https://gitlab.com/doctorfree/MMM-TelegramCommands.git
cd MMM-TelegramCommands
npm install

MirrorCommand

To install the MirrorCommand package on your MagicMirror, Download the latest Debian package format release

Install the base MirrorCommand package by executing the command

sudo apt install MirrorCommand<version>.deb

TelegramBot

See below for instructions on TelegramBot installation.

Configuration

To enable the Telegram commands supported by the MMM-TelegramCommands module, after installing the module add the following to the MagicMirror config.js modules array:

{
  module: "MMM-TelegramCommands"
}

You can find a simple example config file in the examples directory as well as a more complex example.

Each of the Telegram commands added by MMM-TelegramCommands can be disabled in the config.js module entry. For example, to disable both the myreboot and myshutdown Telegram commands, set those to false in config.js:

{
  module: "MMM-TelegramCommands",
  config: {
    mirror: true,
    mmconf: true,
    mmvol: true,
    myreboot: false,
    myshutdown: false,
    myscreenshot: true,
    getb: true,
    setb: true,
    rotate: true
  }
}

All MMM-TelegramCommands are enabled by default so it is only necessary to add the minimal module entry above to enable the commands.

TelegramBot integration

You can control MMM-TelegramCommands using the Telegram app by installing the MMM-TelegramBot module and adding MMM-TelegramBot configuration to your config.js.

TelegramBot installation

Follow the instructions at the 4th Party Modules Wiki to create a Telegram Bot, install MMM-TelegramBot, and configure your MagicMirror config.js to enable Telegram commands.

Note: You do not need to create custom commands. The Telegram commands used with MMM-TelegramCommands are already created by the module. You only need to follow the 4th Party Modules Wiki Installation instructions.

TelegramCommands usage

Once installed and configured, you can control your MagicMirror display by sending messages in the Telegram app to your previously created Telegram Bot. The supported commands are as follows:

  • /mirror <options>
  • /mmconf <configname>
  • /mmvol <0-100>
  • /myreboot
  • /myshutdown
  • /myscreenshot
  • /getb
  • /setb <0-200>
  • /rotate <rotation>

For example, to activate the MagicMirror config file MagicMirror/config/config-sample.js, issue the Telegram command:

/mmconf sample

To restart MagicMirror, issue the Telegram command:

/mirror restart

See the MirrorCommand project for an in-depth review of all the various commands that can be issued using the /mirror command.

The Telegram commands /myreboot and /myshutdown execute the commands, respectively, /usr/local/bin/myreboot and /usr/local/bin/myshutdown. These custom reboot and shutdown commands can be used to perform actions prior to rebooting or shutting down the system on which MagicMirror is installed.

The Telegram command /mmvol can be used to set or retrieve the volume level on the MagicMirror. Supported /mmvol commands include:

  • /mmvol <percent>
  • /mmvol get
  • /mmvol mute
  • /mmvol unmute

Where <percent> is an integer between 0 and 100.

The Telegram command /myscreenshot triggers a screenshot of the MagicMirror and saves the screenshot in $HOME/Pictures/ScreenShots/

The Telegram commands /getb and /setb get and set, respectively, the MagicMirror screen brightness level. The brightness levels are 0-200, inclusive.

The Telegram command /rotate can be used to rotate the MagicMirror display. Supported /rotate commands:

  • /rotate right
  • /rotate left
  • /rotate normal
  • /rotate inverted

Author

About

A MagicMirror module that creates Telegram commands to control a MagicMirror via the MirrorCommandLine tools. Requires MMM-TelegramBot.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published