// MODEx: change the way the node behaves. 0: stay awake withtout executing each sensors' loop(), 1: go to sleep for the configured interval, 2: wait for the configured interval, 3: stay awake and execute each sensors' loop() (e.g. MODE1)
// MODEx: change the way the node behaves. 0: stay awake withtout executing each sensors' loop(), 1: go to sleep for the configured interval, 2: wait for the configured interval, 3: stay awake and execute each sensors' loop() (e.g. MODE1)
Node Manager comes with a reasonable default configuration. If you want/need to change its settings, this can be done in your sketch, inside the `before()` function and just before registering your sensors. The following methods are exposed for your convenience:
Node Manager comes with a reasonable default configuration. If you want/need to change its settings, this can be done in your sketch, inside the `before()` function and just before registering your sensors. The following methods are exposed for your convenience:
~~~c
~~~c
// the pin to connect to the RST pin to reboot the board (default: 4)
voidsetRebootPin(intvalue);
// send the same service message multiple times (default: 1)
// send the same service message multiple times (default: 1)
voidsetRetries(intvalue);
voidsetRetries(intvalue);
#if BATTERY_MANAGER == 1
#if BATTERY_MANAGER == 1
...
@@ -449,6 +447,8 @@ Each sensor class can expose additional methods.
...
@@ -449,6 +447,8 @@ Each sensor class can expose additional methods.
voidsetPulseWidth(intvalue);
voidsetPulseWidth(intvalue);
// define which value to set to the output when set to on (default: HIGH)
// define which value to set to the output when set to on (default: HIGH)
voidsetOnValue(intvalue);
voidsetOnValue(intvalue);
// when legacy mode is enabled expect a REQ message to trigger, otherwise the default SET (default: false)
voidsetLegacyMode(boolvalue);
~~~
~~~
#### SensorSwitch / SensorDoor / SensorMotion
#### SensorSwitch / SensorDoor / SensorMotion
...
@@ -587,7 +587,6 @@ If `PERSIST` is enabled, the settings provided with `INTVLnnnX` and `MODEx` are
...
@@ -587,7 +587,6 @@ If `PERSIST` is enabled, the settings provided with `INTVLnnnX` and `MODEx` are
A NodeManager object must be created and called from within your sketch during `before()`, `presentation()`, `loop()` and `receive()` to work properly. NodeManager will do the following during each phase:
A NodeManager object must be created and called from within your sketch during `before()`, `presentation()`, `loop()` and `receive()` to work properly. NodeManager will do the following during each phase:
## NodeManager::before()
## NodeManager::before()
* Configure the reboot pin so to allow rebooting the board
* Setup the interrupt pins to wake up the board based on the configured interrupts (e.g. stop sleeping when the pin is connected to ground or wake up and notify when a motion sensor has trigger)
* Setup the interrupt pins to wake up the board based on the configured interrupts (e.g. stop sleeping when the pin is connected to ground or wake up and notify when a motion sensor has trigger)
* If persistance is enabled, restore from the EEPROM the latest sleeping settings
* If persistance is enabled, restore from the EEPROM the latest sleeping settings
* Call `before()` of each registered sensor
* Call `before()` of each registered sensor
...
@@ -624,12 +623,6 @@ A NodeManager object must be created and called from within your sketch during `
...
@@ -624,12 +623,6 @@ A NodeManager object must be created and called from within your sketch during `
# Examples
# Examples
All the examples below takes place within the before() function in the main sketch, just below the "Register below your sensors" comment.
All the examples below takes place within the before() function in the main sketch, just below the "Register below your sensors" comment.
Enable reboot pin, connect pin 4 to RST to enable rebooting the board with the REBOOT message:
~~~c
nodeManager.setRebootPin(4);
~~~
Set battery minimum and maxium voltage. This will be used to calculate the level percentage:
Set battery minimum and maxium voltage. This will be used to calculate the level percentage:
~~~c
~~~c
...
@@ -1076,11 +1069,14 @@ v1.5:
...
@@ -1076,11 +1069,14 @@ v1.5:
* Added support for HC-SR04 distance sensor
* Added support for HC-SR04 distance sensor
* Added support for BMP085/BMP180 temperature and pressure sensor
* Added support for BMP085/BMP180 temperature and pressure sensor
* Added support for Sonoff smart switch
* Added support for Sonoff smart switch
* Added forecast output to BME280 sensor
* Added support for Rain Gauge sensor
* Added capability to retrieve the time from the controller
* Added support for MCP9808 temperature sensor
* Added forecast output to all Bosch sensors
* Added I2C address auto-discovery for all Bosch sensors
* Added support for running as a gateway
* Added support for running as a gateway
* A heartbeat is sent when waking up from a wait cycle
* A heartbeat is sent when waking up from a wait cycle
* Allowed combining sensors waking up from an interrupt and sensors reporting periodically
* Allowed combining sensors waking up from an interrupt and sensors reporting periodically
* Added capability to retrieve the time from the controller
* Optimized battery life for DS18B20 sensors
* Optimized battery life for DS18B20 sensors
* SLEEP_MANAGER has been deprecated and setMode() replaces setSleepMode()
* SLEEP_MANAGER has been deprecated and setMode() replaces setSleepMode()
* New mode ALWAYS_ON to let the node staying awake and executing each sensors' loop
* New mode ALWAYS_ON to let the node staying awake and executing each sensors' loop
// if enabled, persist the remote configuration settings on EEPROM
// if enabled, persist the remote configuration settings on EEPROM
#define PERSIST 0
#define PERSIST 0
// if enabled, send a SLEEPING and AWAKE service messages just before entering and just after leaving a sleep cycle and STARTED when starting/rebooting
#define SERVICE_MESSAGES 0
// if enabled, a battery sensor will be created at BATTERY_CHILD_ID and will report vcc voltage together with the battery level percentage
// if enabled, a battery sensor will be created at BATTERY_CHILD_ID and will report vcc voltage together with the battery level percentage
#define BATTERY_SENSOR 1
#define BATTERY_SENSOR 1
// if enabled, send a SLEEPING and AWAKE service messages just before entering and just after leaving a sleep cycle and STARTED when starting/rebooting
#define SERVICE_MESSAGES 0
// Enable this module to use one of the following sensors: SENSOR_ANALOG_INPUT, SENSOR_LDR, SENSOR_THERMISTOR, SENSOR_MQ, SENSOR_ML8511, SENSOR_ACS712, SENSOR_RAIN_GAUGE
// Enable this module to use one of the following sensors: SENSOR_ANALOG_INPUT, SENSOR_LDR, SENSOR_THERMISTOR, SENSOR_MQ, SENSOR_ML8511, SENSOR_ACS712, SENSOR_RAIN_GAUGE