Network Devices

Before start read general assumptions first

Network devices are hardware devices as ESP8266, ESP32 and similar. There are libraries for arduino IDE which helps communicate with RemoteMe.

Arduino

Before you start working with Arduino IDE these libraries have to be imported (Sketch -> Include Libraries -> manage libraries and add):

To add Network device choose New device at device tab then new network device fill form and submit

New arduino device appears at devices list. Its not required to add device before upload the sketch if you have already sketch for your device its enough to turn device on. It will automatically generate network device for you.

Code Wizard

Easiest way to start with is to generate sketch using wizard – wizard will generate  initial sketch your arduino – then ofcourse you can modify it before upload to ESP using arduino IDE:

Wizard only returns sketch which should be uploaded to arduino. It does not change anything at the system itself, and do not upload sketch to arduino automatically

Step 1:

  1. Variables – choose variables for which functions should be generated  to set valus and read values. More about variables here
    • If you don’t need to read values and only write, then after generating sketch remove lines :  remoteMe.getVariables()->observeBoolean(... and function from second argument. Then you will not get notifications about variables change. It will eliminate unnecessary network communication
    • If you are not planning to set variables from ESP you don’t have to do functions like inline void setLed(boolean b) does not generate any network communication until they are called
  2. Generates function which will be called after direct User message will be sent to your devices. More about messaging here
  3. Generates function which will be called after direct sync User message is sent to devices. More about messaging here

Step 2:

  1. WiFi name and password. Your WiFi credentials where ESP should connect. This credentials are not saved in the system anywhere. You don’t have to provide this information but alter remember to add proper values into : #define WIFI_NAME ""
    #define WIFI_PASSWORD ""
  2. Token which will be used to authenticate device into your account. After token is removed, device will not be able to connect your account

Step 3:

  1. Communicate method.
    1. Socket connections are preferable. Its requires less resources, and Doesn’t required remoteMeUtils library – it used port 18
    2. WebSocket if socket connection doesn’t work for you. it uses port 80
  2. Direct connections are used for both webPage and Device that run at the same local network. Its preferred if you need blazing fast communication – for example remoteControl toys
  3. based on options you choose in 1,2 it shows you what libraries has to be included in your arduino sketch

Step 4:

Its generating Serial printings, when some events happened

Step 5:

You can download or display arduino sketch for your device.

Final:

After downloaded your arduino sketch, upload it into your arduino. After few seconds (1-3s) after uploaded device at device tab should change connection from  into .

Other

After disconnecting devices, the device state will not change imminently to disconnected, its because socket/websocket connection was broke unexpectedly and didn’t inform RemoteMe.org. State of your device will be update after ~2min.

Network device will reconnect after internet connection is established.