Trying to convert a rain sensor sketch. get a fail error



  • Hi,

    I am trying to convert a rain sensor sketch but it just doens't seem to work.
    I am just trying to learn MySensors and i got a couple nodes with a DHT22 sensor working connected to Domoticz by a serial gateway.

    When i try to build a rain sensor then i see this error a lot:

    !TSM:FPAR:FAIL
    !TSM:FAILURE
    TSM:PDT

    Starting sensor (RNNNA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=2)
    TSM:FPAR
    TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSM:FPAR:FAIL
    !TSM:FAILURE
    TSM:PDT
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=2)
    TSM:FPAR
    TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSM:FPAR:FAIL
    !TSM:FAILURE
    TSM:PDT```
    
    

    Can somebody tell me what i am doing wrong?
    This is what i have as a sketch:

    // Enable debug prints
    #define MY_DEBUG
    
    // Enable and select radio type attached 
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    //#define MY_RS485
    
    
    #include <SPI.h>
    #include <MySensors.h>  
    
    #define DIGITAL_INPUT_SOIL_SENSOR 3   // Digital input did you attach your soil sensor.  
    #define INTERRUPT DIGITAL_INPUT_SOIL_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
    #define CHILD_ID 0   // Id of the sensor child
    
    MyMessage msg(CHILD_ID, V_TRIPPED);
    int lastSoilValue = -1;
    
    void presentation()  
    {
      // Send the sketch version information to the gateway
      sendSketchInfo("RainSensor", "1.0");
    // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID, S_MOTION);
    }
    void setup()  
    { 
      // sets the soil sensor digital pin as input
      pinMode(DIGITAL_INPUT_SOIL_SENSOR, INPUT);      
    }
     
    void loop()     
    {     
      // Read digital soil value
      int soilValue = digitalRead(DIGITAL_INPUT_SOIL_SENSOR); // 1 = Not triggered, 0 = In soil with water 
      if (soilValue != lastSoilValue) {
        Serial.println(soilValue);
        send(msg.set(soilValue==0?1:0));  // Send the inverse to gw as tripped should be when no water in soil
        lastSoilValue = soilValue;
      }
      // Power down the radio and arduino until digital input changes.
      sleep(INTERRUPT,CHANGE);
    }
    
    

Log in to reply
 

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