Send msg in background



  • Hello

    I'm writing program for work with my waterpump.

    If the waterlevel is rich I would to turn on relay and (maybe in background_ I would like to send information to domoticz.
    Normally it works fine but if it a problem with connection to the gateway the program don't start...

    I cut code about Pump to make it easy to understand . I should see in console: "PUMP WORK" and "START"

    I get in console:
    Starting sensor (RNNNA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=1)
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 1-1-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

    My code:

    // Enable debug prints to serial monitor
    #define MY_DEBUG

    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69

    // Enabled repeater feature for this node
    //#define MY_REPEATER_FEATURE

    #include <SPI.h>
    #include <MySensors.h>

    //#define MY_TRANSPORT_UPLINK_CHECK_DISABLED
    #define MY_TRANSPORT_DONT_CARE_MODE

    #define CHILD_ID 1 // turn on pump

    MyMessage msg(CHILD_ID,V_LIGHT);

    void setup()
    {
    //Serial.begin(115200);
    Serial.println(" START ");
    }

    void presentation() {

    // Send the sketch version information to the gateway and Controller
    sendSketchInfo("Pump", "1.0");

    // Register all sensors to gw (they will be created as child devices)
    present(CHILD_ID, S_LIGHT);

    }

    void loop() {

    ////......SOME CODE
    Serial.println("PUMP WORK");
    send(msg.set(true), true);
    }


  • Admin

    @zsakul I know this is really late but I was just doing a search and came across your post. Hopefully you have found the solution but if not you need to put "#define MY_TRANSPORT_DONT_CARE_MODE" above #include <MySensors.h> in your code. Also, MY_TRANSPORT_DONT_CARE_MODE has been replaced by MY_TRANSPORT_WAIT_READY_MS 1 in the most recent version.



  • It's not working.

    Can I change also something in Config.h ?


  • Admin

    @zsakul Try downloading the latest version from github. The master branch will be updated to version 2.1 very soon and I recommend waiting for that. https://github.com/mysensors/MySensors/tree/master

    Once you have updated you should be able to use MY_TRANSPORT_WAIT_READY_MS in your code. I have it working in my device.

    You could change MY_TRANSPORT_WAIT_READY_MS in the myconfig.h file but if you do it there every node you build will have this setting (which my not be desired).


Log in to reply
 

Suggested Topics

  • 4
  • 274
  • 9
  • 2
  • 933
  • 3

2
Online

11.2k
Users

11.1k
Topics

112.5k
Posts