# How to set up remote access

- Link: https://www.samovar-tool.ru/en/2021/03/26/how-to-set-up-remote-access/
- Published: 2021-03-26T15:48:28+03:00
- Author: kosoj.diy

You can control Samovar from another network in two ways: connect to your home network
through a VPN, or work through the samovar-tool.ru server — the mobile apps for 
Android and iOS and the control page on the website. The first way gives full access
to the controller’s web interface; the second gives monitoring, notifications, commands
and cloud charts without exposing the device to the internet. This page describes
how to set up both ways.

## Why the web interface must not be published on the internet

The Samovar web interface is designed to work in a trusted local network. The firmware
has no built-in username and password check for the control pages. Anyone who gets
the controller’s address can open the interface and send commands to the device:
turn on heating, start take-off, change the program.

You must not open access to the web interface from outside by forwarding ports on
your router. For full access from another network, use a secure connection to your
home network.

## Way 1: VPN to your home network

A VPN is an encrypted connection after which a phone or computer works as if it 
were in the home network. Setting up a VPN depends on the router model and is not
a function of the Samovar firmware. The general order is:

 1. Set up a VPN server on the router or on a separate server with a public IP address(
    see the router documentation: WireGuard, OpenVPN, L2TP/IPsec).
 2. Install a VPN client on your phone or laptop and connect to the home network.
 3. Open the local address of Samovar in a browser — `http://samovar.local` or the 
    controller’s IP address in the home network. The web interface works as it does
    at home, with all pages: settings, program, logs, Lua.

A VPN gives the full functionality of the web interface, but requires router setup
and constant access to it from the internet. If that is not acceptable, use the 
samovar-tool.ru server — the controller makes the outgoing connection itself, and
no ports need to be opened.

## Way 2: mobile apps and the samovar-tool.ru website

Samovar sends readings, program state, the process log and messages to the samovar-
tool.ru server. You can monitor and control the process over the internet:

 * in the mobile app for Android;
 * in the same app for iOS;
 * on the “Samovar control” page of the samovar-tool.ru website.

The connection to the server is established by Samovar itself — an outgoing connection
needs no port forwarding and no public IP. The app screens and the website pages
are the same. Push notifications arrive in the mobile app; the process log and the
start of a session are sent through the same server — they are saved on the server
and are available on the website.

## Device token

A token is a key of 32 Latin letters, digits and the characters “-” or “_”, by which
the server tells your Samovar apart. Each device has its own token. It is used by
the firmware, the apps, the control page and the cloud logs.

### Where to get a token

 * **First device.** In the mobile app, on first launch choose “Create account” 
   and enter an email and password. A Blynk account will be created, the “Samovar”
   project will be copied into it, and the token will appear on the “Settings” screen.
   If you already have a Blynk account, tap “Sign in and get token” or enter a known
   token by hand. For a single device, registering on the website is not required—
   the app can work with just the token.
 * **Through the website.** Register on samovar-tool.ru and log in. Open the menu“
   User → Devices”, click “Import device” and enter a name, the token and your current
   website password. After the first import the “Create device” button becomes available:
   the website will create one more “Samovar” project and show the new token once—
   write it down right away.

### Where to enter the token

In the Samovar web interface open “Settings”, the “Other” tab, paste the token into
the “Blynk token” field and click “Save”. Then reboot Samovar by cutting the power:
the connection to the server is established when the controller starts. You can 
also enter the token during the first Wi-Fi connection — in the “blynk token” field
on the Samovar access point page.

**Do not give the token to anyone.** Anyone who knows it will be able to see the
readings and control your Samovar.

## Several devices

For several Samovars, the shared list and the names are set in the website menu “
User → Devices”. In the app settings enter the website email and password and tap“
Connect devices from website” — the app will load the list of devices. If there 
is one device, it is selected automatically; if there are several, a list of names
appears in the settings.

 * Android, iOS and the website store the device choice independently: for example,
   Android can control the Samovar at home, iOS the device in the garage, and the
   website a third controller. Changing the choice in one place does not switch 
   the others.
 * After changes on the website, tap “Refresh list” in the app.
 * Push notifications arrive from all devices in the shared list. When you tap a
   notification, the app switches to the Samovar that sent it. Merely receiving 
   a notification does not change the current choice.
 * In single-device mode, push works after sign-in or registration; a token alone,
   without an email and password, is not enough to register a phone for notifications.

## If the Blynk email differs from the website email

The website and Blynk email and password must match. If they differ, perform an 
account transfer: on the “User → Devices” page click “Transfer Blynk account”, enter
the old Blynk email, the old Blynk password and your current website password. The
website will check the data and move the suitable projects into the account with
the website’s email and password.

Features of the transfer:

 * Only projects named Samovar (case-insensitive), with one device and the tabs “
   Main”, “Control” and “Charts” are transferred. A project with a different name,
   a different set of tabs or several devices is not transferred.
 * After a successful transfer the old Blynk account is deleted together with its
   other projects. If no “Samovar” project is found, the old account is deleted 
   anyway. There is no preliminary list and no undo after a successful transfer.
 * The tokens of the transferred Samovars are kept — there is no need to change 
   the controller settings.
 * If the website reports an error during the transfer, do not immediately run it
   again. First log in to Blynk with the website email and password and open the“
   Devices” page again: the transfer may already have finished while the list on
   the website has not yet updated.

After the transfer, use the shared website and Blynk email and password. To change
the password in both places at once, click “Change shared password” on the devices
page. After changing the password, log in to the website and the apps again.

## App and website screens

 * **“Main”.** Connection state, mode and status line, a process diagram with the
   current temperatures, sensor cards with mini-charts, the buttons “Heating on/
   off”, “Next”, “Pause”, “Lock hearts temperature”, “Reset process”, the current
   program line, parameters and mode.
 * **“Program”.** The program lines of the current mode with a decoding of the fields;
   the line being executed is highlighted. The program is view-only — it can be 
   changed in the Samovar web interface.
 * **“Control”.** Regulator voltage, take-off rate, locking the hearts temperature,
   the stirrer and the I2C pump (parameters, start and stop, relays R1–R4, pump 
   calibration), executing a Lua line, system information: Samovar IP, firmware 
   version, mode, time.
 * **“Charts”.** The history of the current session from the server: the groups “
   Temperatures”, “Pressure”, “Take-off and water”, “Alcohol”, “Power”; an interval
   from 1 minute to the whole session; individual lines are switched on and off 
   with the buttons under the chart.
 * **“Messages” on the website / “Settings” in the app.** On the website the fifth
   tab shows the latest message from the selected device and the messages of the
   current session. In the app, instead, there is the “Settings” screen: the account,
   a single token or device choice, notifications; the app shows messages as push
   notifications.

## How it works

 * Samovar sends readings to the server by itself: temperatures, pressure, voltage
   and take-off rate every 5 seconds; everything else (status, program line number,
   the program, the state of heating and pause) when it changes.
 * Commands from the app and from the website are applied immediately, without a
   confirmation request. Leave a pause of 1–2 seconds between commands.
 * The control page refreshes data every 3 seconds while the browser tab is open.
   Alarms are shown in a pop-up window until it is closed.
 * Push notifications to the phone arrive only through the mobile app.
 * Samovar messages are shown on the “Messages” tab and arrive as push notifications:
   alarms with the prefix “Alarm!”, warnings with “Warning!”.

## Safety of remote starts

Before a remote start, make sure the equipment is assembled safely and that someone
is nearby who can immediately cut the power and the product feed. The remote interface
does not replace hardware protections and supervision of the installation.

### Like this:

Like Loading…

### _Related_
