Ethernet Gateway



  • Hi.
    I have question about Gateway .
    I want automatic resend incomming packet from predefined node to other predefined node .
    How is it possible ?
    I want resend packet from binary input node to relay .. I don't want use any controller ..
    only gateway - serial or ethernet.

    how to do it ?

    Or how to send data from one node to other directly ?? don't need gateway .. is it possible .. any small example ..
    send data from bininput node to relay ..

    regards.


  • Mod

    Yes you can send data from one node to another directly. See the example here: https://github.com/mysensors/Arduino/tree/master/libraries/MySensors/examples/PingPongSensor



  • yes. I know .. I try understand this .. but .. more help me .. if have Tx node and Rx node..
    I manualy set node ID .. I want make 16 Tx node with 4 button , and Rx node with 32 relays ..

    Rx node ID 1 and Tx node will be 2,3,4,.. 17 ..
    is possible help with it ..???

    regards..



  • Hi .
    Here is my example .. working with my code for Relay board 32 relay by I2C IO expander.

    #include <MySensor.h>
    #include <SPI.h>
    
    // Define version 
    #define VSN "v1.0"
    // Define Name 
    #define NAME "Test"
    // Define Sensor - button
    #define BLU 1 // Button Left Up
    #define BLD 2 // Button Left Down
    #define BRU 3 // Button Right Up
    #define BRD 4 // Button Right Down
    
    
    // Sensor objects
    MySensor gw;
    void setup() {
    //  eeprom_write_byte((uint8_t*)EEPROM_NODE_ID_ADDRESS, (byte)255);
      gw.begin(incomingMessage,AUTO);    // Node ID auto  .. if not used gateway , Node ID must define manualy 
      gw.sendSketchInfo( NAME, VSN ); // Name and version 
      gw.present(BLU, S_LIGHT);   
      gw.present(BLD, S_LIGHT);
      gw.present(BRU, S_LIGHT);
      gw.present(BRD, S_LIGHT);
    }
    
    void loop() 
    {
      gw.process();
    }
    
    void incomingMessage(const MyMessage &message) {
     if (message.type == V_LIGHT) {
      MyMessage response (message.getByte(),V_LIGHT) ; //  message.getByte() = payload define what relay want change state
      response.setDestination(1); // My Relay Board 
      gw.send(response);
     }
    }```

 

402
Online

7.8k
Users

8.7k
Topics

92.9k
Posts