This is the multi-page printable view of this section.
Click here to print.
Return to the regular view of this page.
Getting Started
Prerequisites
Installation can be done in two different methods,
- Run from the executable binary bundles
- Run it as a container
Hardware Requirements
- Disk Space: ~100 MiB
- Memory(RAM): ~50 MiB
Software Requirements
- InfluxDB - used as a metric store
- Optional
- Docker or any container orchestration (if you plan to run MyController container image)
- MongoDB - can be used as a configuration store
Dependencies Installation
Migrating MyController from 1.x to MyController 2.0
- MyController 2.0 is completely redesigned.
- You can not migrate from 1.x to 2.0
- However for sometime you can run 1.x and 2.0 simultaneously and migrate your configurations manually
- If you are using MySensors serial port to connect your sensors, use 2mqtt to share your sensors network to both 1.x and 2.0
Install MyController Server
What Next?
1 - Hints
- if a boolean value is left blank. It is considered as
false
- if a numerical value is left blank, It is considered as
0
Values on payloads
Payloads sent to a resource will be considered as follows
- case in-sensitive
on
, true
, 1
, enable
== true
off
, false
, 0
, disable
== false
Duration of the time
System time durations follow the GoLand standards as follows…
ns
- nanoseconds
us
- microseconds
ms
- milliseconds
s
- seconds
m
- minutes
h
- hours
Examples:
Input |
Description |
0 |
0 seconds |
0s |
0 seconds |
10s |
10 seconds |
1m20s |
1 minute and 20 seconds |
1h20m5s |
1 hour 20 minutes and 5 seconds |
-42s |
-42 seconds |
Note
Negative numbers are supported.
Labels
TBD
Quick ID
TBD
2 - Install Docker
Docker can be installed in different way.
Here it is explained to install it on Raspberry PI with Raspbian OS
Follow the steps below to install docker on your Raspberry PI
Note
Assuming that you are running all the commands as a root
user.
If you are running from non-root user, you should include sudo
in the beginning of the commands.
# copy the installation script
curl -fsSL https://get.docker.com -o get-docker.sh
# execute the script
sh get-docker.sh
# enable the docker daemon
systemctl enable docker.service
# start the docker daemon
systemctl start docker.service
# check the docker daemon is active
systemctl is-active docker.service
- Optional steps - If you plan to play docker command on user
# add a non-root user to the docker group
# here the "pi" is a user
usermod -aG docker pi
3 - Install InfluxDB
Supported Versions
MyController supports InfluxDB 1.8.x or above
In this guide installation shown on Raspberry Pi with Raspbian Linux OS
If you have different OS, refer the influxdb installation guide
Influxdb can be installed in two different ways
Install InfluxDB on the host system
Follow this guide to install InfluxDB directly on your host system
Run the following commands as a root
user
Operating System: Raspbian Linux 10 (buster)
# configure influxdb repository
wget -qO- https://repos.influxdata.com/influxdb.key | apt-key add -
echo "deb https://repos.influxdata.com/debian buster stable" | tee /etc/apt/sources.list.d/influxdb.list
# update package details to the local system
apt update
# install influxdb and enable to run at startup
apt install influxdb
systemctl enable influxdb.service
# start influxdb
systemctl start influxdb.service
Optionally you can disable self monitoring metrics to avoid unnecessary CPU and Disk usage.
- update the following line on
/etc/influxdb/influxdb.conf
[monitor]
store-enabled = false
- restart the influxdb service
systemctl restart influxdb.service
(Optional) Create a database for MyController usage in influxDB
If the database user has admin privilege, database will be created automatically by MyController server.
root@rpi-171:~# influx
Connected to http://localhost:8086 version 1.8.5
InfluxDB shell version: 1.8.5
> create database mycontroller
> show databases
name: databases
name
----
mycontroller
> exit
Install InfluxDB on the Docker
Most of the places docker installation of influxdb works well
Warning
In ARM v6, docker version of InfluxDB not started and no issues reported. Tested it on 1.8.4
We can directly install it on the host system by following this guide
To know your machine architecture execute uname -m
on the command line
Note
Assuming that you are running all the commands as a root
user.
If you are running from non-root user, you should include sudo
in the beginning of the commands.
Generate influxdb.conf
Detailed information is on InfluxDB Website
Install
Variable $PWD
$PWD
is a Print Working Directory
.
mkdir -p /opt/apps/influxdb/influxdb_data
cd /opt/apps/influxdb
docker run --detach --name mc_influxdb \
--publish 8086:8086 \
--volume $PWD/influxdb_data:/var/lib/influxdb \
--volume $PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro \
--env TZ="Asia/Kolkata" \
--restart unless-stopped \
influxdb:1.8.4
(Optional) Create a database for MyController usage in influxDB
If the database user has admin privilege, database will be created automatically by MyController server.
- enter inside running docker container
- execute
influx
command inside the influx container as follows
- create a database by running
create database mycontroller
- show available databases by running
show databases
- type
exit
two time, one exits from influx client shell, second exits from the docker container
$ docker exec -it mc_influxdb /bin/sh
# influx
Connected to http://localhost:8086 version 1.8.4
InfluxDB shell version: 1.8.4
> create database mycontroller
> show databases
name: databases
name
----
mycontroller
> exit
# exit
To see the logs
- Prints all available logs
- Prints and tails the logs, to get exit do
Ctrl+C
docker logs --follow mc_influxdb
Stop
Restart
docker restart mc_influxdb
Uninstall
docker stop mc_influxdb
docker rm mc_influxdb
4 - Install natsio
Supported Versions
MyController server tested on nats.io 2.2.2
nats.io server can be installed in different way. Here we are focusing to setup it on docker and nats.io 2.2.2 version.
To install natsio on your host system follow this guide
Note
Assuming that you are running all the commands as a root
user.
If you are running from non-root user, you should include sudo
in the beginning of the commands.
Install
docker run --detach --name mc_natsio \
--publish 4222:4222 \
--env TZ="Asia/Kolkata" \
--restart unless-stopped \
nats:2.2.2-alpine
To see the logs
- Prints all available logs
- Prints and tails the logs, to get exit do
Ctrl+C
docker logs --follow mc_natsio
Stop
Restart
Uninstall
docker stop mc_natsio
docker rm mc_natsio
5 - Install Mosquitto MQTT Broker
Tested Versions
MyController tested on Mosquitto 1.6.9
Mosquitto broker can be installed in different way. Here we are focusing to setup it on docker and Mosquitto 1.6.9 version.
To install Mosquitto broker on your host system follow this guide
Note
Assuming that you are running all the commands as a root
user.
If you are running from non-root user, you should include sudo
in the beginning of the commands.
mosquitto.conf
Detailed information is on Mosquitto Website
# create mosquitto.conf
mkdir -p /opt/apps/mosquitto
cd /opt/apps/mosquitto
cat << EOF > mosquitto.conf
allow_anonymous true
persistence false
persistence_location /mosquitto/data/
EOF
Install
Variable $PWD
$PWD
is a Print Working Directory
.
mkdir -p /opt/apps/mosquitto
cd /opt/apps/mosquitto
docker run -d --name mc_mosquitto \
--publish 1883:1883 \
--publish 9001:9001 \
--volume $PWD/mosquitto.conf:/mosquitto/config/mosquitto.conf \
--restart unless-stopped \
eclipse-mosquitto:1.6.9
To see the logs
- Prints all available logs
- Prints and tails the logs, to get exit do
Ctrl+C
docker logs --follow mc_mosquitto
Restart
docker restart mc_mosquitto
Uninstall
docker stop mc_mosquitto
docker rm mc_mosquitto