Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Quick navigation

Child pages (Children Display)
alltrue
pageUtilities & Predifined Organs


Creating a new Spinal System
Panel
titleGoal of the tutorial
title

Anchor
1
1

Description du systeme

We will create a simple IoT system that will alert us through a nice web interface whenever the temperature at our wine cellar is not between 10°C and 16°C. We will call this system FineWine.

Image Removed

This system, based on our understanding of intelligent micro-system, is composed of the following organs:

  • Nerve center: where the hub and its data are located.

  • Admin dashboard: the administration interface of your hub.

  • VirtualTemperatureSensor organ: simulate the temperature sensor of the wine cellar continuously and synchronize the samples with the hub.

  • Analytics organ: analyzes the temperature and alerts if the temperature is ok or not.

  • Monitoring interface organ: a web interface, displaying the current status of our wine cellar.

Panel

The goal of this tutorial is to initiate you to the Spinalcom Drive.


fine-wine-system Folder organization

Image Removed

  • .browser_organs : This is your web browser folder

  • .config_env : Your env configuration

  • nerve-center : The Spinalcom nerve center

  • node_modules : npm (node package manager) & spinal-package

  • .apps.json : installed package of your spinal system

  • .config.json : spinalcom connection configuration file

  • launch.config.js : Start your hub using pm2

  • package.json : config of your package

Panel
titleInstallation

Anchor
2
2

Install spinal-system-basic

The first step is to create the directory where the project will be stored. We will call it fine-wine-system. Then, install inside the “spinal-system-basic” template. We suggest that before running the following command you initialize an npm project (with npm init):First create a new folder and initialize it using npm.

Code Block
languagebash
themeDJango
~/$ mkdir button-systemnewfolder
~/$ cd button-system

~/button-system$newfolder
$ npm init -y
~/button-system$ 


Once this is done there are 2 ways to install Spinalcom Drive.

A. Without editing package.json

Code Block
languagebash
themeDJango
npm i https://github.com/spinalcom/spinal-browser-admindrive.git
Launch spinal-system

B. By editing package.json

Add spinal-browser-drive to the dependencies in package.json.

package.json


Code Block
languagebashjs
themeDJango
~/button-system$ pm2 start launch.config.js

PM2 will automatically start the Spinal Hub and the organs. Take care, if you have another hub running on port 7777, your new hub will not be launched ! (here is a command to see what port are used on ubuntu: sudo netstat -lp --inet)

After this installation, only SpinalHub is running on port 7777. SpinalHub containes a web server that provide his own Admin interface. Here is the architecture of the system you have after this first install:

Connect to Admin UI

As we have done in the getting started, connect to the admin dashboard to see if you hub is running :

http://127.0.0.1:7777/html/admin

The default admin account is :

Username

client ID

Password
admin168JHGgcz45JKilmzknzelf65ddDadggftIO98P
Panel
titleCreate a data model
Anchor
33
Panel
titleCreate our new virtualButton organ
Anchor
44
Panel
titleLaunch the system
Anchor
55
Panel
titleCreate our second organ : virtualButtonMonitor
Anchor
66
Conclusion
linenumberstrue
{
  "name": "newfolder",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
// here
  "dependencies": {
    "spinal-browser-admin": "git+https://github.com/spinalcom/spinal-browser-drive"
  }
}

Then install it using npm.

Code Block
languagebash
themeDJango
$ npm install



Panel
titleConfiguration

Anchor
3
3

You can check the IP configuration (Port number, IP localhost) in .config.json.


Panel
titleLaunch the hub

Anchor
4
4

Launch the hub and local organs with:

Code Block
languagebash
themeDJango
$ pm2 start launch.config.js

You can see if the hub is running with:

Code Block
languagebash
themeDJango
$ pm2 list



Panel
titleBasic usage

Anchor
5
5

The Drive is a browser application, you need to access it via a browser (you may change the host/port corresponding to your .config.json file):

http://127.0.0.1:7777/html/drive

The basic account is:

UsernameClient IDPassword
admin168JHGgcz45JKilmzknzelf65ddDadggftIO98P