πŸ’¬ NodeManager



  • Hi, what's your calendar for v 1.6.0. I was looking forward to IO-Expander MCP23017 and TTP226/9 support in this release...


  • Contest Winner

    @vikasjee this was the plan, you're right, but I had to postpone a good number of requests supposed to be part of v1.6 since I wanted to allow this https://forum.mysensors.org/topic/6980/browser-based-firmware-generator which is dependent on NodeManager to come to life asap. So unfortunately I had to move those enhancement requiring some effort to v1.7 even if I already acquired the hardware. Sorry for that



  • @user2684 No issues! When are you planning for 1.7.0? Looking forward to an early release especially the IO-Expander MCP23017 support...


  • Contest Winner

    @vikasjee v1.7 will be somewhere after summer since v1.6 should be out by the end of this month I guess. But I can promise to start looking into IO-Expander MCP23017 support as the first thing as v1.7 development will start so to make it available first thing into the development branch πŸ™‚



  • Hi, is it possible to add neopixel in the next version? thank you for your work



  • Hello, is there an option to use the (fantastic) Node Manager in a RS485 wired set-up?


  • Contest Winner

    @MCF I've added https://github.com/mysensors/NodeManager/issues/203 to track this request. Feel free to add any relevant comment or code samples to the issue. Thanks!


  • Contest Winner

    @ArduiSens RS485 should be already there in the development version (https://github.com/mysensors/NodeManager/tree/development). Nothing special, I've just added to config.h some sample directives, commented out by default. Let me know in case this approach can be improved. Thanks!



  • @user2684, found the RS485 settings (thanks), but having problems with disabling the BATTERY_MANAGER option.
    We don't need this option in a RS485 serial wired network (or RS485 serial gateway).

    config.h:
    #define BATTERY_MANAGER 0

    gives following compiling errors:
    sketch\NodeManager.cpp: In member function 'void NodeManager::process(Request&)':
    NodeManager.cpp:3722: error: 'setBatteryReportSeconds' was not declared in this scope
    case 40: setBatteryReportSeconds(request.getValueInt()); break;
    NodeManager.cpp:3723: error: 'setBatteryReportHours' was not declared in this scope
    case 41: setBatteryReportHours(request.getValueInt()); break;
    NodeManager.cpp:3724: error: 'setBatteryReportDays' was not declared in this scope
    case 42: setBatteryReportDays(request.getValueInt()); break;

    exit status 1
    'setBatteryReportSeconds' was not declared in this scope


  • Contest Winner

    @ArduiSens thanks, good catch, this looks like a mistake on my side, keep on eye on https://github.com/mysensors/NodeManager/issues/206 for a fix which should come shortly.



  • @user2684, why does NodeManager take so many sketch memory?
    e.g.
    (#define BATTERY_MANAGER 1; #define DEBUG 1; #define MODULE_DS18B20 1)
    sketch NodeManager RS485 config for DS18B20 --> 28730 bytes (93%) of program storage space. Maximum is 30720 bytes.

    own sketch for RS485 SR04T --> 17078 bytes (55%) of program storage space. Maximum is 30720 bytes.

    OK, DS18B20 and SR04T are not the same but DS18B20 is less complex, so 38% more memory is pretty much.
    Do I miss something?



  • @ArduiSens for curiosity, what board are those numbers from?

    NodeManager is a young project. You can expect changes and optimizations in the future. And also you can do suggestions and pull requests.



  • @Sergio, I know and it's OK. I'm just playing (trying to convert my RS485 projects).
    In the cases above I'm using Nano boards.


  • Contest Winner

    @ArduiSens that's true, many optimizations can be done to save additional storage. With v1.5.1 a design issue eating up 20% of the storage has been fixed but many things for sure can be improved. As for the current version, try lowering down MAX_SENSORS (which by default allocates the pointers for 10 child IDs) and set DEBUG to 0 after your tests. The latter especially should give you another 20% of storage back (static strings of the debug output are consuming most of this storage). Thanks



  • How to add i2c sensor?
    I see that there is a git issue asking about si7021 which I would also like to use as well, but has someone perhaps connected it already by creating a custom sensor?
    How difficult would it be?
    Thanks!


  • Contest Winner

    Hi @dakipro, I've just commented on github for the Si7021. Regarding the custom sensor, have a look at this https://github.com/mysensors/NodeManager#creating-a-custom-sensor (or the same section on the development branch documentation if you are using it). As far as you create an (inline) class inheriting from Sensor or its subclasses and implement the methods listed in the documentation you can invoke registerSensor() providing the instance of your class and NodeManager will take care of it. Just take inspiration from an existing sensor if you want to do so, it should save you some time. 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!



  • This post is deleted!


  • Hi, obviously a lot of work gone into NodeManager thanks, I'm quite new to MySensors but have started working on.a few sensors around my home.

    I was just looking through the code (NodeManager.cpp) and an apparent issue jumped out at me (I write C++ for a living on very large boxes but still worry about performance!)
    The two functions NodeManager::_saveConfig and NodeManager::_loadConfig are used to save the _sleep_time value to EEPROM. The code splits the long value into 3 parts by dividing by successively 255 . On loading the value is reconstructed by multiplying by 255.
    I'm pretty sure that you meant to use 256 to split the long value into three independent bytes to store.
    Dividing or multiplying by 255 is potentially expensive whereas dividing or multiplying by 256 is much faster simply requiring shifts.
    The normal code for splitting a long value into individual bytes would be something like
    uint8_t byte0 = _sleep_time & 0xff; // compiler should generate a simple byte load
    uint8_t byte1 = (_sleep_time >> 8 ) & 0xff; // compiler should still generate a simple byte load from the second byte of _sleep_time
    uint8_t byte2 = (_sleep_time >> 16) & 0xff; // as before should still be a byte load.
    I'm not sure how good the gcc optimiser is for the AVR code but, putting the shift&mask operations directly into the calls of saveSave(...) may avoid having to allocate local variables as in
    // save the 3 bits
    saveState(EEPROM_SLEEP_SAVED,1);
    saveState(EEPROM_SLEEP_1,_sleep_time & 0xff);
    saveState(EEPROM_SLEEP_2,(_sleep_time >> 8 ) & 0xff);
    saveState(EEPROM_SLEEP_3, (_sleep_time >> 16) & 0xff);

    I am not an expert in in the AVR architecture or instruction set so maybe there is a good reason why you are using 255 instead of 256 - it just seems strange!

    Regards

    Graham



  • Hi,
    I have started to play with nodemanager and I have registered a SENSOR_DS18B20. Nodemanager handles all the heavy lifting and the sensor is reporting the temperature 100%. I can change the sleep and report intervals with β€œsetReportIntervalSeconds and setSleepSeconds”.

    Question 1:
    According to the MySensors documentation (https://www.mysensors.org/download/serial_api_20#variable-types) a S_TEMP sensor can report the V_TEMP value and a V_ID value. Nodemanager populates the V_TEMP variable, but how can I populate and send the V_ID value?
    Question2:
    If I want to add an additional sensor I must register it with β€œregisterSensor” and I would set the report interval for this sensor by getting a pointer to this sensor with β€œgetSensor”, but how do I add custom code for this sensor in Loop()? How do I ensure that the custom code is only executed for this sensor and not for the other sensor?



  • @user2684, Will you like to consider adding a #DEFINE to let user configure PowerOn function to select "GND-On" or "Vcc-On" (5V0)?

    With this GND-On PowerOn, a single GND wire controlled by a digital pin can control the power instead of 2 wire poweron control. [so many control words :)]

    For devices that require more than ~10mA current (~Arduino pin current) this GND-On configuration can help externally supplied higher powered V+ current to switch the devices! Thus, will also help 3V3 devices to be controlled by PowerOn, of course, with external 3V3!



  • I just started using NodeManager, mainly for the ability to send settings to the node.
    I started with a plain analog (Voltage) sensor, and it works just fine. But I cannot make a DS18B20 sensor to send any temperature data. It registers on the gateway, and that's it.
    I have enabled the DS18B20 module in the config.h.
    This is the code in the sketch:

      /*
       * Register below your sensors
      */
      nodeManager.setSleepSeconds(10);
      nodeManager.setReportIntervalSeconds(10);
      int temp = nodeManager.registerSensor(SENSOR_DS18B20);
       /*
       * Register above your sensors
      */
    

    Am I missing something?


  • Contest Winner

    @graham86 there was no special reason why I used 255 apart from my lack of c++ knowledge πŸ˜› Thanks for the hit, I'll fix it with https://github.com/mysensors/NodeManager/issues/215


  • Contest Winner

    Hi @FredRoot, V_ID has not been used so far by NodeManager, thanks for noticing it! I've added https://github.com/mysensors/NodeManager/issues/216 for this

    Regarding the other question you have two ways: 1) add your custom code to onLoop() in NodeManager.cpp (this will not survive to an upgrade) 2) create a custom sensor inheriting from Sensor or other subclasses and call registerSensor() by providing an instance of this class (https://github.com/mysensors/NodeManager#creating-a-custom-sensor)
    Thanks


  • Contest Winner

    @vikasjee sorry my bad, I think I couldn't understand your suggestion πŸ™‚ Do you have an example to let me understand better? thanks and sorry again, I'm sure I'm missing something somewhere πŸ™‚


  • Contest Winner

    @kted I think you forgot the pin to which the sensor is attached to. e.g.

    nodeManager.registerSensor(SENSOR_DS18B20,6);
    


  • @user2684 Actually, you are right. Thank you.
    But shouldn't the compiler throw an error?

    Now to the hard part: How to send the actual command from Domoticz, for example to change the sleep duration...



  • @kted Such functionality it's supposed to be hard-coded in the node sketch. But if you want to make it modificable from Domoticz, perhaps you can make use of the V_VAR1-3 variables and modify them in domoticz, receive them in the node and pass to NodeManager.


  • Contest Winner

    @kted the compiler doesn't complain because for some sensors (e.g. those using i2c), the pin is not required so I made it not mandatory. As for Domoticz, I'll let others to address your question since I don't know that controller enough. Thanks



  • @user2684 I have looked at the changes in https://github.com/mysensors/NodeManager/pull/174 which incorporates an alternative improved implementation for the _LoadConfig/_SaveConfig functions (interesting that using an intermediate union requires less code than my shifting version- presumably due to differences in the way the GCC optimiser works for an AVR target).
    I spotted a coupld of minor points and was also able to further reduce the code size.
    Firstly as we are writing C++ rather than C the declaration of the union should just be
    // Local union used to split _sleep_time into bytes
    union tLongByteArrayCombo{
    long long_value;
    uint8_t byte_array[4];
    } ;
    (The typedef systax, although valid C++ is unnecessary - a simple union declaration is sufficient.)
    There is also a typo - the original had a member called byte_arrray instead of byte_array.

    You can also save 24 bytes of code by avoiding the use of a local union variable and simply aliasing _sleep_time as the union type. So instead of _load_config doing -
    tLongByteArrayCombo c;
    c.byte_array[0] = loadState(EEPROM_SLEEP_1);
    c.byte_array[1] = loadState(EEPROM_SLEEP_2);
    c.byte_array[2] = loadState(EEPROM_SLEEP_3);
    c.byte_array[3] = 0;
    _sleep_time = c.long_value;
    You can do
    (((tLongByteArrayCombo&)_sleep_time).byte_array )[0] = loadState(EEPROM_SLEEP_1);
    (((tLongByteArrayCombo&)_sleep_time).byte_array )[1] = loadState(EEPROM_SLEEP_2);
    (((tLongByteArrayCombo&)_sleep_time).byte_array )[2] = loadState(EEPROM_SLEEP_3);
    (((tLongByteArrayCombo&)_sleep_time).byte_array )[3] = 0;
    And in _save_config instead of
    tLongByteArrayCombo c;
    c.long_value = _sleep_time;
    saveState(EEPROM_SLEEP_1, c.byte_array[0]);
    saveState(EEPROM_SLEEP_2, c.byte_array[1]);
    saveState(EEPROM_SLEEP_3, c.byte_array[2]);
    you can use
    saveState(EEPROM_SLEEP_1, (((tLongByteArrayCombo&)_sleep_time).byte_array )[0] );
    saveState(EEPROM_SLEEP_2, (((tLongByteArrayCombo&)_sleep_time).byte_array )[1] );
    saveState(EEPROM_SLEEP_3, (((tLongByteArrayCombo&)_sleep_time).byte_array )[2] );

    In my specific sample sketch I had the following code sizes

    Original NodeManager.cpp 28242 Bytes
    NodeManager with patch from pull rq 174 - 28154 Bytes (saving of 88 Bytes of code(
    Patched NodeManager with additional changes above - 28130 Bytes ( saving another 24 Bytes of code)


  • Contest Winner

    @graham86 I guess you are referring to https://github.com/mysensors/NodeManager/pull/217, not 174, am I wrong? Anyway, any contribution that would help saving bytes is more than welcome: NodeManager is becoming more and more complex and the situations where we are out of storage start increasing so we definitely need to save whatever wherever we can πŸ™‚ Regarding what you are proposing above, keep on eye on PR #217; once a new one dedicated to this part of the code will be created as discussed there, feel free to add your own PR to that branch or just let me know and I'll do it for you. Thanks!



  • @user2684, Sorry, couldn't revert to your query earlier as i was away building a small library.

    Expanding onto my earlier post on the requested Power Management feature -
    A simple switch will complete a circuit whenever its switched ON. This allows for placing the switch on the ground return wire too. So only a single GND-ON (Switched ON) will complete the circuit (without requiring an additional Vcc-ON switch).

    Now, with a developer configured #DEFINE GND_ON_POWER =1 may be checked in NodeManager's PowerManagement functions to DigitalWrite(Digital_GND_ON_Pin, LOW)
    for a switchON effect.

    Additionally, To provide an extra current to a sensor (i.e. more than a ~10mA-20mA, a max safe current provided by an Arduino pin) an external power source (other than Arduino +5V0 OR +3V3) may be provided by that external power source (of course with with a common ground wire between Arduino and that powersource to complete the circuit.)

    Also, with the current 2Wire PowerOn methodology, the VccPowerOn switch can provide only one positive voltage (that provided by Arduino Vcc, say +5V0) but not +3V3 (say) to the sensors. If some attached sensors require the other voltage (+3V3), then, this 2Wire PowerOn method will not help. Whereas, a single GND_On power methodology will still switch the circuit thus managing the Power to those sensors too.
    [PS: Signal Voltage Levels will still need to be managed by the developer attaching those sensors to the node]

    I think this simple feature will add on to the power of the PowerManagement functions.

    Hope this clears some air ? Open to suggestions...


  • Contest Winner

    @vikasjee thanks all clear now! I'll track this with https://github.com/mysensors/NodeManager/issues/224. Thanks again for the detailed explanation!


  • Contest Winner

    Hello all, just to let you know when compiling against the latest version of the mysensors 2.2.0-beta library, NodeManager will crash on startup, just after presenting the mysensors logo. Thanks @gohan for pointing this out! Root cause is still unknown but when MY_DEBUG is defined, the crash doesn't take place (https://github.com/mysensors/NodeManager/issues/223)



  • @user2684, Can we have a quick hot fix?


  • Contest Winner

    @vikasjee sure, as soon as I'll be able to understand the reason why it crashes when MY_DEBUG is not defined 😞 if somebody from the core team has any hit, would be really appreciated!
    Thanks



  • I'm afraid that issue 223 is not a NodeManager failure. I can reproduce it in a new sketch without using NodeManager.
    Other issue with MySensors are, NRF24 doesn't link with controller.
    If MY_DEBUG_VERBOSE_RF24 is defined, it automagically works.



  • @Sergio-Rius, with RF24_VERBOSE on, the system crashes in 40-50 seconds especially if you're connected to the serial monitor or if your serial gateway has this #DEFINE on.



  • Still more strange, suddenly started to work properly on 2/3 of my testing nodes. That killed me.

    What about the gateways you are using? And the controllers?



  • Hi,

    I'm having trouble with the motion sample code. I have changed the setSleepHours(1) command to setSleepMinutes(1). I understand that the sensor will send a hart beat every 1 min. This is working fine for the hart beat, but evertime the hart beat is send the sensor sends a Trigger messages as well even though the sensor is not triggered. I thought that maybe there is a power dip and that it might cause the PIR (RS501) to send a interrupt, but I have removed the setSleepMinutes command and replaced it with a setBatteryReportHours(1) command. This command is send correctly and the sensor only sends the trigger command when the PIR is triggered. Did anyone have a similar issue?

    Attached is the sensor debug output when the setSleepMinutes command is used:

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    40 MCO:BGN:BFR
    REG I=1 P=3 P=1 T=16
    NodeManager v1.6
    LIB V=2.1.1 R=N T=N A=A S=- B=-
    INT P=3 M=1
    INT P=2 M=255
    96 TSM:INIT
    176 TSF:WUR:MS=0
    198 TSM:INIT:TSP OK
    219 TSM:INIT:STATID=3
    243 TSF:SID:OK,ID=3
    264 TSM:FPAR
    313 TSF:MSG:SEND,3-3-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    385 TSF:MSG:READ,0-0-3,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    440 TSF:MSG:FPAR OK,ID=0,D=1
    2387 TSM:FPAR:OK
    2404 TSM:ID
    2418 TSM:ID:OK
    2433 TSM:UPL
    2449 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2521 TSF:MSG:READ,0-0-3,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2578 TSF:MSG:PONG RECV,HP=1
    2607 TSM:UPL:OK
    2625 TSM:READY:ID=3,PAR=0,DIS=1
    2660 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    2734 TSF:MSG:READ,0-0-3,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2797 TSF:MSG:SEND,3-3-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
    2875 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    2945 TSF:MSG:READ,0-0-3,s=255,c=3,t=6,pt=0,l=1,sg=0:M
    RADIO OK
    3004 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=11,pt=0,l=11,sg=0,ft=0,st=OK:NodeManager
    3096 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
    PRES I=200, T=23
    3170 TSF:MSG:SEND,3-3-0-0,s=200,c=0,t=23,pt=0,l=0,sg=0,ft=0,st=OK:
    PRES I=201, T=30
    3260 TSF:MSG:SEND,3-3-0-0,s=201,c=0,t=30,pt=0,l=0,sg=0,ft=0,st=OK:
    BATT V=3.30 P=100
    SEND D=0 I=201 C=0 T=38 S= I=0 F=3.30
    3418 !MCO:SND:NODE NOT REG
    3506 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:100
    PRES I=1 T=1
    3579 TSF:MSG:SEND,3-3-0-0,s=1,c=0,t=1,pt=0,l=0,sg=0,ft=0,st=OK:
    READY
    
    3659 MCO:REG:REQ
    3688 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    3760 TSF:MSG:READ,0-0-3,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    3817 MCO:PIM:NODE REG=1
    3842 MCO:BGN:STP
    MY I=3 M=1
    3860 MCO:BGN:INIT OK,TSP=1
    SLEEP 60s
    
    3901 MCO:SLP:MS=60000,SMS=1,I1=1,M1=1,I2=255,M2=255
    3971 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=OK:127
    4544 MCO:SLP:TPD
    4560 MCO:SLP:WUP=1
    INT P=3, M=1
    AWAKE
    SWITCH I=1 P=3 V=1
    SEND D=0 I=1 C=0 T=16 S= I=1 F=0.00
    4597 TSF:MSG:SEND,3-3-0-0,s=1,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1
    SLEEP 60s
    
    4732 MCO:SLP:MS=60000,SMS=1,I1=1,M1=1,I2=255,M2=255
    4800 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=OK:956
    5376 MCO:SLP:TPD
    5392 MCO:SLP:WUP=1
    INT P=3, M=1
    AWAKE
    SWITCH I=1 P=3 V=0
    SEND D=0 I=1 C=1 T=16 S= I=0 F=0.00
    5429 TSF:MSG:SEND,3-3-0-0,s=1,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:0
    SLEEP 60s
    
    5564 MCO:SLP:MS=60000,SMS=1,I1=1,M1=1,I2=255,M2=255
    5632 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=OK:1787
    6207 MCO:SLP:TPD
    6223 MCO:SLP:WUP=-1
    AWAKE
    SLEEP 60s
    
    6246 MCO:SLP:MS=60000,SMS=1,I1=1,M1=1,I2=255,M2=255
    6322 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=OK:2478
    6897 MCO:SLP:TPD
    6914 MCO:SLP:WUP=1
    INT P=3, M=1
    AWAKE
    SWITCH I=1 P=3 V=1
    SEND D=0 I=1 C=1 T=16 S= I=1 F=0.00
    6950 TSF:MSG:SEND,3-3-0-0,s=1,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1
    SLEEP 60s
    
    7086 MCO:SLP:MS=60000,SMS=1,I1=1,M1=1,I2=255,M2=255
    7153 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=OK:3309
    7729 MCO:SLP:TPD
    7745 MCO:SLP:WUP=1
    INT P=3, M=1
    AWAKE
    SWITCH I=1 P=3 V=0
    SEND D=0 I=1 C=1 T=16 S= I=0 F=0.00
    7782 TSF:MSG:SEND,3-3-0-0,s=1,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:0
    SLEEP 60s
    
    7917 MCO:SLP:MS=60000,SMS=1,I1=1,M1=1,I2=255,M2=255
    7985 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=OK:4141
    8560 MCO:SLP:TPD
    8577 MCO:SLP:WUP=-1
    AWAKE
    SLEEP 60s
    
    8599 MCO:SLP:MS=60000,SMS=1,I1=1,M1=1,I2=255,M2=255
    8675 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=OK:4831
    9252 MCO:SLP:TPD
    9269 MCO:SLP:WUP=1
    INT P=3, M=1
    AWAKE
    SWITCH I=1 P=3 V=1
    SEND D=0 I=1 C=1 T=16 S= I=1 F=0.00
    9306 TSF:MSG:SEND,3-3-0-0,s=1,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1
    SLEEP 60s
    
    9441 MCO:SLP:MS=60000,SMS=1,I1=1,M1=1,I2=255,M2=255
    9508 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=OK:5664
    10084 MCO:SLP:TPD
    10102 MCO:SLP:WUP=1
    INT P=3, M=1
    AWAKE
    SWITCH I=1 P=3 V=0
    SEND D=0 I=1 C=1 T=16 S= I=0 F=0.00
    10139 TSF:MSG:SEND,3-3-0-0,s=1,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:0
    SLEEP 60s
    
    10274 MCO:SLP:MS=60000,SMS=1,I1=1,M1=1,I2=255,M2=255
    10344 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=OK:6500
    10921 MCO:SLP:TPD
    
    

  • Contest Winner

    @FredRoot this is weird, from the logs looks like there is kind of a floating interrupt (alternatively 1 and 0). The strange thing is that the interrupt is coming from the call to mysensors' sleep() function which is returning a positive number corresponding to the interrupt linked to pin 3 instead of a negative value like it should after a sleeping cycle. Anybody else experiencing this behavior with NodeManager v1.6? thanks



  • @user2684 can you add support for the Si7021 sensor as found in sensebender micro?
    https://www.mysensors.org/hardware/micro

    also, 2nd question.
    how do i register a sensor that is onboard?
    you ask for a child id and pin that it's on. but if it's an onboard sensor. how do you make that work? just omit the pin?


  • Contest Winner

    @mvader for question #1, I've added it to the existing issue https://github.com/mysensors/NodeManager/issues/221. For question #2, for sensors using i2c the pin is not required despite within the code nodemanager will set a random pin (have a look at SensorSHT21 for example)



  • @user2684 said in πŸ’¬ NodeManager:

    @mvader for question #1, I've added it to the existing issue https://github.com/mysensors/NodeManager/issues/221. For question #2, for sensors using i2c the pin is not required despite within the code nodemanager will set a random pin (have a look at SensorSHT21 for example)

    great.. thank you!


  • Contest Winner

    After a few months working behind the scene, NodeManager got kind of a full review in terms of architecture and usability. The code should be now simpler to understand for new users, the memory utilization has been optimized and the overall user experience has been improved.

    The looooong list of things that have been changed are detailed on https://github.com/mysensors/NodeManager/pull/229.
    Please note this is only available in the development branch (https://github.com/mysensors/NodeManager/tree/development) and will be generally available only when NodeManager's v1.7 will be released (it will take I guess still a few months).

    Since this change was blocking other pending changes, I hope now the development will be faster and feel free to submit your PRs now that the new architecture has been finalized.
    As always, any feedback is more than welcome.
    Thanks


  • Hardware Contributor

    @user2684 Thanks a lot for the architecture change, which makes a lot of sense conceptually.

    Unfortunately, it appears to use more memory than before. I'm working on an air quality board with eight MQ sensors, an MH-Z19 CO2 sensor and a Plantower PMSA003 particulate matter sensor. In previous development versions (1.7-dev, before today), the eight MQ sensors and the MH-Z19 worked fine, but now after your big merge of #229 the sketch appears to run out of memory after adding the child of the sixth MQ sensor. Do you see any chance to optimize for memory?

    Old sketch (using a previous development version of NodeManager, without the PMSA003; 155 bytes left after all nine sensors are fully initialized): https://github.com/open-tools/NodeManager_GasSensor/tree/master/NodeManager_GasSensor

    New sketch (using the latest version of NodeManager, plus a PMSA003): https://github.com/kainhofer/NodeManager/tree/GasSensor
    That sketch runs out of memory with the sixth MQ sensor (I added debug output with free memory at a lot of spots). Of course, I have commented out the PMSA003 completely to have a correct comparison.

    FWIW, the sketch is for this board: https://github.com/open-tools/NodeManager_GasSensor/blob/master/images/IMAG2267.jpg


  • Hardware Contributor

    @reinhold if you have high memory requirement, what about switching to a more modern architecture like stm32f103c8t6 on the famous "blue pill" boards ? It has 20k or RAM (10 times what you have on Arduino) and 64k of flash and it's supported by MySensors, in addition to be very cheap (2$/board). You will need voltage converter between 3.3V of the board and 5V of your sensors but that's not a big deal in exchange of the possibility to expand your board with more sensors in the future.


  • Mod

    @reinhold not sure how much this applies to NodeManager, but there are some recomendations for reducing memory footprint at https://www.mysensors.org/apidocs-beta/group__memorysavings.html


  • Hardware Contributor

    @nca78 Thanks for the suggestion to use the blue pill STM32 boards. I haven't thought of it (I only looked at the ESP8266, but that has only one ADC). I have a few lying around here, but never got around to trying them, as I first need to burn the bootloader. It looks quite promising, but the boards are huge, so I'll need to enlarge my PCB...
    The need for a 5V->3.3V regulator is no issue, as the NRF24 already needs 3.3V. The 5V analog level of the MQ sensors will need some converter (the analog ADC inputs are marked as non-5V-tolerant...), but then in turn I can get rid of the voltage dividers for the PMSA003. The larger issue seems to be the connection of the nrf24, which takes away 4 ADC pins, so there are only 6 ADC pins left, while I have 8 analog sensors 😞

    Still, for now I have the PCBs with the ProMini, so I'll try to strip down the Sensor or SensorMQ classes for my own use.


  • Hardware Contributor

    @nca78 Two more things popped up with the latest development version of NodeManager:

    • In NodeManager.ino: function void before(): The sample code to set the child id of a child is sht.children.get(1)->child_id = 5, but that does not work, because at that point the children are not yet even generated. They are created by the node.before(); call at the very end of the function... So, currently this will not assign any new child ID and the default IDs will be used. I have not checked in detail whether calling node.before() at the beginning of the before() function and then assigning child_id to the children will solve the issue. From a quick look at the code, it might work...
    • I'm trying to implement an OLED display, where the node would wake up every 5 seconds, take a measurement and display it on the OLED. But the report interval to the MySensors gateway should only be 10 minutes. I thought that
      node.setSleepSeconds(5); node.setReportIntervalMinutes(10); would be the correct way to setup NodeManager to take measurements every 5 seconds, but only report it every 10 minutes to the network. Unfortunately, Sensor::loop(MyMessage* message) seems to immediately return without measurement if the reporting timer has not elapsed. Somehow I don't understand that logic. Why have different sleep and reporting intervals when measurements will only be taken at reporting intervals anyway? I would expect measurements to be taken with the sleep intervals (e.g. to calculate an average over the whole reporting interval) and report back to the network using report intervals.

  • Contest Winner

    @reinhold thanks for reporting this issue. One of the main objectives of the new architecture was to reduce the memory footprint so if this is not the case, there is definitely something to fix. I've noticed in your sketch you are using the remote configuration sensor, that one is huge in terms of memory, if not strictly required I'd comment it out (BTW very nice project!). In PR #229 I've also uploaded a spreadsheet with all tests I run for realizing what was using the memory the most. Anyway, there is still a lot of room for improvement looks like πŸ™‚
    Thanks @mfalkvidd , I'll give the directives you pointed out a try!


  • Contest Winner

    @reinhold you're right, assigning the child_id before calling node.before() does not work. The way to go would be to have all the methods being called before node.before() and the child_id assigned just after. Not very intuitive, I probably need to find a completely different and a better way to do so, probably by creating the Child in the constructor instead (reopening https://github.com/mysensors/NodeManager/issues/198 for this).

    Regarding setSleep and setReportInterval, measurement are driven only by setReportInterval. Those are different because there are situations (e.g. relays, motion sensors) when you have nothing to report but you want the capture the heartbeat from sleep(). What you are looking for is something I never considered which is actually a pretty nice idea (taking measurements over a given time period and than reporting at the end). I've created https://github.com/mysensors/NodeManager/issues/243 for this. With the new architecture, since keeping already track of the average within Child, should not be so difficult even if would probably require an additional Timer. Thanks!


  • Hardware Contributor

    @user2684 Thanks for the spreadsheet with your memory footprints. Are these the sketch size and the free memory that the compiler reports? Or do you measure them when running the sketch (i.e. including all dynamically allocated variables in SRAM)?

    Also, one problem you don't seem to have covered is heap fragmentation. Particularly your new List class seems to be prone to heap fragmentation with a large number of sensors: each time a sensor is added, the list needs to re-allocate the memory for its pointers. The old memory will be released, but it will remain as a hole in the memory, where new variables might be allocated. However, the next time you add an element to the list, the new pointer array can probably not re-use some of those freed holes.
    I'll provide a PR (https://github.com/mysensors/NodeManager/pull/247) that adds an allocateBlocks(count) method to the List, which can be used in the sketch and in the sensor's onSetup methods to pre-allocate the required sized. In turn, the _preAllocBlocks member does currently not serve any purpose, and I don't think it's really required functionality. In my eyes, it's more important to ensure that at a certain moment the required memory is allocated. It is not neccessary to keep a minimum nuber of blocks allocated at all times.
    For a node with 10 physical sensors (and maybe one or more built-in sensors), this will save at least 22 bytes (1,1% of total SRAM!) and probably reduce heap fragmentation by quite a bit.

    Another are where >22 bytes can be saved is the power manager. None of my nodes makes use of the power manager, yet each sensor needs to keep a (null) pointer to a power manager. Providing a compiler #define NO_MODULE_POWER_MANAGER can exclude everything PowerManager-related from compilation and save one pointer per sensor and node, i.e. with 10 sensors you'll save another 22 bytes (1,1% of total SRAM!) I'll provide a PR for this, too: https://github.com/mysensors/NodeManager/pull/248

    Apart from that, I simply stripped down the SensorMQ class and removed all configurability for my own use (don't worry, I won't submit this as a pull request... it is simply meant to squeeze the sketch onto the pro mini with the boards that I have already built).
    BTW, the SensorConfiguration is no problem as far as SRAM is concerned (it just adds the normal SRAM footprint of a Sensor instance): It has no class members of its own. Only the flash size is considerable, but for me this is not the issue, I'm running out of SRAM.


  • Contest Winner

    @reinhold I measured only what the compiler reported. Main focus was to reduce the flash size, I honestly ignored any potential SRAM issues which is bad πŸ™‚ Thanks for the hit and for the great contributions and PRs so far. You're right about the List class and especially when the number of items is known, there is not reason why not allocating the blocks beforehand. I will merge your changes as they are and then take it back and adjust something (e.g. make the number of block you are passing to "node" optional, moving child creation into the constructor, always allocating the blocks for children in each sensor, generalizing a bit more the NO_MODULE thing etc.). Thanks again!


  • Contest Winner

    Hi, for those looking for making NodeManager time aware (with and without an attached RTC), this capability has been added to the development branch through https://github.com/mysensors/NodeManager/pull/259 and it is of course transparent to the end user. When this feature is enabled, also, the node resumes the remainder sleep time when woken up by an interrupt and allows SensorPulseMeter and subclasses to support sleep mode. Thanks


  • Plugin Developer

    @user2684 Great news! I will give that a try shortly.



  • The SensorSwitch/Door/Motion all work on interrupt pins only ? Sorry if I've misunderstood the code, thats possible.

    Anyway I've made a few changes so that busywait, if thats what they are called buttons can be also used. I'll see if I can use git somehow to share the changes, or show them at least

    Great library, looking to convert other things to use this.



  • Great code, another question.

    For the SensorDimmer, each sensor has only one type set so a dimmer can't receive v_status & v_percentage messages.

    I've worked around this by registering two sensors at the same Analog out pin. But they don't then have access in a nice way to the status of each other as values are changed. So if I turn the led on/off via the v_status message I can't preserve the previous percentage, set by the other v_percentage sensor.

    Is this normal ? I'm new to all this but at least mycontroller lets you specify for a single sensor both v_status,v_percentage so both types of messages can be sent and processed in onRecieve()...

    Perhaps some enhancement on the SensorDimmer class could do this ? in ModeManager.cpp (if (message.type != _type) return;) inside Sensor::recieve.... isn't that too restrictive ?


  • Contest Winner

    @rfm69 yes, they are all interrupt-based. Reason is they would need to be functional either when sleeping or not so I went for this approach. If you need an example of such a sensor not interrupt-based, have a look at the SensorSonoff, it is using a different approach for handling the button. Thanks


  • Contest Winner

    @rfm69 you're right, this also came out a while ago. I was sure we had an associated issue on github for this but it doesn't look like. Here's the new issue for your reference https://github.com/mysensors/NodeManager/issues/296. Implementing this in v1.6 is really challenging but with the new v1.7 architecture of the development branch should be way easier since all the children share the same variables. Thanks!



  • @user2684 Thanks, I've implemented something myself with changes to the library, just playing around to understand it better. But will look at the SensorSonoff you mention.

    Thanks again, its a great library.

    Had a quick look at 1.7 dev branch πŸ™‚ is this ready for using already, testing or trying, or have you got more to do before its refactored etc ? I was interested in looking what the changes in architecture were.


  • Contest Winner

    @rfm69 v1.7 is still not completed but theoretically fully functional and with most of the architectural changes already done (https://github.com/mysensors/NodeManager/milestone/9 for the full list of things still to be completed and those already implemented). For sure safe to be tested out! Thanks


  • Contest Winner

    @rfm69 for your SensorDimmer request, feel free to give v1.7-dev a try from here https://github.com/mysensors/NodeManager/tree/development. Details on the implementation of your request can be found at https://github.com/mysensors/NodeManager/pull/302. Thanks


  • 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 in the sensebender sketch we turn on digital pin 7 to provide power to the LDR to read it.
    i have many sensors in my house and would rather not re-wire all of them.
    how can i add this cleanly in nodemgr to make it work as before?
    pinMode(7, OUTPUT); // β€œpower pin” for Light Sensor
    digitalWrite(7, LOW); // switch power off

    Thanks!


  • Contest Winner

    @mvader thanks for the feedback, I've added this issue on Github so to fix this in the next dev release https://github.com/mysensors/NodeManager/issues/344



  • @user2684 said in πŸ’¬ NodeManager:

    @mvader thanks for the feedback, I've added this issue on Github so to fix this in the next dev release https://github.com/mysensors/NodeManager/issues/344

    Thanks!! here is the setup and loop part from the sketch

    setup
    pinMode(7, OUTPUT); // β€œpower pin” for Light Sensor
    digitalWrite(7, LOW); // switch power off
    
    loop
      digitalWrite(7, HIGH); // switch power on to LDR
      sendLight(forceTransmit);
      digitalWrite(7, LOW); // switch power off to LDR
    
    and the function
    /*
     * Sends Ambient Light Sensor information
     * 
     * Parameters
     * - force : Forces transmission of a value
     */
    
    void sendLight(bool force) // Get light level
    {
      if (force) lastLightLevel = -1;
      int rlightLevel =  analogRead(LIGHT_PIN);
      int lightLevel =  (analogRead(LIGHT_PIN) / 10.23) ;
      if (lightLevel != lastLightLevel) {
       gw.send(msgLight.set(lightLevel));
        lastLightLevel = lightLevel;
      }
    


  • Hi, I am starting with MySensors and I read about the NodeManager. But I have a problem with starting with the nodemanager. I tried to make a node with a BMP280 sensor and a NRF24. Every time I tried I got the following error message
    when compiling (nodemanager actual version, arduino IDE1.8.5). Even no other sensor works.

    What is the reason, can anyone help me?

    Arduino: 1.8.5 (Windows 10), Board: "Arduino Nano, ATmega328P"
    
    ....
    ....
    "C:\Users\Radfedfdf\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\RADFE~1\AppData\Local\Temp\arduino_build_123539\core\core.a" "C:\Users\RADFE~1\AppData\Local\Temp\arduino_build_123539\core\main.cpp.o"
    "C:\Users\Radfedfdf\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs  "C:\Users\RADFE~1\AppData\Local\Temp\arduino_build_123539\core\core.a" "C:\Users\RADFE~1\AppData\Local\Temp\arduino_build_123539\core\new.cpp.o"
    Archiving built core (caching) in: C:\Users\RADFE~1\AppData\Local\Temp\arduino_cache_196944\core\core_arduino_avr_nano_cpu_atmega328_2c22347d3c992515700a8fa0ae8526cf.a
    Linking everything together...
    "C:\Users\Radfedfdf\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p  -o "C:\Users\RADFE~1\AppData\Local\Temp\arduino_build_123539/NodeManager.ino.elf" "C:\Users\RADFE~1\AppData\Local\Temp\arduino_build_123539\sketch\NodeManager.ino.cpp.o" "C:\Users\RADFE~1\AppData\Local\Temp\arduino_build_123539\libraries\SPI\SPI.cpp.o" "C:\Users\RADFE~1\AppData\Local\Temp\arduino_build_123539\libraries\Wire\Wire.cpp.o" "C:\Users\RADFE~1\AppData\Local\Temp\arduino_build_123539\libraries\Wire\utility\twi.c.o" "C:\Users\RADFE~1\AppData\Local\Temp\arduino_build_123539\libraries\Adafruit_BMP280_Library-master\Adafruit_BMP280.cpp.o" "C:\Users\RADFE~1\AppData\Local\Temp\arduino_build_123539/core\core.a" "-LC:\Users\RADFE~1\AppData\Local\Temp\arduino_build_123539" -lm
    C:\Users\RADFE~1\AppData\Local\Temp\cc796L4N.ltrans1.ltrans.o: In function `receive(MyMessage const&)':
    
    C:\Users\RADFE~1\AppData\Local\Temp\arduino_modified_sketch_106015/NodeManager.ino:433: undefined reference to `NodeManager::receive(MyMessage const&)'
    
    C:\Users\RADFE~1\AppData\Local\Temp\cc796L4N.ltrans1.ltrans.o: In function `loop':
    
    C:\Users\RADFE~1\AppData\Local\Temp\arduino_modified_sketch_106015/NodeManager.ino:426: undefined reference to `NodeManager::loop()'
    
    C:\Users\RADFE~1\AppData\Local\Temp\cc796L4N.ltrans1.ltrans.o: In function `setup':
    
    C:\Users\RADFE~1\AppData\Local\Temp\arduino_modified_sketch_106015/NodeManager.ino:420: undefined reference to `NodeManager::setup()'
    
    C:\Users\RADFE~1\AppData\Local\Temp\cc796L4N.ltrans1.ltrans.o: In function `presentation()':
    
    C:\Users\RADFE~1\AppData\Local\Temp\arduino_modified_sketch_106015/NodeManager.ino:414: undefined reference to `NodeManager::presentation()'
    
    C:\Users\RADFE~1\AppData\Local\Temp\cc796L4N.ltrans1.ltrans.o: In function `before()':
    
    C:\Users\RADFE~1\AppData\Local\Temp\arduino_modified_sketch_106015/NodeManager.ino:408: undefined reference to `NodeManager::before()'
    
    C:\Users\RADFE~1\AppData\Local\Temp\cc796L4N.ltrans1.ltrans.o: In function `__static_initialization_and_destruction_0':
    
    C:\Users\RADFE~1\AppData\Local\Temp\arduino_modified_sketch_106015/NodeManager.ino:313: undefined reference to `NodeManager::NodeManager(int)'
    
    C:\Users\RADFE~1\AppData\Local\Temp\arduino_modified_sketch_106015/NodeManager.ino:351: undefined reference to `SensorBMP280::SensorBMP280(NodeManager&, int)'
    
    C:\Users\RADFE~1\AppData\Local\Temp\cc796L4N.ltrans1.ltrans.o: In function `_GLOBAL__sub_D__Z6hwInitv':
    
    C:\Users\Radfedfdf\Documents\Arduino\libraries\NodeManager_Library/NodeManagerLibrary.h:564: undefined reference to `vtable for Sensor'
    
    C:\Users\Radfedfdf\Documents\Arduino\libraries\NodeManager_Library/NodeManagerLibrary.h:564: undefined reference to `vtable for Sensor'
    
    collect2.exe: error: ld returned 1 exit status
    
    Mehrere Bibliotheken wurden fΓΌr "Adafruit_BMP280.h" gefunden
     Benutzt: C:\Users\Radfedfdf\Documents\Arduino\libraries\Adafruit_BMP280_Library-master
     Nicht benutzt: C:\Users\Radfedfdf\Documents\Arduino\libraries\Adafruit_BMP280_Library
    Bibliothek NodeManager_Library im Ordner: C:\Users\Radfedfdf\Documents\Arduino\libraries\NodeManager_Library (legacy) wird verwendet
    Bibliothek MySensors in Version 2.2.0 im Ordner: C:\Users\Radfedfdf\Documents\Arduino\libraries\MySensors  wird verwendet
    Bibliothek SPI in Version 1.0 im Ordner: C:\Users\Radfedfdf\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\libraries\SPI  wird verwendet
    Bibliothek Wire in Version 1.0 im Ordner: C:\Users\Radfedfdf\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\libraries\Wire  wird verwendet
    Bibliothek Adafruit_Unified_Sensor in Version 1.0.2 im Ordner: C:\Users\Radfedfdf\Documents\Arduino\libraries\Adafruit_Unified_Sensor  wird verwendet
    Bibliothek Adafruit_BMP280_Library-master in Version 1.0.2 im Ordner: C:\Users\Radfedfdf\Documents\Arduino\libraries\Adafruit_BMP280_Library-master  wird verwendet
    UngΓΌltige Bibliothek C:\Users\Radfedfdf\Documents\Arduino\libraries\NodeManager_mod in C:\Users\Radfedfdf\Documents\Arduino\libraries\NodeManager_mod gefunden
    exit status 1
    Fehler beim Kompilieren fΓΌr das Board Arduino Nano.
    

  • Contest Winner

    @cpl_ir super weird, looks like the linker cannot find NodeManager's object file. Are you sure all NodeManager's files are within the same directory? NodeManager cannot be installed as a standard Arduino's library but all the files need to be in the same directory of your main sketch. Thanks!



  • Hello, I have been experimenting with the door sensor example and have configured to wake up every hour to send a battery voltage (V_VOLTAGE)
    It will also wake whenever the interrupt state on the switch pin changes. I noticed that when the node wakes up with an interrupt it seems to send three events:
    I_POST_SLEEP_NOTIFICATION
    V_TRIPPED (this is the important one)
    I_PRE_SLEEP_NOTIFICATION
    this is all good, however for my application it would be useful if it were to also send a V_VOLTAGE battery measurement along with the V_TRIPPED event.
    I'm not yet completely familiar with how the nodemanager sketch links together, but is it possible for the sensor readings for all sensors to be sent on an interrupt from any other sensor so I can make use of the radio as much as possible?


  • Contest Winner

    @arthurdented the I_POST_SLEEP_NOTIFICATION and I_PRE_SLEEP_NOTIFICATION are due to smart sleep which is on by default. Regarding the V_VOLTAGE I think what it comes closer to your need would be a SensorBattery configured with a very short reporting interval but regardless, when an interrupt occurs, no sensors other than the one associated with the interrupt would execute their main function. For your specific use case you can try changing or tweaking the condition at this line to make it working in the way you need: https://github.com/mysensors/NodeManager/blob/master/NodeManagerLibrary.ino#L4700



  • can anyone explain me the signal node? i get this values with setReportIntervalSeconds(1);

    271860 TSF:MSG:SEND,1-1-0-0,s=202,c=1,t=37,pt=5,l=4,sg=0,ft=0,st=OK:4294967260
    272947 TSF:MSG:SEND,1-1-0-0,s=202,c=1,t=37,pt=5,l=4,sg=0,ft=0,st=OK:4294967260
    274033 TSF:MSG:SEND,1-1-0-0,s=202,c=1,t=37,pt=5,l=4,sg=0,ft=0,st=OK:4294967260
    275120 TSF:MSG:SEND,1-1-0-0,s=202,c=1,t=37,pt=5,l=4,sg=0,ft=0,st=OK:4294967260
    276206 TSF:MSG:SEND,1-1-0-0,s=202,c=1,t=37,pt=5,l=4,sg=0,ft=0,st=OK:4294967260
    277293 TSF:MSG:SEND,1-1-0-0,s=202,c=1,t=37,pt=5,l=4,sg=0,ft=0,st=OK:4294967260
    278378 TSF:MSG:SEND,1-1-0-0,s=202,c=1,t=37,pt=5,l=4,sg=0,ft=0,st=OK:4294967260
    279468 TSF:MSG:SEND,1-1-0-0,s=202,c=1,t=37,pt=5,l=4,sg=0,ft=0,st=OK:4294967260
    280554 TSF:MSG:SEND,1-1-0-0,s=202,c=1,t=37,pt=5,l=4,sg=0,ft=0,st=OK:4294967259
    281641 TSF:MSG:SEND,1-1-0-0,s=202,c=1,t=37,pt=5,l=4,sg=0,ft=0,st=OK:4294967259
    282728 TSF:MSG:SEND,1-1-0-0,s=202,c=1,t=37,pt=5,l=4,sg=0,ft=0,st=OK:4294967259
    283812 TSF:MSG:SEND,1-1-0-0,s=202,c=1,t=37,pt=5,l=4,sg=0,ft=0,st=OK:4294967259
    284898 TSF:MSG:SEND,1-1-0-0,s=202,c=1,t=37,pt=5,l=4,sg=0,ft=0,st=OK:4294967260
    


  • is there a possibilty to only send values if the value has changed?


  • Contest Winner

    @felix-haverkamp the signal node is supposed to send the RSSI when the radio supports it. What you are looking at is a v1.7 bug, fixed in the dev branch of v1.8. If you want an easy fix without the need to upgrade, just remove the uint32_t cast at line 5017 of NodeManagerLibrary.ino (https://github.com/mysensors/NodeManager/blob/master/NodeManagerLibrary.ino#L5017).
    To send the values only if the value has changed, you need first of all to turn FEATURE_CONDITIONAL_REPORT on, then you can use setValueDelta() and setForceUpdateMinutes() of the Child class to achieve what you are looking for



  • @user2684
    thx, that is what was what i am looking for.



  • @user2684
    FEATURE_CONDITIONAL_REPORT & setValueDelta()

    would be nice for other users to document this function. With this i am able to only send values to the gateway when its changed. Using it for a Light Sensor and dont need the value every 10 seconds and not every 10 Minutes....
    Just when it changes (1 second) and only when it changes.


  • Contest Winner

    @felix-haverkamp if you set setValueDelta() to e.g. 0.1 or 0.01, then the sensor will not report if the value has not changed, if I have understood correctly your point. setValueDelta() will set the minimum difference (+ or -) that the new value should have in order to be reported. Let me know I've misunderstood something. Thanks



  • @user2684 i just mean, we have to put this is the documentation.

    currently i have a strange problem:

    the Motion Sensors doesnt reset. I checked with my old Motion sketch and everything is fine.
    Only sends the Value "1".

    11132 TSF:MSG:SEND,1-1-0-0,s=2,c=1,t=16,pt=5,l=4,sg=0,ft=0,st=OK:1
    16513 TSF:MSG:SEND,1-1-0-0,s=2,c=1,t=16,pt=5,l=4,sg=0,ft=0,st=OK:1
    26243 TSF:MSG:SEND,1-1-0-0,s=2,c=1,t=16,pt=5,l=4,sg=0,ft=0,st=OK:1


  • Contest Winner

    @felix-haverkamp got it, thanks, I've opened this issue https://github.com/mysensors/NodeManager/issues/366.

    Regarding the sensor motion, weird, by default should attach to CHANGE interrupt so to intercept both. Any chance to share NodeManager's debug log as well? Thanks



  • @user2684
    i think conditional report is the problem:

    #define FEATURE_CONDITIONAL_REPORT ON

    without it works fine.


  • Contest Winner

    Every new version of NodeManager, I try to review and hopefully improve its architecture. This time looked like a simple and quick task but eventually ended up in a complete and deep review of the code. Many many many things have changed with the main objective to better integrate with the MySensors library and simplify the life of users willing to contribute or to add support for new sensors.

    The new file structure (with a dedicated file for each supported sensor) and the way the package is delivered (as an arduino library now) go into this direction. There are also included a good amount of new features but still in most of the cases, resulting a smaller code.

    All the details are available at https://github.com/mysensors/NodeManager/pull/391 which will be merged into the development branch shortly.

    Due to the many changes, if anybody would be willing to give it a try and report any bug, would be really great. Thanks!


  • Plugin Developer

    Just wanted to say that NodeManager is awesome. I can't believe I only now really had a better look at what it is. I always thought it was some kind of software you had to install, and that it was used by professionals to manage complicated sensor nets.

    For the last few months I've been thinking "wouldn't it be useful if there was some kind of beginner friendly web interface where you could select which devices you want, and then it creates the code for you". This is so close to that. Thank you for this incredible work!


  • Contest Winner

    @alowhum many thanks for the feedback, really appreciated!



  • Is it possible to "force" send SensorDoor value regularly?

    I am using magnetic sensor together with interrupt feature but when sensor status is change too fast before main loop is finished, sensor value remains in wrong state until magnetic sensor value is physically changed again.

    So I would like to set that SensorDoor value will be set regularly like e.g. temperature sensors values. I tried to add:

    door.setReportIntervalMinutes(5);
    

    But it does not work in this case. Value is not reported based on this interval. Only way how to get SensorDoor value back to right state is physically change its value (open/close magnetic sensors).

    Btw Nodemanager is really awsome. Great work!



  • Hi, I need some advice for my following problem..:

    Situation: Arduino ist connected to an raspberry gateway with openhab -> works just fine.
    To the arduino I have connected a PIR on 3 and a photoresistor (LDR) with an 10k resistor on A0 -> works just fine.
    On first boot (after connecting etc.) the arduino sends motion status + LDR value. But after that first msg. only the motion (tripped) is send.
    What I want: I want that the arduino sleeps until there is an interrupt comming from the PIR and then sends the motion status+light value (LDR) and then sleeps again 4ever until the next interrupt.
    Problem: As I said, it only sends the light value only once.. and then never again. On the arduino debug I can see, that only motion is send:
    NodeManager v1.7
    LIB V=2.3.0 R=N E=X T=N A=A S=S B=-
    LDR I=1 P=16 T=23
    MOTION I=2 P=1 T=16
    RADIO...OK
    PRES I=1 T=16 D=LDR
    PRES I=2 T=1 D=MOTION
    READY

    MY I=5 M=255
    INT P=3, V=0
    INT P=3 M=1
    INT P=2 M=255
    MOTION I=2 P=3 V=0
    SEND D=0 I=2 C=0 T=16 S= I=0 F=0.00
    LDR I=1 V=352 %=34 <-- first an last time LDR sends it's value
    SEND D=0 I=1 C=0 T=23 S= I=0 F=0.00
    INT P=3, V=1
    MOTION I=2 P=3 V=1
    SEND D=0 I=2 C=0 T=16 S= I=0 F=0.00
    INT P=3, V=0
    MOTION I=2 P=3 V=0
    SEND D=0 I=2 C=0 T=16 S= I=0 F=0.00
    ...
    Hope you can help me 😬 many thanks in advance πŸ™‚

    // General settings
    #define SKETCH_NAME "Test2"
    #define SKETCH_VERSION "1.0"
    //#define MY_DEBUG
    
    // NRF24 radio settings
    #define MY_RADIO_NRF24
    #define MY_SIGNING_SIMPLE_PASSWD "xxx"
    #define MY_ENCRYPTION_SIMPLE_PASSWD "xxx" 
    #define MY_RF24_PA_LEVEL RF24_PA_HIGH
    #define MY_RF24_CHANNEL (124)
    
    // Advanced settings
    #define MY_BAUD_RATE 9600
    //#define MY_SMART_SLEEP_WAIT_DURATION_MS 500
    #define MY_SPLASH_SCREEN_DISABLED
    
    /***********************************
     * NodeManager modules for supported sensors
     */
    #define USE_ANALOG_INPUT
    #define USE_INTERRUPT
    /***********************************
     * NodeManager built-in features
     */
    
    // Enable/disable NodeManager's features
    #define FEATURE_DEBUG ON
    #define FEATURE_POWER_MANAGER OFF
    #define FEATURE_INTERRUPTS ON
    #define FEATURE_CONDITIONAL_REPORT OFF
    #define FEATURE_EEPROM OFF
    #define FEATURE_SLEEP ON
    #define FEATURE_RECEIVE OFF
    #define FEATURE_TIME OFF
    #define FEATURE_RTC OFF
    #define FEATURE_SD OFF
    #define FEATURE_HOOKING OFF
    
    /***********************************
     * Load NodeManager Library
     */
    #include "NodeManagerLibrary.h"
    NodeManager node;
    /***********************************
     * Add your sensors below
     */
    // Attached sensors
    SensorLDR ldr(node,A0);
    //SensorInterrupt interrupt(node,3);
    SensorMotion motion(node,3);
    /***********************************
     * Main Sketch
     */
    
    // before
    void before() {
      // setup the serial port baud rate
      Serial.begin(MY_BAUD_RATE);
      /*
      * Configure your sensors below
      */
      node.setReportIntervalSeconds(10);
      node.setSleepSeconds(60);
      /*
      * Configure your sensors above
      */
      node.before();
    }
    
    // presentation
    void presentation() {
      // call NodeManager presentation routine
      node.presentation();
    }
    
    // setup
    void setup() {
      // call NodeManager setup routine
      node.setup();
    }
    
    // loop
    void loop() {
      // call NodeManager loop routine
      node.loop();
    }
    
    #if FEATURE_RECEIVE == ON
    // receive
    void receive(const MyMessage &message) {
      // call NodeManager receive routine
      node.receive(message);
    }
    #endif
    
    #if FEATURE_TIME == ON
    // receiveTime
    void receiveTime(unsigned long ts) {
      // call NodeManager receiveTime routine
      node.receiveTime(ts);
    }
    #endif
    


  • @fausti
    ok, I have solved it myself - the PIR made all that trouble.
    I did connect the PIR on 3.3V (similar to https://forum.mysensors.org/uploads/upload-4bdca27e-3c36-4c68-9e54-947b9f4717b4.jpg).

    Problem was, that when arduino wakes up the radio, the power drop would kinda restart the PIR, which causes an interrupt. Think a similar problem was discussed here:
    https://forum.mysensors.org/topic/6511/hc-sr501-3-3v-randomly-sends-tripped-when-radio-is-on

    Anyways - you surly would have helped, if i would not have found it. Great forum! πŸ™‚


  • Contest Winner

    @jiri-hron I think you can achieve what you need by using FEATURE_TIME. In this way when woken up, NodeManager will go back to sleep only for the remainder time left. Not ideal but I couldn't find a better way to understand for how long the node has been sleeping before the interrupt.



  • It looks like there is a limit of 1 type of each sensor. Is there a way to modify this?

    My use-case is a french sliding glass door. I would like to use a single node with 2 magnetic sensors (one on each end of the node) with the node mounted in the middle of the door, so that if either side is moved the interrupt is triggered.


  • Contest Winner

    @iteafreely your understanding is correct. I see two options here: you can either create a new custom sensor inheriting from SensorDoor and adding an additional child and the extra logic you require or create two instances of SensorDoor and playing with hooking functions to make one checking on the other. In this latter case you probably need some additional variables to keep track of the status.


  • Hardware Contributor

    @iteafreely I don't think there is a limit of one sensor per type, not even for interrupts like door sensors. You just need to make sure you are using different pins and different child ids for the two magnetic sensors. I'm using 8 analog sensors (MQ-... gas sensors) on eight different pins on the same node and it works just fine.

    Of course, if you need some interdependence on what the two magnetic sensors report, then you must follow @user2684's suggestion of creating a custom sensor (a C++ class derived from an existing sensor class).
    But if you simply want two independent magnetic sensors (for each of the ends of your sliding door), then you can simply create two instances of SensorDoor on two different pins (here pins 3 and 4) and different hardcoded child_id (1 and 2 in this case):

    SensorDoor doorLeft(node,3,1);
    SensorDoor doorRight(node, 4,2);
    

    Unfortunately, both of them will report to the gateway with name "DOOR" (and there's no way to change it without subclassing SensorDoor), but they will have a different child_id 1 and 2 to distinguish the two values sent by the node.

    You can then use your smart home controller to handle the two door sensors like one.



  • @iteafreely Not sure of software issues as I don't use NodeManager, but your use-case indicates you do not need to know which door is opened, only that one or both is/are.
    If by magnetic sensor you mean magnet/reed, would a single reed where both doors meet, or two reeds (one on each door end) wired in parallel, to a single interrupt pin not provide this?


  • Contest Winner

    @reinhold just for completeness, that "DOOR" can be customized too by calling setDescription() of the (only) child of the SensorDoor instance. Thanks!


  • Hardware Contributor

    @user2684 Right, thanks for pointing this out. I mixed up the child name that was sent to the controller (which can be changed by e.g.

    void before() {
     ...
      doorLeft.children.get(1)->setDescription("Door Left");
      doorRight.children.get(1)->setDescription("Door Right");
      node.before();
    }
    

    ) and the sensor's _name field, which is printed to the debug output. That "DOOR" debug output cannot be changed without subclassing. But as this is just debug output, it's just a minor nuissance.


  • Contest Winner

    @reinhold oh you're right I didn't even noticed that DOOR would show up in the debug output, thanks. Anyway with v1.8-dev this should have gone since debug output has been completely re-worked (and made compatible with https://www.mysensors.org/build/parser). Thanks



  • hello, I wanted to use the function for FEATURE_CONDITIONAL_REPORT for an LDR sensor but except a value when starting the arduino, no more values are transferred, must be configured for the function specifically something? Node manager 1.8dev


  • Contest Winner

    @mhofer a few issues came out with conditional reporting during some recent tests, https://github.com/mysensors/NodeManager/pull/430 just merged into development should have solved them. Could you please give it a try? Thanks!


  • Contest Winner

    Hello all, NodeManager v1.8 is almost ready and likewise with the previous releases I like to give brave users a few weeks to test it out before actually releasing it. If you are one of those, download it from https://github.com/mysensors/NodeManager/tree/development; for a full list of changes, have a look at https://github.com/mysensors/NodeManager/projects/2.

    Of course feel free to open a ticket on Github for any issue you could come across. Thanks!



  • Re: πŸ’¬ NodeManager

    Hi @user2684,
    Hi all,

    First a great compliment for this work! This should make things just easy, but...
    It doesn't work for me. I have Ethernet Gateway and a 1wire Tempsensor node. Both flashed with the sketches from tutorials found on the mysensors.org website. Those are working without any problem.

    Now I have Tsl2561 Lux sensor. This is supported by nodemanager. Just downloaded the latest dev version uncommented two lines as expected, but it the node won't appear.

    The sketch looks as followed

    /*
    * 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 99
    
    // NRF24 radio settings
    #define MY_RADIO_NRF24
    //#define MY_RF24_ENABLE_ENCRYPTION
    //#define MY_RF24_CHANNEL 125
    //#define MY_RF24_PA_LEVEL RF24_PA_HIGH
    //#define MY_DEBUG_VERBOSE_RF24
    //#define MY_RF24_DATARATE RF24_250KBPS
    
    // RFM69 radio settings
    //#define MY_RADIO_RFM69
    //#define MY_RFM69_FREQUENCY RFM69_433MHZ
    //#define MY_IS_RFM69HW
    //#define MY_RFM69_NEW_DRIVER
    //#define MY_RFM69_ENABLE_ENCRYPTION
    //#define MY_RFM69_NETWORKID 100
    //#define MY_DEBUG_VERBOSE_RFM69
    //#define MY_RF69_IRQ_PIN D1
    //#define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
    //#define MY_RF69_SPI_CS D2
    //#define MY_RFM69_ATC_MODE_DISABLED
    
    // RFM95 radio settings
    //#define MY_RADIO_RFM95
    //#define MY_RFM95_FREQUENCY (RFM95_868MHZ)
    //#define MY_DEBUG_VERBOSE_RFM95
    //#define MY_RFM95_MAX_POWER_LEVEL_DBM (20)
    //#define MY_RFM95_IRQ_PIN D1
    //#define MY_RFM95_IRQ_NUM MY_RFM95_IRQ_PIN
    //#define MY_RFM95_CS_PIN D8
    
    // RS485 serial transport settings
    //#define MY_RS485
    //#define MY_RS485_BAUD_RATE 9600
    //#define MY_RS485_DE_PIN 2
    //#define MY_RS485_MAX_MESSAGE_LENGTH 40
    //#define MY_RS485_HWSERIAL Serial1
    
    // Message signing settings
    //#define MY_SIGNING_SOFT
    //#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
    //#define MY_SIGNING_REQUEST_SIGNATURES
    //#define MY_SIGNING_ATSHA204
    //#define MY_SIGNING_ATSHA204_PIN 4
    //#define MY_SIGNING_REQUEST_SIGNATURES
    
    // OTA Firmware update settings
    //#define MY_OTA_FIRMWARE_FEATURE
    //#define OTA_WAIT_PERIOD 300
    //#define FIRMWARE_MAX_REQUESTS 2
    //#define MY_OTA_RETRY 2
    
    // OTA debug output
    //#define MY_DEBUG_OTA (0)
    //#define MY_OTA_LOG_SENDER_FEATURE
    //#define MY_OTA_LOG_RECEIVER_FEATURE
    //#define MY_DEBUG_OTA_DISABLE_ACK
    
    // Advanced settings
    #define MY_BAUD_RATE 9600
    //#define MY_SMART_SLEEP_WAIT_DURATION_MS 500
    #define MY_SPLASH_SCREEN_DISABLED
    //#define MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
    //#define MY_SIGNAL_REPORT_ENABLED
    
    // Optimizations when running on 2032 Coin Cell. Also set nodeManager.setSleepBetweenSend(500) and run the board at 1Mhz
    //#define MY_TRANSPORT_UPLINK_CHECK_DISABLED
    //#define MY_TRANSPORT_WAIT_READY_MS  5000
    //#define MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS 2000
    //#define MY_PARENT_NODE_ID 0
    //#define MY_PARENT_NODE_IS_STATIC
    
    /**********************************
     * MySensors gateway configuration
     */
     
    // Common gateway settings
    //#define MY_REPEATER_FEATURE
    
    // Serial gateway settings
    //#define MY_GATEWAY_SERIAL
    
    // Ethernet gateway settings
    //#define MY_GATEWAY_W5100
    
    // ESP8266 gateway settings
    //#define MY_GATEWAY_ESP8266
    //#define MY_ESP8266_SSID ""
    //#define MY_ESP8266_PASSWORD ""
    
    // Gateway networking settings
    //#define MY_IP_ADDRESS 192,168,178,87
    //#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
    //#define MY_IP_SUBNET_ADDRESS 255,255,255,0
    //#define MY_PORT 5003
    //#define MY_GATEWAY_MAX_CLIENTS 2
    //#define MY_USE_UDP
    
    // Gateway MQTT settings
    //#define MY_GATEWAY_MQTT_CLIENT
    //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68
    //#define MY_PORT 1883
    //#define MY_MQTT_USER "username"
    //#define MY_MQTT_PASSWORD "password"
    //#define MY_MQTT_CLIENT_ID "mysensors-1"
    //#define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
    //#define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
    
    // Gateway inclusion mode
    //#define MY_INCLUSION_MODE_FEATURE
    //#define MY_INCLUSION_BUTTON_FEATURE
    //#define MY_INCLUSION_MODE_DURATION 60
    //#define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Gateway Leds settings
    //#define MY_DEFAULT_ERR_LED_PIN 4
    //#define MY_DEFAULT_RX_LED_PIN  5
    //#define MY_DEFAULT_TX_LED_PIN  6
    
    /***********************************
     * NodeManager configuration
     */
    
    #define NODEMANAGER_DEBUG ON
    #define NODEMANAGER_INTERRUPTS ON
    #define NODEMANAGER_SLEEP OFF
    #define NODEMANAGER_RECEIVE OFF
    #define NODEMANAGER_DEBUG_VERBOSE ON
    #define NODEMANAGER_POWER_MANAGER OFF
    #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/SensorAnalogInput.h>
    //SensorAnalogInput analog(A0);
    
    //#include <sensors/SensorLDR.h>
    //SensorLDR ldr(A0);
    
    //#include <sensors/SensorRain.h>
    //SensorRain rain(A0);
    
    //#include <sensors/SensorSoilMoisture.h>
    //SensorSoilMoisture soil(A0);
    
    //#include <sensors/SensorThermistor.h>
    //SensorThermistor thermistor(A0);
    
    //#include <sensors/SensorML8511.h>
    //SensorML8511 ml8511(A0);
    
    //#include <sensors/SensorACS712.h>
    //SensorACS712 acs712(A0);
    
    //#include <sensors/SensorDigitalInput.h>
    //SensorDigitalInput digitalIn(6);
    
    //#include <sensors/SensorDigitalOutput.h>
    //SensorDigitalOutput digitalOut(6);
    
    //#include <sensors/SensorRelay.h>
    //SensorRelay relay(6);
    
    //#include <sensors/SensorLatchingRelay1Pin.h>
    //SensorLatchingRelay1Pin latching1pin(6);
    
    //#include <sensors/SensorLatchingRelay2Pins.h>
    //SensorLatchingRelay2Pins latching2pins(6,7);
    
    //#include <sensors/SensorDHT11.h>
    //SensorDHT11 dht11(6);
    
    //#include <sensors/SensorDHT22.h>
    //SensorDHT22 dht22(6);
    
    //#include <sensors/SensorSHT21.h>
    //SensorSHT21 sht21;
    
    //#include <sensors/SensorHTU21D.h>
    //SensorHTU21D htu21;
    
    //#include <sensors/SensorInterrupt.h>
    //SensorInterrupt interrupt(3);
    
    //#include <sensors/SensorDoor.h>
    //SensorDoor door(3);
    
    //#include <sensors/SensorMotion.h>
    //SensorMotion motion(3);
    
    //#include <sensors/SensorDs18b20.h>
    //SensorDs18b20 ds18b20(6);
    
    //#include <sensors/SensorBH1750.h>
    //SensorBH1750 bh1750;
    
    //#include <sensors/SensorMLX90614.h>
    //SensorMLX90614 mlx90614;
    
    //#include <sensors/SensorBME280.h>
    //SensorBME280 bme280;
    
    //#include <sensors/SensorBMP085.h>
    //SensorBMP085 bmp085;
    
    //#include <sensors/SensorBMP180.h>
    //SensorBMP180 bmp180;
    
    //#include <sensors/SensorBMP280.h>
    //SensorBMP280 bmp280;
    
    //#include <sensors/SensorSonoff.h>
    //SensorSonoff sonoff;
    
    //#include <sensors/SensorHCSR04.h>
    //SensorHCSR04 hcsr04(6,7);
    
    //#include <sensors/SensorMCP9808.h>
    //SensorMCP9808 mcp9808;
    
    //#include <sensors/SensorMQ.h>
    //SensorMQ mq(A0);
    
    //#include <sensors/SensorMHZ19.h>
    //SensorMHZ19 mhz19(6,7);
    
    //#include <sensors/SensorAM2320.h>
    //SensorAM2320 am2320;
    
    #include <sensors/SensorTSL2561.h>
    SensorTSL2561 tsl2561;
    
    //#include <sensors/SensorPT100.h>
    //SensorPT100 pt100(6);
    
    //#include <sensors/SensorDimmer.h>
    //SensorDimmer dimmer(3);
    
    //#include <sensors/SensorRainGauge.h>
    //SensorRainGauge rainGauge(3);
    
    //#include <sensors/SensorPowerMeter.h>
    //SensorPowerMeter powerMeter(3);
    
    //#include <sensors/SensorWaterMeter.h>
    //SensorWaterMeter waterMeter(3);
    
    //#include <sensors/SensorPlantowerPMS.h>
    //SensorPlantowerPMS pms(6,7);
    
    //#include <sensors/SensorVL53L0X.h>
    //SensorVL53L0X vl53l0x(3);
    
    //#include <sensors/DisplaySSD1306.h>
    //DisplaySSD1306 ssd1306;
    
    //#include <sensors/SensorSHT31.h>
    //SensorSHT31 sht31;
    
    //#include <sensors/SensorSI7021.h>
    //SensorSI7021 si7021;
    
    //#include <sensors/SensorChirp.h>
    //SensorChirp chirp;
    
    //#include <sensors/DisplayHD44780.h>
    //DisplayHD44780 hd44780;
    
    //#include <sensors/SensorTTP.h>
    //SensorTTP ttp;
    
    //#include <sensors/SensorServo.h>
    //SensorServo servo(6);
    
    //#include <sensors/SensorAPDS9960.h>
    //SensorAPDS9960 apds9960(3);
    
    //#include <sensors/SensorNeopixel.h>
    //SensorNeopixel neopixel(6);
    
    //#include <sensors/SensorSDS011.h>
    //SensorSDS011 sds011(6,7);
    
    //#include <sensors/SensorFPM10A.h>
    //SensorFPM10A fpm10a(4,5);
    
    //#include <sensors/SensorPH.h>
    //SensorPH ph(A0);
    
    //#include <sensors/SensorPca9685W.h>
    //SensorPca9685W pca9685W;
    
    //#include <sensors/SensorPca9685Rgb.h>
    //SensorPca9685Rgb pca9685Rgb;
    
    //#include <sensors/SensorPca9685Rgbw.h>
    //SensorPca9685Rgbw pca9685Rgbw;
    
    //#include <sensors/SensorDSM501A.h>
    //SensorDSM501A DSM501A;
    
    //#include <sensors/SensorPN532.h>
    //SensorPN532 pn532;
    
    //#include <sensors/SensorCCS811.h>
    //SensorCCS811 ccs811;
    
    //#include <sensors/SensorGSM.h>
    //SensorGSM gsm(6,7);
    
    /***********************************
     * Main Sketch
     */
    
    // before
    void before() {
    	
      /***********************************
       * Configure your sensors
       */
       
      // report measures of every attached sensors every 10 seconds
      nodeManager.setReportIntervalSeconds(10);
      // report measures of every attached sensors every 10 minutes
      //nodeManager.setReportIntervalMinutes(10);
      // set the node to sleep in 30 seconds cycles
      //nodeManager.setSleepSeconds(30);
      // set the node to sleep in 5 minutes cycles
      //nodeManager.setSleepMinutes(5);
      // report battery level every 10 minutes
      //battery.setReportIntervalMinutes(10);
      // set an offset to -1 to a thermistor sensor
      //thermistor.setOffset(-1);
      // change the id of a the first child of a sht21 sensor
      //sht21.children.get(1)->setChildId(5);
      // report only when the analog value is above 40%
      //analog.children.get(1)->setMinThreshold(40);
      // power all the nodes through dedicated pins
      //nodeManager.setPowerManager(power);
    
      // 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
    

    Now what's wrong, what's missing?

    Help is highly appreciated! Thanks

    Martin



  • Did same body the port on Intel Edison? Arduino IDE is not finding SerialPort.h ?



Suggested Topics

13
Online

11.4k
Users

11.1k
Topics

112.7k
Posts