Fleet Manager is a standalone software service for controlling and monitoring a fleet of second generation Shelly devices. Fleet Manager exposes a websocket server endpoint on which Shelly Plus and Pro series devices can connect to using their outbound websockets. Once connected they can be fully managed by Fleet Manager. Fleet Manager also exposes a websocket endpoint for clients to connect to. Messages send to Fleet Manager must follow the JSON-RPC 2.0 protocol. Communication protocols for Fleet Management are described in RPC and Components
To connect a second generation Shelly device do the following:
/shelly
(hint: ws://<your ip>:7011/shelly
). After that the device should show up in the home page of the application.
The codebase is split into modules - backend and frontend. They are described in the Codebase section.
Keep in mind that there is a difference between codebase and docker image. In docker image lives node red plugin which provides fleet manager nodes, they can be used for extended control of shelly devices you can pull docker image from here
npm i && npx tsc -p ./tsconfig.json --watch
npm i && npm run dev
npm i && npx tsc --pretty --listEmittedFiles true --module commonjs --moduleResolution node --esModuleInterop true --target es2021 --lib es2021 --watch
uname -a
)docker -v
)docker-compose version
OR docker compose version
)docker compose up -d
this will create 3 containers (as listed below)
Other ways of starting the program are described in Developing.
migration-collection
- makes migration, accepts db config and path where migration files are locatedexample config
{
"connection": { // db connection config
"host": "localhost",
"user": "postgres",
"max": 40,
"password": "**********",
"database": "em"
},
"schema": "migration", // namespace name, where migration tables will be created
"cwd": [ // migration files paths
"./db/migration/postgresql"
]
}
expose-sql-methods
- exposes all sql functions for given database.schema.accepts database connection info + where are functions that we need (where = namespace) returns object with the following fingerprint:
{
"methods": {fn1, fn2 .....} // all functions found in configured namespace/s,
"stop": fn(){} // of called, db connection will be closed
"txBegin", "txEnd" // both are functions, it is usable if dev wants to use build in pg driver transaction helper, txBegin - starts
// tx and returns tx id, txEnd accepts tx id and closes the transaction
}
example config
{
"connection": { // db connection config
"host": "localhost",
"user": "postgres",
"max": 40,
"password": "mysecretpassword",
"database": "em"
},
"link": {"schemas": ["devices", "core"]} // namespaces that will be inspected for functions, all of those functions will be exposed
}
Contributing can be done with pull requests in Github.