Skip to content

boly38/lo-mqtt-nodejs

Repository files navigation

lo-mqtt-nodejs - Live Objects MQTT Client

scheduled npm audit

This project includes Live Objects Client code samples for the MQTT protocol.

Quick start

Download

Clone this repository from GitHub:

$ git clone https://github.com/boly38/lo-mqtt-nodejs.git

Prerequisites

  1. Install NodeJs (https://nodejs.org/en/download/)
  2. Install samples dependencies (from package.json, example, https://github.com/mqttjs/MQTT.js)
npm install

Setup your own private environment

  • copy the template in a private file
cp .env.template .env.dontpush.myEnv1
cp .env.template .env.dontpush.myEnv2
  • edit .env.dontpush.myEnv1
  • application rely on .env file
cp .env.dontpush.myEnv1 .env

Start lo-device

lo-device - a mqtt client using device mode. This client is able to :

  • connect, disconnect, forceReconnect. and via features:
  • receive and handle command, process firmware updates, process config update.
  • publish current config/resource, send data messages.

The client "controller" asks to the user the order via terminal and input.

Controller features:

  • geolocation: generates X devices from given square : ex. europe, france, lyon.

To start the client:

 node ./src/device-mode/lo-device.js

Then use h to display help.