NodeManager: plugin for a rapid development of battery-powered sensors



  • @gohan
    User2694 say:"Setup MySensors

    Since NodeManager has to communicate with the MySensors gateway on your behalf, it has to know how to do it. Place on top of the config.h file all the MySensors typical directives you are used to set on top of your sketch so both your sketch AND NodeManager will be able to share the same configuration. For example:"
    link text


  • Mod

    He is referring on the node side, on the gateway you can just run the default sketch



  • @gohan
    Ok Tanks 😉


  • Contest Winner

    @mar.conte said in NodeManager: plugin for a rapid development of battery-powered sensors:

    Should the gateway have the right nodemamager sketch?

    Just to confirm what already discussed: a node/sensor with NodeManager running does not require a gateway with NodeManager on it. Generally speaking, there are two situations in which you may want use NodeManager on a gateway as well (available starting from v1.5):

    • It as to run on a Sonoff device which requires to be configured as a gateway
    • The gateway has sensors attached to it so you may want to use NodeManager's capabilities to configure your sensors in an easy way

    There is also a third situation: you are just lazy and have NodeManager already open in the arduino IDE so you just configure the gateway's settings in config.h and upload the sketch 😛




  • Contest Winner

    Last chance guys to report any issue for those who had tested the dev version of v1.5 🙂
    The final version will be out in a day or two otherwise.

    Thanks!


  • Mod

    I am waiting for the LCD mod 😄


  • Contest Winner

    @gohan LCD unfortunately has to wait for the another release (https://github.com/mysensors/NodeManager/issues/95), I would like to find a way to provide the info on the LCD without the need for the user to configure it for every sensor but this would require investigating on the best generic approach and will take some time 🙂


  • Mod

    If you could provide a method to retrieve sensor data from main loop(), it is quite easy for everyone to print it to LCD


  • Contest Winner

    @gohan I wonder if something can be done even right now based on what you're saying. In the main sketch, after invoking nodeManager.loop(), you can actually retrieve the instance of each sensor and do something. The last "value", depending on the type of the sensor, is stored in a variable (e.g. _value_int) BUT it is private. I'll add a getValue() function so you can get out this value. Not ideal but I think it can be a workaround I can easily add before releasing 1.5 (https://github.com/mysensors/NodeManager/issues/104)


  • Mod

    The problem is how do I know the name of the instance of the sensors


  • Contest Winner

    @gohan I mean if you declare a global int to store the child id, then you can save it when calling registersensor() (which returns the id of the sensor) in before() so eventually in loop() you can call getSensor() and then retrieve the value or do whatever else. Something like:

    NodeManager nodeManager;
    int sensor_id;
    
    void before() {
      Serial.begin(MY_BAUD_RATE);  
      sensor_id = nodeManager.registerSensor(SENSOR_THERMISTOR,A1);
      nodeManager.before();
    }
    
    void loop() {
      nodeManager.loop();
      float value = ((SensorThermistor*)nodeManager.getSensor(sensor_id))->getValueFloat();
    
    }
    

    Just the getValueFloat() is missing. Not ideal but a starting point. Don't you think? Thanks!


  • Mod

    That would work, at least for me 🙂


  • Contest Winner

    @gohan cool, just added it to the dev code. I'm packing now the final v1.5 and about to post it here in a few minutes. Thanks!


  • Mod

    At least now we can add some more code besides the default created by nodemanager 😉


  • Contest Winner

    Very true also because I'd avoid having the users customizing their NodeManager.cpp (even if it is always possible) to prevent issues during the upgrade. For your information the alternative to create an inline class inheriting from Sensor and then invoking registerSensor() with an instance of this class is always valid even if clearly much more complex.


  • Contest Winner

    Version 1.5 of NodeManager is finally available here!
    https://github.com/mysensors/NodeManager

    I've done my best to implement most of the requests received so far since unfortunately I'm expecting starting from June very little spare time to spend here so I tried to hurry up a bit 🙂 The result is a pretty long change log and a total of 26 between ad-hoc and generic out-of-the-box sensors supported up to this release:

    • Added support for ACS712 current sensor
    • Added support for HC-SR04 distance sensor
    • Added support for BMP085/BMP180 temperature and pressure sensor
    • Added support for Sonoff smart switch
    • Added support for Rain Gauge sensor
    • 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 option to retrieve the latest value of a sensor from outside NodeManager
    • Remote reboot now does not need a reboot pin configured
    • A heartbeat is now sent also when waking up from a wait cycle
    • When waking up for an interrupt, only the code of the sensor expecting that interrupt is executed
    • Added capability to retrieve the time from the controller
    • Optimized battery life for DS18B20 sensors
    • SLEEP_MANAGER has been deprecated (now always enabled) and setMode() replaces setSleepMode()
    • New mode ALWAYS_ON to let the node staying awake and executing each sensors' loop
    • ESP8266WiFi.h has to be included in the main sketch if MY_GATEWAY_ESP8266 is defined
    • Added receiveTime() wrapper in the main sketch
    • Fixed the logic for output sensors
    • Added common gateway settings in config.h

    I've added upgrade instructions as well in the documentation. Generally speaking to upgrade it is safe to just replace the existing NodeManager.h and NodeManager.cpp files but with this release I had to do some minor changes to the main sketch as well, as documented in the release notes.

    Thanks everybody for all the advice and for reporting any issue always in a constructive way 🙂


  • Contest Winner

    Hi, only for those having problems with a too high utilization of the dynamic memory preventing NodeManager to run smoothly (e.g. generating random data / outputting garbage characters / rebooting, etc), a quick fix is to decrease from 255 to a small number like 5 or 10 the size of the Sensor* _sensors array. This saves more than 20% on a pro mini which is huge. Of course you also need to change every cycle in NodeManager.cpp which is using that 255.

    This of course will be also fixed in the next release. Very silly mistake I know to initialize such a big array but I couldn't image 255 pointers were consuming so much 🙂



  • Hi, i wanted to know in which section of the sketch I turn on and turn off a led when the node controls the battery because at night the led me starts the pir; Now I've put the digitalwrite after nodemanger.loop


  • Contest Winner

    @mar.conte NodeManager does not control any led so I think you are free to place your code where you think is most appropriate for your needs. Thanks


  • Mod

    @mar.conte put a capacitor on the PIR vcc/gnd and increase the size until it is stable.



  • @gohan
    Good idea Tanks


  • Contest Winner

    Hi, I've added a "How to contribute" section in the documentation of the dev release in case anybody is interested to contribute to this project: https://github.com/mysensors/NodeManager/tree/development#contributing.

    I'm not a git expert so I hope those instructions to have some sense 🙂


  • Contest Winner

    Pretty big enhancement in the development branch of NodeManager if anybody is interested. I spent quite a good amount of time working on the core code to introduce mainly two features opening up the door to a good list of enhancements.

    The first one is a sort of countdown utility. Can be based on the number of sleeping cycles or minutes. It detects automatically a sleeping node and instead of using millis sum up the sleep interval and reports when the time is over. This approach has been used to:

    • Allow different sensors reporting at different timeframes (e.g. by configuring a specific sensor to report every e.g. 5 minutes or 10 sleeping cycles instead of at the end of each cycle)
    • For output sensors optionally use the input value as an elapsed time (e.g. the output will be turned on and the input value will be used as a timer to turn it off automatically). For example by sending 3 to a relay, it will be turned on and after 3 minutes turned off automatically. Useful if you already know for how long the output should stay on.
    • For output sensors optionally set a safeguard (e.g. after a relay is set to on, turn it off automatically after 1 hour). Useful if e.g. you are controlling a boiler and you are afraid something could prevent the command to turn it off to reach the board.
    • Add timeframe option for reporting battery level (e.g. instead of reporting every 10 sleeping cycles, report every 1 hour regardless of how long is the sleeping cycles).

    The other big change is a an complete remote API. With the current version you could send to NodeManager's service child id a limited list of commands to change the behavior of the board remotely, mainly to alter the duration of the sleep cycle. In the development release instead, almost every function of both NodeManager AND of every sensor can be invoked remotely. This is done by sending a V_CUSTOM message with a function_id and optional value to pass along to the service child id or each sensor's child id. More details here: https://github.com/mysensors/NodeManager/tree/development#communicate-with-nodemanager-and-its-sensors

    This development branch is available here: https://github.com/mysensors/NodeManager/tree/development


  • Mod

    Do you think it may be possible to add the function to use a digital pin to power a PIR sensor to turn it on only when setting it armed? (to save a little power)



  • Why does the power manager use two pins to power the sensor? Could we just use one pin for Vcc, and assume that the GND is permanently connected?



  • But i'm trying to test a Pir of panasonic EKMB1201113 papirs series cost a bit but they have low power consumption
    1 to 100 microampers in sleep mode, just connect a 100 kohm resistance in pulldown and it is very precise up to 12 meters

    link text


  • Contest Winner

    @gohan interesting use case. I personally prefer to have the arm/disarm logic on the controller but I can understand there are also different situations. I've opened https://github.com/mysensors/NodeManager/issues/138 for this. Thanks for the suggestion!


  • Contest Winner

    @rakeshpai said in NodeManager: plugin for a rapid development of battery-powered sensors:

    Why does the power manager use two pins to power the sensor? Could we just use one pin for Vcc, and assume that the GND is permanently connected?

    I usually use the power pins when either I need to save power or I do not have vcc/gnd pins available on the arduino board. But yes, you're right, there are other scenarios to consider. I've opened https://github.com/mysensors/NodeManager/issues/139 for this. Thanks


  • Mod

    saving pins is always good 😄



  • Hello how can i enter the commands type 254; 200; 2; 0; 48; BATTERY in a lua script of domoticz?


  • Contest Winner

    @mar.conte said in NodeManager: plugin for a rapid development of battery-powered sensors:

    Hello how can i enter the commands type 254; 200; 2; 0; 48; BATTERY in a lua script of domoticz?

    Sorry, I don't use domoticz so I cannot help with that. I hope somebody else here will have an answer for you 🙂


  • Contest Winner

    Guys, @hek has been so kind to offer a dedicated section within the forum for NodeManager so feel free to open new topics directly under https://forum.mysensors.org/category/43/nodemanager. I hope this can facilitate new users to better find the answers they are looking for and you guys to follow the discussions in a smoother way without the need to jump here and there along the same long thread.


  • Contest Winner

    Hello All,
    I've just released on GitHub (https://github.com/mysensors/NodeManager) a hotfix (v1.5.1) for NodeManager in order to include the memory optimization improvements already part of the development version.
    This is to allow saving up to 20% of memory on a pro mini and prevent the board to crash or become unpredictable when approaching the memory limit. No new features or enhancements have been added to this hotfix.
    If instead interested in testing out the development version or contribute please refer to https://github.com/mysensors/NodeManager/tree/development and https://github.com/mysensors/NodeManager/milestone/7.
    Thanks


  • Contest Winner

    Hello, NodeManager's version 1.6 is almost ready. Plenty of new things and fixes are about to be available but I'd need some diverse testing before officially releasing it.

    The first step would be to ensure that what was working with the current version is still working with this new release 🙂

    All the new things are instead detailed here https://github.com/mysensors/NodeManager/issues?utf8=✓&q=milestone%3Av1.6 is%3Aclosed label%3Afixed and in the associated PRs.

    The code is available at https://github.com/mysensors/NodeManager/tree/development.

    Whoever is willing to give it a try, please report any issue directly on github whenever there is already an issue open or on https://forum.mysensors.org/topic/7266/nodemanager-v1-6-dev-comments-and-issues otherwise.

    Ideally I'm targeting mid August for releasing a stable v1.6.

    Many thanks!



  • @user2684
    Hello,
    I'm using NM for all my projects and I really like it!
    Will NodeManager support APDS-9960 RGB and Gesture Sensor in the future?

    Thanks


  • Contest Winner

    @Getz99 thanks for your feedback! I've created https://github.com/mysensors/NodeManager/issues/201 to track this request. Keep in mind no new features will be part of v1.6 which should be released soon so I've added this to the v1.7 backlog. Thanks



  • @user2684 Thanks! I understand it will not be in v1.6, I'm waiting for that release!


  • Contest Winner

    Hi, kind of the the last chance to share any feedback regarding NodeManager v1.6-dev which is almost ready and should be out in a week or two.

    Instructions on how to test the pre-release and report issues here: https://forum.mysensors.org/topic/6183/nodemanager-plugin-for-a-rapid-development-of-battery-powered-sensors/184

    Thanks!


  • Contest Winner

    Hello All,

    NodeManager v1.6 is finally available! Download and upgrade instructions can be found as always on https://github.com/mysensors/NodeManager

    First of all I want to thank everybody contributing to the project, especially those who have submitted pull requests to the repository.

    In v1.6 we have 36 out-of-the-box sensors as well as a good number fixes and enhancements. The most notable are for sure the capability to customize any sensor remotely through a brand new remote API and a more flexible and effective way to configure reporting intervals and sleep cycles:

    • Introduced new remote API to allow calling almost ALL NodeManager's and its sensors' functions remotely
    • Reporting interval configuration is now indipendent from the sleep cycle
    • Reporting interval can be customized per-sensor
    • All intervals (measure/battery reports) are now time-based
    • Added support for BMP280 temperature and pressure sensor
    • Added support for RS485 serial transport
    • Added support for TSL2561 light sensor
    • Added support for DHT21 temperature/humidity sensor
    • Added support for AM2320 temperature/humidity sensor
    • Added support for PT100 high temperature sensor
    • Added support for MH-Z19 CO2 sensor
    • Added support for analog rain and soil moisture sensors
    • Added support for generic dimmer sensor (PWM output)
    • Added support for power and water meter pulse sensors
    • Radio signal level (RSSI) is now reported automatically like the battery level
    • SensorRainGauge now supports sleep mode
    • SensorSwitch now supports awake mode
    • SensorLatchingRealy now handles automatically both on and off commands
    • SensorMQ now depends on its own module
    • Added safeguard (automatic off) to SensorDigitalOutput
    • Any sensor can now access all NodeManager's functions
    • DHT sensor now using MySensors' DHT library

    For those who have previously forked the repository, please ensure to merge the updated development branch first before submitting any new PR.

    Thanks!



  • @user2684

    Hi,

    thanks again for your great work!

    As I said, I will try to include my Chirp module into 1.7 via a github branch/fork. You wrote in your explanation of "contributing to the code", that it is not allowed, to change config.h. But how should I include the lines for the chirp sensor?
    And in wich way can the documentation be modified? (chirp sensor paramaters)

    Best regards

    Betonmoewe


  • Contest Winner

    @betonmoewe if I wrote that config.h cannot be changed, I wrote something wrong 🙂 You can change whatever of course, just keep changes to config.h and the main sketch to the minimum since those can only be upgraded manually and not just by replacing the files. To add a new sensor, have a look at one of the existing sensors. Documentation can be updated as well by changing the README file. Should you have any doubt or issue feel free to open a new thread on https://forum.mysensors.org/category/43/nodemanager. Thanks!



  • When do you plan to release V1.7 ?


  • Contest Winner

    @vikasjee realistically it will take a while unfortunately 😞 I'm now spending most of my little spare time on https://github.com/mysensors/NodeManager/pull/229 which is kind of difficult to fix. Only after I will go through the (long) list of fixes/requests queued for v1.7 🙂

    user2684 created this issue in mysensors/NodeManager

    closed Architecture review #229


  • Contest Winner

    @vikasjee FYI the blocking issue which was slowing down v1.7 development has been solved now (https://forum.mysensors.org/topic/6534/nodemanager/133). Still a long way to get there but at least a bit closer now 🙂
    Thanks



  • Hi @user2684
    Is it possible to add sensor MG996R Servo in V1.7? I know the list is long for fixes but it would be nice if you could squeeze it in.

    Thanks!


  • Contest Winner

    @getz99 I've added this feature request for this: https://github.com/mysensors/NodeManager/issues/253

    Thanks!

    user2684 created this issue in mysensors/NodeManager

    closed Add support for MG996R Servo #253



  • @user2684 Thanks, Very much appreciated!


  • Plugin Developer

    I grabbed the latest development branch tonight to try this out. I saved the NodeManager.ino as a new name and copied the NodeManagerLibrary.h and NodeManagerLibrary.ino files into the new folder. I enabled USE_DIGITAL_OUTPUT and added a SensorDigitalOutput and SensorRelay child in my sketch and tried to compile. Unfortunately I got these errors:

    In file included from ino:244:0:
    sketch/NodeManagerLibrary.h:549:27: error: 'SR_RX_RSSI' was not declared in this scope
         int _signal_command = SR_RX_RSSI;
                               ^
    /NodeManagerLibrary.ino: In member function 'virtual void SensorSignal::onLoop(Child*)':
    /NodeManagerLibrary.ino:741:45: error: 'signalReport_t' was not declared in this scope
       int16_t value = transportGetSignalReport((signalReport_t)_signal_command);
                                                 ^
    /NodeManagerLibrary.ino:741:75: error: 'transportGetSignalReport' was not declared in this scope
       int16_t value = transportGetSignalReport((signalReport_t)_signal_command);
                                                                               ^
    exit status 1
    Error compiling for board Arduino Nano.
    

    All seems to be related to signal reports but even if I disable signal reporting the errors still occur. Guessing I did something wrong so any ideas would be appreciated.

    Thanks!


  • Contest Winner

    @jsiddall thanks for this hit, the issue seems to be related to SR_RX_RSSI which is only available with 2.2.0-beta version of the MySensors library, not 2.1.1 which I guess you are using. Something which needs to be fixed on the NodeManager's side, I've opened https://github.com/mysensors/NodeManager/issues/256 for this. Thanks


  • Plugin Developer

    @user2684 Great, thanks for the quick response.

    UPDATE: Confirmed, all is good with MyS 2.2.0-rc2. Not sure what resolution you had in mind for issue #256 but a note in the installation section of this page:

    https://www.mysensors.org/download/node-manager

    ...stating the required version of MyS for both the stable and dev versions of NodeManager would probably have been enough to keep me out of trouble!

    Thanks again for NodeManager. It does everything I had been doing manually before, using pages of sketch, and shrinks it down to a few simple lines.


  • Contest Winner

    @jsiddall thanks, fixed in the development branch right now. Adding a compatibility table between NodeManager and the MySensors library version sounds like a good idea, I've added https://github.com/mysensors/NodeManager/issues/261 for this. Thanks again



  • GHi, the rfm95 is compatible with nodemanager?
    And the esp32 also?


  • Contest Winner

    @mar-conte everything supported by the core MySensors library is supported by NodeManager since using the same code behind the scene but I'll add some default defines in the main sketch to make this configuration easier (https://github.com/mysensors/NodeManager/issues/262). Thanks

    user2684 created this issue in mysensors/NodeManager

    closed Add support for RFM95 #262



  • @user2684
    Ok Tanks



  • I need help!!!
    I have e mcp23017 Matrix espander i/o in esp nodemecu board, the mcp receive state sensor from my system wired alarm(pir, sismic etc) ; this signal received i want send to my domoticz controller, is the sensor custom the solution? Can i present 16 input sensors from my node to my controller?
    Tanks


  • Contest Winner

    @mar-conte if using NodeManager, this is still not possible since mcp23017 is not supported by NodeManager yet. Thanks!



  • @user2684
    For example using text send if i receive state?


  • Contest Winner

    Hi, for anybody interested in giving the upcoming NodeManager v1.7 a try or share a feedback, please have a look at https://forum.mysensors.org/topic/9085/nodemanager-v1-7-beta-feedback-needed. Thanks!


  • Contest Winner

    Hi, the new version of NodeManager (v1.7) is now available! For those interested in having a look at the new features, supported sensors and capabilities, I've opened a dedicated thread on the forum here https://forum.mysensors.org/topic/9165/nodemanager-v1-7-now-available
    Thanks



  • @user2684 this project is awesome! Thank you for your work and efforts. Just one question: what exactly is needed for "built-in battery reporting" hardware-wise? is it really "built-in" or do i need additional wiring and resistors for battery reporting? (I'll want to power up my 3.3V Arduino Pro mini with 2 AA cells)


  • Mod

    since you are using 2AA batteries it can report voltage directly, in case you had any voltage regulator or booster it would require external resistors



  • Thank you very much. BTW: Is it possible to use Nodemanager with two, three or even four door sensors on a single ESP8266 (as Gateway without NRF radio)? Any help very appreciated!


  • Contest Winner

    @grau the current door sensor implementation (SensorDoor class) leverages attachInterrupt(); not sure how many interrupt pins are there on a ESP8266 but if there are enough it should work



  • @user2684 Hello all of You,
    this topic is quite old, but hopefully someone is reading this.
    I could not figure out, what to do if the NRF24 is wired to different pins.
    I have a board with nrf24 on board, but this are connected like:
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    #define MY_RF24_CE_PIN 7
    #define MY_RF24_CS_PIN 10
    #define MY_SOFT_SPI_SCK_PIN 11
    #define MY_SOFT_SPI_MOSI_PIN 12
    #define MY_SOFT_SPI_MISO_PIN 13
    How can this be inplemented in the nodemanager?


  • Contest Winner

    @rpunkt just use those directives in your sketch, no differences with NodeManager, those will be seen by the MySensors library and applied. Thanks



  • @user2684 Thanks a lot. I should have tried this, before to post a question, but sometimes the brain is sticky.



  • Hello all of You,
    if have a flight time sensor VL53L0X, that is running so far.
    It should measure the water level in a rain tank.
    But now i want to customize my sensornode in that way, that two other values will be transmitted.
    It should be
    V_level, that represents the percentage of my water tank
    and
    V_volume, that represents the available volume of water
    V_level and V_volume could be calculated from the sensor value of the distance sensor (VL53L0X).
    But somehow I could not manage to to get this running. I don't know where to insert what.
    Cant someone point me to the right direction, help appreciated

    /*
    * The MySensors Arduino library handles the wireless radio link and protocol
    * between your home built sensors/actuators and HA controller of choice.
    * The sensors forms a self healing radio network with optional repeaters. Each
    * repeater and gateway builds a routing tables in EEPROM which keeps track of the
    * network topology allowing messages to be routed to nodes.
    *
    * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
    * Copyright (C) 2013-2017 Sensnology AB
    * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
    *
    * Documentation: http://www.mysensors.org
    * Support Forum: http://forum.mysensors.org
    *
    * This program is free software; you can redistribute it and/or
    * modify it under the terms of the GNU General Public License
    * version 2 as published by the Free Software Foundation.
    */
    
    /**************************
    Template
    
    This sketch can be used as a template since containing the most relevant MySensors library configuration settings, 
    NodeManager's settings, all its the supported sensors commented out and a sketch structure fully functional to operate with
    NodeManager. Just uncomment the settings you need and the sensors you want to add and configure the sensors in before()
    */
    
    /**********************************
     * MySensors node configuration
     */
    
    // General settings
    #define SKETCH_NAME "NodeManager"
    #define SKETCH_VERSION "1.0"
    //#define MY_DEBUG
    #define MY_NODE_ID 8
    
    // NRF24 radio settings
    #define MY_RADIO_NRF24
    #define MY_RF24_CE_PIN 7
    #define MY_RF24_CS_PIN 10
    #define MY_SOFT_SPI_SCK_PIN 11
    #define MY_SOFT_SPI_MOSI_PIN 12
    #define MY_SOFT_SPI_MISO_PIN 13
    
    // Advanced settings
    #define MY_BAUD_RATE 9600
    #define MY_SPLASH_SCREEN_DISABLED
    
    /**********************************
     * MySensors gateway configuration
     */
     
    // Common gateway settings
    //#define MY_REPEATER_FEATURE
    
    /***********************************
     * NodeManager configuration
     */
    
    #define NODEMANAGER_DEBUG ON
    #define NODEMANAGER_INTERRUPTS ON
    #define NODEMANAGER_SLEEP ON
    #define NODEMANAGER_RECEIVE OFF
    #define NODEMANAGER_DEBUG_VERBOSE OFF
    #define NODEMANAGER_POWER_MANAGER ON
    #define NODEMANAGER_CONDITIONAL_REPORT OFF
    #define NODEMANAGER_EEPROM OFF
    #define NODEMANAGER_TIME OFF
    #define NODEMANAGER_RTC OFF
    #define NODEMANAGER_SD OFF
    #define NODEMANAGER_HOOKING OFF
    #define NODEMANAGER_OTA_CONFIGURATION OFF
    #define NODEMANAGER_SERIAL_INPUT OFF
    
    // import NodeManager library (a nodeManager object will be then made available)
    #include <MySensors_NodeManager.h>
    
    /***********************************
     * Add your sensors
     */
    
    //PowerManager power(5,6);
     
    #include <sensors/SensorBattery.h>
    SensorBattery battery;
    
    //#include <sensors/SensorConfiguration.h>
    //SensorConfiguration configuration;
    
    #include <sensors/SensorSignal.h>
    SensorSignal signal;
    
    #include <sensors/SensorVL53L0X.h>
    SensorVL53L0X vl53l0x(9);
    
    /***********************************
     * Main Sketch
     */
    
    // before
    void before() {
    	
      /***********************************
       * Configure your sensors
       */
      // 
      // EXAMPLES:
      // report measures of every attached sensors every 10 seconds
      nodeManager.setReportIntervalSeconds(10);
      void setADCOff();
      nodeManager.setSleepSeconds(10);
      // call NodeManager before routine
      nodeManager.before();
      }
    
    // presentation
    void presentation() {
      // call NodeManager presentation routine
      nodeManager.presentation();
    }
    
    // setup
    void setup() {
      // call NodeManager setup routine
      nodeManager.setup();
    }
    
    // loop
    void loop() {
      // call NodeManager loop routine
      nodeManager.loop();
    }
    
    #if NODEMANAGER_RECEIVE == ON
    // receive
    void receive(const MyMessage &message) {
      // call NodeManager receive routine
      nodeManager.receive(message);
    }
    #endif
    
    #if NODEMANAGER_TIME == ON
    // receiveTime
    void receiveTime(unsigned long ts) {
      // call NodeManager receiveTime routine
      nodeManager.receiveTime(ts);
    }
    #endif```

  • Contest Winner

    @rpunkt my recommendation would be to create a custom sensor in NodeManager which is implementing the logic you like. Feel free to copy from https://github.com/mysensors/NodeManager/blob/master/sensors/SensorVL53L0X.h and create your own or make your own class by inheriting directly from SensorVL53L0X.



  • @user2684 Seems to be to difficult for a rookie 😭
    On the conventional MySensors library it is possible with my abilities, but then the power management is a issue.
    For me the NodeManager was the choice, because it saves so much battery energy.
    Other way of solution:
    A friend of mine, convinced me off doing all the calculations in the home- automation (in my case FHEM).
    Now I only use the node transmitting the distance and calculating the "volume of water" and "percentage of water" as a "user reading".



  • Hello @user2684 et al,

    I'm trying to use this library on an ESP32 board. I'm trying this sketch out (https://raw.githubusercontent.com/mysensors/NodeManager/master/examples/AnalogLightAndTemperatureSensor/AnalogLightAndTemperatureSensor.ino)

    My problem is that if I just try to use the 1.8 version of NodeManager it will use as a dependency a version of MySensors which do not work with ESP32 and I get a known error regarding re-definition of app_main. Because of that I need to use the development version of MySensors but it seems not compatible with NodeManager 1.8 as I get the following error:

    In file included from .pio/libdeps/nodemcu-32s/MySensors/MySensors.h:43:0,
                     from .pio/libdeps/nodemcu-32s/NodeManager/MySensors_NodeManager.h:43,
                     from src\main.cpp:60:
    .pio/libdeps/nodemcu-32s/MySensors/MyConfig.h:288:2: warning: #warning MY_RADIO_NRF24 is deprecated, use MY_RADIO_RF24 instead. [-Wcpp]
     #warning MY_RADIO_NRF24 is deprecated, use MY_RADIO_RF24 instead.
      ^
    In file included from .pio/libdeps/nodemcu-32s/NodeManager/MySensors_NodeManager.h:87:0,
                     from src\main.cpp:60:
    .pio/libdeps/nodemcu-32s/NodeManager/nodemanager/Sensor.cpp: In member function 'void Sensor::presentation()':
    .pio/libdeps/nodemcu-32s/NodeManager/nodemanager/Sensor.cpp:135:54: error: invalid conversion from 'uint8_t {aka unsigned char}' to 'mysensors_sensor_t' [-fpermissive]
       present(child->getChildId(), child->getPresentation(), child->getDescription(), nodeManager.getAck());
                                                          ^
    In file included from .pio/libdeps/nodemcu-32s/MySensors/MySensors.h:433:0,
                     from .pio/libdeps/nodemcu-32s/NodeManager/MySensors_NodeManager.h:43,
                     from src\main.cpp:60:
    .pio/libdeps/nodemcu-32s/MySensors/core/MySensorsCore.cpp:375:6: note:   initializing argument 2 of 'bool present(uint8_t, mysensors_sensor_t, const char*, bool)'   
     bool present(const uint8_t childSensorId, const mysensors_sensor_t sensorType,
          ^
    *** [.pio\build\nodemcu-32s\src\main.cpp.o] Error 1
    

    I have also tried using the development version of NodeManager with the development version of MySensors although I get the same result.
    I'm stuck and I would really appreciate any input.

    Thanks in advance!


  • Contest Winner

    @justfra thanks for reporting this issue, I believe there is some sort of library conflicts which is arising across MySensors/Nodemanager versions...something which has to be investigated carefully, I'll track this bug with https://github.com/mysensors/NodeManager/issues/491

    user2684 created this issue in mysensors/NodeManager

    open ESP32 compilation error #491


 

320
Online

8.9k
Users

9.7k
Topics

101.3k
Posts