Node to node comunication with optional controller



  • I have a very small node.. planning to build into the wall... I know there are a lot of topics about this.. but the hadware is not THE problem.
    The purpose of the node is when it is switched on.. call to another node that he is online... the other node will switch on the house ventilation system.. and will check once in a while the node that requested the highest fan speed if that node is still on...
    The whole system can run without the need of a controller. Most of the time my home server is on.. but i don't want to depend on it.

    My only last problem is.
    when the node is starting up. it will first connect to the controller.. if it can't connect.. it is looping until it will connect.
    I am using the newest version of the api (V2.1). I tried to set the
    #define MY_REGISTRATION_RETRIES (1u)

    and
    #undef MY_REGISTRATION_FEATURE

    but it stays looping.
    i also found these 2 lines
    #define MY_PARENT_NODE_ID 0
    #define MY_PARENT_NODE_IS_STATIC

    but than the controller is trying to send a nack message.

    i prefer to see it will connect to the controller if it is online.. but doent wait for it before sending messages to the other nodes.
    However, if that isn't posible.. disconnecting this node from the controller is also an option.
    anyone knows how?


  • Hero Member

    @Doomic use: #define MY_TRANSPORT_WAIT_READY_MS 1 // sketch moves on if no registration and you can skip the other definitions (if not needed for something else). Great for use in 'autonomous' nodes.



  • looks good. I will try this later today.



  • @AWI get an error. [!MCO:SND:NODE NOT REG]
    perhaps you have changed more? in you MyConfig.h maybe?


  • Hero Member

    @Doomic This is what I have in the sketch.. no changes in the config

    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    #define MY_PARENT_NODE_ID 0
    #define MY_NODE_ID 90											// fixed node number
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    #define MY_RF24_CHANNEL 83										// 83, radio channel, default = 76
    #define MY_RF24_PA_LEVEL RF24_PA_LOW							// helps (sometimes) to get a stable communication
    
    #define MY_TRANSPORT_WAIT_READY_MS 1							// sketch moves on if no registration


  • I don't get it.
    It keep saying "NODE NOT REG"

    I have cleaned my sketch completly and it is now looking like below. But no progress on this.
    Compared myconfig.h file.. no changes with the one on github.
    removed some defines, tried all kind of combination.

    What am i missing?

    #define MY_DEBUG
    
    #define MY_RADIO_NRF24
    #define MY_RF24_CHANNEL 83
    #define MY_RF24_PA_LEVEL RF24_PA_LOW 
    
    #define MY_NODE_ID 21
    #define MY_PARENT_NODE_ID 0
    #define MY_PARENT_NODE_IS_STATIC
    #define MY_REGISTRATION_RETRIES 0
    #undef MY_REGISTRATION_FEATURE
    #define MY_TRANSPORT_WAIT_READY_MS 1
    
    #include <SPI.h>
    #include <MySensors.h>
     
    MyMessage msgTest(2, V_LIGHT);
    
    void setup()  
    { 
      msgTest.setDestination(20);
    }
    
    void presentation()
    {
      sendSketchInfo("Test", "1.0");
    }
    
    void loop() 
    {
      Serial.println("send");
      send(msgTest.set(false));
      wait(3000);
    } 
    

  • Hero Member

    @Doomic

    That compiles ok for me. Are you using MySensors v2.1.1 ?

    it might be best to re install the mysensor library and try again



  • Yes i am using the newest 2.1 version. I may try to reinstall mysensors, however i dont think that is the problem.

    Compiling isnt the problem, but when i run the sketch on my Arduino, It tells me trough the serial monitor that the node is not registered. (Because i doesnt have a gateway/controller nearby). Therefor it can't make calls.


  • Hero Member

    @Doomic I have compiled (a stripped version of) you sketch and it show the behaviour I would expect. i.e. it does not loop any more but gets going. Next thing is that it cannot send messages because it did not find any node in the network where it can register. For me that is certain as I purposely set #define MY_RF24_CHANNEL ... to a non used channel in my network.

    You need a gateway with the same communicaton characteristics to get communication going....



  • A gateway you say..
    There is a problem.. because the gateway is connected to my pc where the controller is running.
    The Gateway is not always switched on.
    That is the reason why i want to use node to node communication. Not depending on anther node (gateway) to work.

    But why does it need a gateway?
    Both nodes have a fixed id. Therefor there is nothing to register, is it?

    The title should be: "Node to node communication with optional controller gateway"
    Lets ask my question a litle bit different:

    Is it posible to only have 2 standalone nrf24/arduino devices running the mysensors library to communicate with each other.
    And if there is; what should the sketches look like?


  • Hero Member

    @Doomic A pretty similar discussion in this thread. Should give you some answers 🔤



  • i think i finally get it.
    It is impossible... well the only way to let nodes communicate with each other is when a gateway is available (directly or trough other nodes) when the node is starting up.
    This forum discussion is explaining me the most..

    a solution may be.. transform the node that is always on to an gateway. And use antoher channel.. Sidenode; then you can't tell the controller what the status is.

    Is there realy no way that this can supported? Node to node comunication without the need of an gateway inside the network? Skipping the registration and just send the message around.
    perhaps i will dive into the source one day and change the registration behavior.

    Thanks anyway for the help and the very fast responding.


Log in to reply
 

Suggested Topics

57
Online

11.4k
Users

11.1k
Topics

112.7k
Posts