Node request temperature from gateway



  • Hi guys,

    I am trying for the last days to make the gateway to send data to node.
    Till now i dont have any luck , i am using an Arduino Nano for the node and and Arduino Mega with Ethernet adapter.
    Below is my gateway code:

    
    #define MY_RADIO_NRF24
    #define MY_RF24_CE_PIN 6
    #define MY_RF24_CS_PIN 4
    #define MY_SOFTSPI
    #define MY_GATEWAY_SERIAL
    #include <SPI.h>
    #include <MySensors.h>
    #define CHILD_ID 4   // Id of the sensor child
    MyMessage msg(CHILD_ID, V_TEMP);
    
    void setup()
    {  }
    
    void presentation()  {
      present(CHILD_ID, S_TEMP);
    }
    
    void loop()
    { float temperature = 99; // dht.getTemperature();
      send(msg.set(temperature, 1));
    
    }
    
    void receive(const MyMessage &message) {
    
    }
    

    and the code for the node is :

    
    #include <SPI.h>
    #define MY_RADIO_NRF24
    #define MY_RF24_CE_PIN 10
    #define MY_RF24_CS_PIN 9
    #define MY_NODE_ID 2
    #include <MySensors.h>
    
    void setup()
    }
    void presentation()
    {
    }
    
    void loop()
    { request(4, V_TEMP, 0);
    }
    
    void incomingMessage(const MyMessage &message) {
      if (message.type == V_TEMP) {
        Serial.print("Incoming change for sensor:");
        Serial.print(message.sensor);
        Serial.print("\n");
        Serial.print(", New status: ");
        Serial.println(message.getFloat());
    
      }
    }
    

    The serial from the node:

    0;4;1;0;0;99.0
    2;4;2;0;0;
    2;4;2;0;0;
    0;4;1;0;0;99.0
    2;4;2;0;0;
    2;4;2;0;0;
    0;4;1;0;0;99.0
    2;4;2;0;0;
    0;4;1;0;0;99.0
    0;4;1;0;0;99.0
    2;4;2;0;0;
    0;4;1;0;0;99.0
    

    In the serial from the node with debug activated:

    __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.3.0
    
    16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.3.0
    25 TSM:INIT
    26 TSF:WUR:MS=0
    33 TSM:INIT:TSP OK
    35 TSM:INIT:STATID=2
    37 TSF:SID:OK,ID=2
    39 TSM:FPAR
    75 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    585 TSF:MSG:READ,0-0-2,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    589 TSF:MSG:FPAR OK,ID=0,D=1
    2082 TSM:FPAR:OK
    2083 TSM:ID
    2084 TSM:ID:OK
    2086 TSM:UPL
    2089 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2096 TSF:MSG:READ,0-0-2,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2101 TSF:MSG:PONG RECV,HP=1
    2103 TSM:UPL:OK
    2105 TSM:READY:ID=2,PAR=0,DIS=1
    2109 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    2116 TSF:MSG:READ,0-0-2,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2123 TSF:MSG:SEND,2-2-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.0
    2131 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    4140 TSF:MSG:SEND,2-2-0-0,s=4,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=OK:
    4146 MCO:REG:REQ
    4149 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    4155 TSF:MSG:READ,0-0-2,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    4160 MCO:PIM:NODE REG=1
    4163 MCO:BGN:STP
    ok
    4164 MCO:BGN:INIT OK,TSP=1
    4168 TSF:MSG:SEND,2-2-0-0,s=4,c=2,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    4176 TSF:MSG:SEND,2-2-0-0,s=4,c=2,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    4186 TSF:MSG:SEND,2-2-0-0,s=4,c=2,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    4194 TSF:MSG:SEND,2-2-0-0,s=4,c=2,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    4201 TSF:MSG:SEND,2-2-0-0,s=4,c=2,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    4208 TSF:MSG:SEND,2-2-0-0,s=4,c=2,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    4216 TSF:MSG:SEND,2-2-0-0,s=4,c=2,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    4224 TSF:MSG:SEND,2-2-0-0,s=4,c=2,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    4232 TSF:MSG:SEND,2-2-0-0,s=4,c=2,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    4239 TSF:MSG:SEND,2-2-0-0,s=4,c=2,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    4246 TSF:MSG:SEND,2-2-0-0,s=4,c=2,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    4254 TSF:MSG:SEND,2-2-0-0,s=4,c=2,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    4261 TSF:MSG:SEND,2-2-0-0,s=4,c=2,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    4269 TSF:MSG:SEND,2-2-0-0,s=4,c=2,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    

  • Mod

    Welcome to the MySensors community @daniel-rus

    A gateway does not store any data. You need to use a controller. It looks like there is no controller in your system?

    If you haven’t already, see https://www.mysensors.org/about/network for an overview of how MySensors works.



  • @mfalkvidd Hi, I manage to make an MQTT gateway with home assistant as controller .
    The serial from gateway i can see that the gateway send data out from MQTT, but the node still not receive anything

    870503 TSF:MSG:READ,2-2-0,s=3,c=2,t=0,pt=0,l=0,sg=0:
    870508 GWT:TPS:TOPIC=mygateway1-out/2/3/2/0/0,MSG SENT
    870569 GWT:TPS:TOPIC=mygateway1-out/0/4/1/0/47,MSG SENT
    870587 GWT:TPS:TOPIC=mygateway1-out/0/3/1/0/0,MSG SENT
    871604 TSF:MSG:READ,2-2-0,s=3,c=2,t=0,pt=0,l=0,sg=0:
    871609 GWT:TPS:TOPIC=mygateway1-out/2/3/2/0/0,MSG SENT
    871670 GWT:TPS:TOPIC=mygateway1-out/0/4/1/0/47,MSG SENT
    871687 GWT:TPS:TOPIC=mygateway1-out/0/3/1/0/0,MSG SENT
    

Log in to reply
 

Suggested Topics

  • 3
  • 4
  • 3
  • 2
  • 2
  • 2

23
Online

11.2k
Users

11.1k
Topics

112.5k
Posts