How to use the Development branch for Sensor and Gateway



  • I got past all my recent issues and actually got the "MQTT Gateway Client" using the development-branch of the library (https://github.com/mysensors/Arduino/tree/development). If I clear out my entire sketchbook folder and then place the "libraries" and "hardware" folders ONLY into the Sketchbook location, the gateway works fine. The issue is I can't make the DallasTemp Example sketch work. If I open the example and verify it, it compiles just fine. I can even upload it. When I start it though it contacts the gateway for a ID and obviously doesn't get one (I am using MYSController to view the controller logs and test) as my understanding is the Controller assigns the ID.

    If I clear everything out again from the sketch folder and use the 1.5 master library I can actually define a ID in the DallasTemp sketch:

    #define NODE_ID 12
    

    I also noticed that in the Setup() there seems to be a lot more code in the 1.5 Master that is missing in the Development DallasTemp Example.

    void setup()  
    { 
      // Startup up the OneWire library
      sensors.begin();
      // requestTemperatures() will not block current thread
      sensors.setWaitForConversion(false);
    
      // Startup and initialize MySensors library. Set callback for incoming messages. 
      gw.begin(NULL, NODE_ID, false);
    
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("Temperature Sensor", "1.1");
    
      // Fetch the number of attached temperature sensors  
      numSensors = sensors.getDeviceCount();
    
      // Present all sensors to controller
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
         gw.present(i, S_TEMP);
      }
    }
    

    If I try to place MySensor gw(); in the Dallas Temp Example from the DEV library I get the following error:

    Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Uno"
    
    Build options changed, rebuilding all
    
    Using library SPI in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI 
    
    Using library MySensors in folder: C:\Users\Thomas\Documents\Arduino\libraries\MySensors 
    
    Using library DallasTemperature in folder: C:\Users\Thomas\Documents\Arduino\libraries\DallasTemperature (legacy)
    
    Using library OneWire in folder: C:\Users\Thomas\Documents\Arduino\libraries\OneWire (legacy)
    
    
    
    C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI -IC:\Users\Thomas\Documents\Arduino\libraries\MySensors -IC:\Users\Thomas\Documents\Arduino\libraries\DallasTemperature -IC:\Users\Thomas\Documents\Arduino\libraries\OneWire C:\Users\Thomas\AppData\Local\Temp\build8610461630186494850.tmp\DallasTemperatureSensor.cpp -o C:\Users\Thomas\AppData\Local\Temp\build8610461630186494850.tmp\DallasTemperatureSensor.cpp.o 
    
    DallasTemperatureSensor.ino:53:1: error: 'MySensor' does not name a type
    'MySensor' does not name a type
    
    

    To sum it all up
    I can build a sensor with a manually assigned ID using the MASTER library and then a MQTT Gateway Client with the DEVELOPMENT library (after clearing out the master library). Questions are:

    1. How exactly do we use the DEV library? Do you create the Gateway using DEV and the Sensors using Master?

    2. Do you install the Master first and then the DEV over it? (I can't seem to get that to work in Windows 8.1)

    3. If you build both the Sensor and Gateway using the DEV library, then how do you define a NODE_ID in the sensor sketch? If I build both Sensor and Gateway using DEV then the sensor just sits there asking for a ID that it will never get (I am using OpenHab as my controller and right now it seems easier to just manually assign each sensor a ID).


  • Admin

    @ATXCoder

    Development is what it says, we are using it for active development of core.. It should compile fine (we have jenkins for checking that for us) but there might be some other problems here and there, that won't show up at compile time.


  • Admin

    1. You should be able to mix versions.
    2. You must remove the whole MySensors library folder and replace it with the dev-version.
    3. Add #define MY_NODE_ID xxx before the inclusion of MySensor.h


  • Are there any instructions on how to use the development version with an Arduino gateway with the wiznet W1500 shield and nrf radio?
    The Config file is different and there now seems to be a dedicated sketch for the W1500.
    I would like to update to some of the newer features but i can not understand what needs to be altered in the config file etc.
    The instructions on the website are only for the stable version i presume.


  • Admin

    @rmtucker

    The configuration is in the sketch. Unless you want to do something very exotic.


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.