Hi, being a newbie in this wonderful MySensors world, I found myself excited about the flexibility of the overall platform but also somehow implementing the same common functionalities across my sensors over and over again. I decided then to spend some reasonable amount of time to expand the idea behind MyExtention (https://forum.mysensors.org/topic/6062/myextension) into something I have called NodeManager (I know, I'm bad with names!).
NodeManager is intended to take care on your behalf of all those common tasks a MySensors node has to accomplish, speeding up the development cycle of your projects. It should help who is new to MySensors to get up to speed quicker and for those already into the matter to delegate to NodeManager common and boring tasks so to focus on more interesting scenarios.
NodeManager main features are:
- Manage all the aspects of a sleeping cycle by leveraging smart sleep
- Allow configuring the sleep mode and the sleep duration 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
- Calculate battery level without requiring an additional pin and the resistors
- Report battery voltage through a built-in sensor
- Can report battery level on demand
- Allow rebooting the board remotely
- Provide out-of-the-box sensors personalities and automatically execute their main task at each cycle
Specifically on this last point, the idea behind providing built-in the functionalities of most common sensors is to simplify the development especially for somebody new to it.
E.g. if I connect a thermistor to one of the pin, I just need a single line to have it working, as it was leveraging some sort of embedded firmware:
nodeManager.registerSensor(SENSOR_THERMISTOR,A2);
The following built-in sensors are available:
- SENSOR_ANALOG_INPUT Generic analog sensor, return a pin's analog value or its percentage
- SENSOR_LDR LDR sensor, return the light level of an attached light resistor in percentage
- SENSOR_THERMISTOR Thermistor sensor, return the temperature based on the attached thermistor
- SENSOR_DIGITAL_INPUT Generic digital sensor, return a pin's digital value
- SENSOR_DIGITAL_OUTPUT Generic digital output sensor, allows setting the digital output of a pin to the requested value
- SENSOR_RELAY Relay sensor, allows activating the relay
- SENSOR_LATCHING_RELAY Latching Relay sensor, allows activating the relay with a pulse
- SENSOR_DHT11 DHT11 sensor, return temperature/humidity based on the attached DHT sensor
- SENSOR_DHT22 DHT22 sensor, return temperature/humidity based on the attached DHT sensor
- SENSOR_SHT21 SHT21 sensor, return temperature/humidity based on the attached SHT21 sensor
- SENSOR_SWITCH Generic switch, wake up the board when a pin changes status
- SENSOR_DOOR Door sensor, wake up the board and report when an attached magnetic sensor has been opened/closed
- SENSOR_MOTION Motion sensor, wake up the board and report when an attached PIR has triggered
- SENSOR_DS18B20 DS18B20 sensor, return the temperature based on the attached sensor
I put the package on Sourceforce so to avoid leaving here piece of code which may become obsolete in a short time.
The project is here: https://sourceforge.net/projects/mynodemanager
I've also tried to document everything the best as I could on https://sourceforge.net/p/mynodemanager/wiki
Thanks