An osiota instance is configured by a config file in JSON format. The default name for this file is osiota.json
(can be set to other names as well, see installation)
A good solution is to commit the configuration file in a git repositoy like in the system-example repository.
The following sample configuration file starts two applications. One exposes a server port and the other outputs a string:
{
"hostname": "Raum 112",
"app": [
{
"name": "ws-server",
"config": {
"server": 8080
}
},
{
"name": "debug-echo",
"config": {
"text": "Hello World!"
}
}
]
}
Configuration files consist of global settings and settings that define which applications to load.
Official global settings are:
Set a hostname. Forwarded to remote hosts as name. Upstream instances use this name as prefix for forwarded data resources.
The config property app
constists of array items that define which application to load (APP_NAME
). Addional settings for the application can be defined as well (APP_SETTINGS
).
{
"name": APP_NAME,
"config": {
APP_SETTINGS
}
}
See on NPM with search term osiota. Official osiota apps are situated in the GitHub group osiota.
Some sample apps:
Below some configuration samples:
Connect to a remote osiota instance (via WebSockets). To get or forward data from or to another osiota instance, you can add remotes:
config.app[] =
{
"name": "ws-server",
"config": {
"server": 8080
}
}
Connect to a remote osiota instance (via WebSockets). To get or forward data from or to another osiota instance, you can add remotes:
config.app[] =
{
"name": "ws",
"config": {
"name": "upstream",
"url": "ws://osiota.local:8080/"
}
}
See app: modbus
config.app[] =
{
"name": "modbus",
"config":{
"connect_type": "RTUBuffered",
"connect_path": "/dev/ttyUSB0",
"connect_options": {
"baudRate": 9600
},
"map": [
{
"node": "/Lamp Switch",
"id": 0,
"address": 10,
"type": "output boolean",
"datatype": "boolean",
"metadata": {
"power": 60
}
}
]
}
}