Skip to content

Latest commit

 

History

History
140 lines (99 loc) · 4.76 KB

TELEGRAM.rst

File metadata and controls

140 lines (99 loc) · 4.76 KB

Telegram Communication

Telegram-Bot setup

Create a new Telegram-Bot

  • Telegram must be installed on Smartphone/PC,...
  • Open the following website: https://telegram.me/BotFather
  • Click on 'SEND MESSAGE' (Telegram should open and create a new contact 'BotFather')
  • Create a new bot with the command '/newbot
  • Enter a name for the bot
  • Enter a username for the bot
  • You will receive a token which has to be entered in RTOC (looks like this: 123456789:AABBAABB66AA11_uGG22GH44AA55_3)

Configure RTOC for Telegram

You can eather configure it in the settings of the RTOC GUI or edit the config.json file by yourself. Enter your Bot-Token there and activate it (active=True).

User permissions

By default any new client connected to this bot will have no permissions. You can change the default behavior in config.json.

The first client connected to the bot will automatically be admin. The admin has the permission to change the permissions of all users.

  • blocked: No permissions at all
  • read: Can receive event-notifications and plot signals
  • write: Can create global Events/Actions, send Events/Signals, access devices
  • admin: Full permissions. Can delete signals, access settings menu

image

Mainmenu

  • <USER_ACTIONS>
  • Latest values [read,*write,admin*]
  • Signals [read,*write,admin*]
  • Devices [write,*admin*]
  • Send event/signal [write,*admin*]
  • Automation [write,*admin*]
  • Settings [read,*admin,write*]
    • Set Event Notification [read,*write,admin*]
    • General [admin, write]
    • Telegram-Bot [admin]
    • Backup [admin]

Latest values

Displays the most current measured value of each signal.

Signals

Contains a list of all signals. Clicking on a signal will select this signal. You can also select the time-period with Select period. Generate plot will send you a plot with your selected signals in the selected period of time.

Show/Hide events will show/hide events in the plot. Events are displayed as vertical lines with the event-text

Delete signals [admin] will delete all selected data (signals and time-period).

Delete events [admin] will delete all selected events (time-period).

Devices

Contains a list of all devices/plugins found on the RTOc server (see submenu: Device).

Device - Start/stop device - Functions: List of all device functions. Execute by click - Parameters: List of all device parameters: Edit by click - Change samplerate - Info: You can create main-menu-shortcuts for functions and parameters

Send event/signal

Create a new event with Telegram. You can send measurements, which your doing manually, too.

Automation

Editor for Event/Action system.

Settings

Set Event Notification

Telegram-Notifications can be received from the RTOC-server if events occur. The notification level can be set here. (Averages, Warnings, Errors)

General

  • Change recording length: Change the local recording length of the server.
  • Change global samplerate: Change the samplerate of all plugins using self.samplerate or self.setPerpetualTimer(func,samplerate).
  • TCP-Server: On/Off: En/disable TCP-server
  • Restart server: Restart host computer

TelegramBot

  • Telegram clients: List of connected clients. Admins can change user-permissions.

Backup-Settings

  • Configure all backup options.
  • Delete signals: Deletes all signals and events.
  • Resample database

Telegram Custom-menu

The file telegramActions.json contains dicts with actions, that will be shown in the main menu and can be executed by any user. If the action-name (key) starts with '_' only admins will be able to see this button.

Here is an example to send a screenshot

{
   "Screenshot": """

    import pyscreenshot as ImageGrab
    dir = self.config['global']['documentfolder']
    im = ImageGrab.grab()\nim.save(dir+'/telegram_overview.png')
    return 'picture', dir+'/telegram_overview.png'
    """

}

A telegram action must return either a text, a picture or any other file.

return 'text', 'My example text' to return a text message.

return 'picture', <dir/to/picture.jpg> to return a picture.

return 'document', <dir/to/file> to return any other file.