SkillAgentSearch skills...

NodeManager

Plugin for a rapid development of battery-powered sensors

Install / Use

/learn @mysensors/NodeManager
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

MySensors NodeManager Build Status

NodeManager is intended to take care on your behalf of all those common tasks that a MySensors node has to accomplish, speeding up the development cycle of your projects. Consider it as a sort of frontend for your MySensors projects. When you need to add a sensor (which requires just uncommeting a single line), NodeManager will take care of importing the required library, presenting the sensor to the gateway/controller, executing periodically the main function of the sensor (e.g. measure a temperature, detect a motion, etc.), allowing you to interact with the sensor and even configuring it remotely.

Features

  • Allows managing automatically the complexity behind battery-powered sensors spending most of their time sleeping
  • Provides common functionalities to read and report the battery level
  • For the most common sensors, provide embedded code so to allow their configuration with a single line
  • Manage all the aspects of a sleeping cycle by leveraging smart sleep
  • Allow configuring the node and any attached sensors remotely
  • Allow waking up a sleeping node remotely at the end of a sleeping cycle
  • Allow powering on each connected sensor only while the node is awake to save battery
  • Report battery level periodically and automatically or on demand
  • Calculate battery level without requiring an additional pin and the resistors
  • Report signal level periodically and automatically or on demand
  • Allow collecting and averaging multiple samples, tracking the last value and forcing periodic updates for any sensor
  • Provide built-in capabilities to handle interrupt-based sensors

Installation

  • Download the package or clone the git repository from https://github.com/mysensors/NodeManager
  • Install NodeManager as an Arduino library (https://www.arduino.cc/en/Guide/Libraries)

Upgrade

  • Make a backup copy of the library, remove it, download the latest version of NodeManager and install the new library
  • Review the release notes in case there is any manual change required to the main sketch

Please be aware when upgrading to v1.8 from an older version this procedure is not supported and the code should be migrated manually.

Configuration

  • Open the Template sketch from the Arduino IDE under File -> Examples -> MySensors Nodemanager -> Template
  • Alternatively, open one of the provided example
  • Customize NodeManager's and your sensors settings (see below)

MySensors configuration

Since NodeManager has to communicate with the MySensors network on your behalf, it has to know how to do it. On top of the template sketch you will find the typical MySensors directives you are used to which can be customized to configure the board to act as a MySensors node or a MySensors gateway.

NodeManager configuration

NodeManager built-in capabilities can be enabled/disabled also when you need to save some storage for your code. To enable/disable a built-in feature:

  • Install the required dependency if any
  • Enable the corresponding capability by setting it to ON in the main sketch. To disable it, set it to OFF
  • When a capability is enabled additional functions may be made available. Have a look at the API documentation for details

A list of the supported capabilities and the required dependencies is presented below:

Capability | Default | Description | Dependencies --------------------------------|---------|--------------------------------------------------------------------------------------------------|---------------------------------------------------------- NODEMANAGER_DEBUG | ON | NodeManager's debug output on serial console | - NODEMANAGER_DEBUG_VERBOSE | OFF | increase NodeManager's debug output on the serial console | - NODEMANAGER_POWER_MANAGER | OFF | allow powering on your sensors only while the node is awake | - NODEMANAGER_INTERRUPTS | ON | allow managing interrupt-based sensors like a PIR or a door sensor | - NODEMANAGER_CONDITIONAL_REPORT | OFF | allow reporting a measure only when different from the previous or above/below a given threshold | - NODEMANAGER_EEPROM | OFF | allow keeping track of some information in the EEPROM | - NODEMANAGER_SLEEP | ON | allow managing automatically the complexity behind battery-powered sleeping sensors | - NODEMANAGER_RECEIVE | ON | allow the node to receive messages; can be used by the remote API or for triggering the sensors | - NODEMANAGER_TIME | OFF | allow keeping the current system time in sync with the controller | https://github.com/PaulStoffregen/Time NODEMANAGER_RTC | OFF | allow keeping the current system time in sync with an attached RTC device | https://github.com/JChristensen/DS3232RTC NODEMANAGER_SD | OFF | allow reading from and writing to SD cards | - NODEMANAGER_HOOKING | OFF | allow custom code to be hooked in the out of the box sensors | - NODEMANAGER_OTA_CONFIGURATION | OFF | allow over-the-air configuration of the sensors | - NODEMANAGER_SERIAL_INPUT | OFF | read from the serial port at the end of each loop cycle expecting a serial protocol command | -

Once the NodeManager library header file is included, a global instance of the NodeManager class called nodeManager is made available and can be used all along the sketch.

Add your sensors

NodeManager provides built-in implementation of a number of sensors through ad-hoc classes located within the "sensors" directory of the library. To use a built-in sensor:

  • Install the required dependencies, if any manually or through the Arduino IDE Library Manager (see below)
  • Include the sensor header file (e.g. #include <sensors/SensorBattery.h>)
  • Create an instance of the sensor's class (e.g. SensorBattery battery(node))

Once created, the sensor will automatically present one or more child to the gateway and controller. A list of built-in sensors, required dependencies and the number of child automatically created is presented below:

Sensor/Class Name |#Child | Description | Dependencies -------------------------|-------|---------------------------------------------------------------------------------------------------|---------------------------------------------------------- SensorBattery | 1 | Built-in sensor for automatic battery reporting | - SensorSignal | 1 | Built-in sensor for automatic signal level reporting | - SensorAnalogInput | 1 | Generic analog sensor, return a pin's analog value or its percentage | - SensorLDR | 1 | LDR sensor, return the light level of an attached light resistor in percentage | - SensorRain | 1 | Rain sensor, return the percentage of rain from an attached analog sensor | - SensorSoilMoisture | 1 | Soil moisture sensor, return the percentage of moisture from an attached analog sensor | - SensorThermistor | 1 | Thermistor sensor, return the temperature based on the attached thermistor | - SensorML8511 | 1 | ML8511 sensor, return UV intensity | - SensorACS712 | 1 | ACS712 sensor, measure the current going through the attached module | - SensorDigitalInput | 1 | Generic digital sensor, return a pin's digital value | - SensorDigitalOutput | 1 | Generic digital output sensor, allows setting the digital output of a pin to the requested value | - SensorRelay | 1 | Relay sensor, allows activating the relay | - SensorLatchingRelay1Pin | 1 | Latching Relay sensor, allows toggling the relay with a pulse on the configured pin | - SensorLatchingRelay2Pins | 1 | Latching Relay sensor, allows turing the relay on and off with a pulse on the configured pins | - SensorDHT11 | 2 | DHT11 sensor, return temperature/humidity based on the attached DHT sensor | https://github.com/mysensors/MySensorsArduinoExamples/tree/master/libraries/DHT SensorDHT22 | 2 | DHT22 sensor, return temperature/humidity based on the attached DHT sensor | https://github.com/mysensors/MySensorsArduinoExamples/tree/master/libraries/DHT SensorSHT21 | 2 | SHT21 sensor, return temperature/humidity based on the attached SHT21 sensor | https://github.com/SodaqMoja/Sodaq_SHT2x SensorHTU21D | 2 | HTU21D sensor, return temperature/humidity based on the attached HTU21D sensor | https://github.com/SodaqMoja/Sodaq_SHT2x SensorInterrupt | 1 | Generic interrupt-based sensor, wake up the board when a pin changes status | - SensorDoor | 1 | Door sensor, wake up th

View on GitHub
GitHub Stars135
CategoryDevelopment
Updated3mo ago
Forks79

Languages

C++

Security Score

82/100

Audited on Dec 23, 2025

No findings