Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. [SOLVED] Node sending many messages

[SOLVED] Node sending many messages

Scheduled Pinned Locked Moved Troubleshooting
6 Posts 3 Posters 1.5k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jeti
    wrote on last edited by Yveaux
    #1

    Hi

    i have combined IR Sending with a SI7021 temperature & humidity sensor.
    As i am still new to Mysensors and Arduino i have tweaked to send the temp & humidity once every minute but accept IR orders every 250ms which works fine. My sketch looks like this:

    // Enable debug prints
    #define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    #define MY_NODE_ID 112
    
    #include <SPI.h>
    #include <MySensors.h>
    #include <IRLib.h>
    #include "Adafruit_Si7021.h"
    
    #include <Wire.h>
    
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define CHILD_ID_IR  2  // childId
    
    int counter = 0;
    
    Adafruit_Si7021 sensor = Adafruit_Si7021();
    IRsend irsend;
    
    MyMessage msgIR(CHILD_ID_IR, V_VAR1);
    MyMessage msgT(CHILD_ID_TEMP, V_TEMP);
    MyMessage msgH(CHILD_ID_HUM, V_HUM);
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("IR Sender & Temp Hum", "1.0");
    
      // Register a sensors to  Use binary light for test purposes.
      present(CHILD_ID_IR, S_LIGHT);
      present(CHILD_ID_HUM, S_HUM);
      present(CHILD_ID_TEMP,S_TEMP);
    
      delay(500); // Allow time for radio if power useed as reset
       sensor.begin();
    }
    
    void loop() 
    {
    smartSleep(250); // adjust sleeping time here 250ms in this case 
       ServerUpdate();
       counter ++;
    }
    
    
    
    void receive(const MyMessage &message) {
      // We only expect one type of message from controller. But we better check anyway.
      if (message.type==V_LIGHT) {
         int incomingRelayStatus = message.getInt();
         if (incomingRelayStatus == 1) {
          irsend.send(NEC, 0x10C8E11E, 32); // acer Beamer Power
         } else {
          irsend.send(NEC, 0x10C8E11E, 32); // acer Beamer Power
          wait(1000); // Pause zwische zwei mal ausschalten
          irsend.send(NEC, 0x10C8E11E, 32); // acer Beamer Power
         }
      }
    }
    void ServerUpdate() // used to read sensor data and send it to controller
    {
      double T, H;
      T=sensor.readTemperature();
      H=sensor.readHumidity();
      if (counter >= 240){ // 240*250ms = 1minute
          send(msgT.set(T,1));
          send(msgH.set(H,1));
          counter = 0;
      
           
       // unmark for debuging
        //  Serial.print("T = \t"); Serial.print(T, 1); Serial.print(" degC\t");
        //  Serial.print("H = \t"); Serial.print(H, 1); Serial.println(" %\t");
      }
    }
    

    It works like it should :smiley: but in debugging mode I see that it seems to send a lot of messages like this:

    TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:251177
    TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:251739
    TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:252301
    TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:252862
    TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:253424
    TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:253984
    TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:254544
    TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:255106
    TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:255670
    TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:256231
    TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:256791
    TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:257351
    TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:257913
    TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:258473
    

    so i guess it is spaming my setup, or does it?
    It would be greate to understand why these messages are sent and how to avoid this.

    and once every minute:

    TSP:MSG:SEND 112-112-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=ok:23.1
    TSP:MSG:SEND 112-112-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=ok:59.2
    

    which is fine

    It would be greate to understand why these messages are sent and how to avoid this.

    thanks in advance

    Boots33B 1 Reply Last reply
    0
    • J jeti

      Hi

      i have combined IR Sending with a SI7021 temperature & humidity sensor.
      As i am still new to Mysensors and Arduino i have tweaked to send the temp & humidity once every minute but accept IR orders every 250ms which works fine. My sketch looks like this:

      // Enable debug prints
      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #define MY_NODE_ID 112
      
      #include <SPI.h>
      #include <MySensors.h>
      #include <IRLib.h>
      #include "Adafruit_Si7021.h"
      
      #include <Wire.h>
      
      
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define CHILD_ID_IR  2  // childId
      
      int counter = 0;
      
      Adafruit_Si7021 sensor = Adafruit_Si7021();
      IRsend irsend;
      
      MyMessage msgIR(CHILD_ID_IR, V_VAR1);
      MyMessage msgT(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgH(CHILD_ID_HUM, V_HUM);
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("IR Sender & Temp Hum", "1.0");
      
        // Register a sensors to  Use binary light for test purposes.
        present(CHILD_ID_IR, S_LIGHT);
        present(CHILD_ID_HUM, S_HUM);
        present(CHILD_ID_TEMP,S_TEMP);
      
        delay(500); // Allow time for radio if power useed as reset
         sensor.begin();
      }
      
      void loop() 
      {
      smartSleep(250); // adjust sleeping time here 250ms in this case 
         ServerUpdate();
         counter ++;
      }
      
      
      
      void receive(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type==V_LIGHT) {
           int incomingRelayStatus = message.getInt();
           if (incomingRelayStatus == 1) {
            irsend.send(NEC, 0x10C8E11E, 32); // acer Beamer Power
           } else {
            irsend.send(NEC, 0x10C8E11E, 32); // acer Beamer Power
            wait(1000); // Pause zwische zwei mal ausschalten
            irsend.send(NEC, 0x10C8E11E, 32); // acer Beamer Power
           }
        }
      }
      void ServerUpdate() // used to read sensor data and send it to controller
      {
        double T, H;
        T=sensor.readTemperature();
        H=sensor.readHumidity();
        if (counter >= 240){ // 240*250ms = 1minute
            send(msgT.set(T,1));
            send(msgH.set(H,1));
            counter = 0;
        
             
         // unmark for debuging
          //  Serial.print("T = \t"); Serial.print(T, 1); Serial.print(" degC\t");
          //  Serial.print("H = \t"); Serial.print(H, 1); Serial.println(" %\t");
        }
      }
      

      It works like it should :smiley: but in debugging mode I see that it seems to send a lot of messages like this:

      TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:251177
      TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:251739
      TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:252301
      TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:252862
      TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:253424
      TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:253984
      TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:254544
      TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:255106
      TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:255670
      TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:256231
      TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:256791
      TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:257351
      TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:257913
      TSP:MSG:SEND 112-112-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:258473
      

      so i guess it is spaming my setup, or does it?
      It would be greate to understand why these messages are sent and how to avoid this.

      and once every minute:

      TSP:MSG:SEND 112-112-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=ok:23.1
      TSP:MSG:SEND 112-112-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=ok:59.2
      

      which is fine

      It would be greate to understand why these messages are sent and how to avoid this.

      thanks in advance

      Boots33B Offline
      Boots33B Offline
      Boots33
      Hero Member
      wrote on last edited by
      #2

      @jeti I think they may be the heartbeat messages from smartsleep

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jeti
        wrote on last edited by
        #3

        ah ok, so it is generating traffic which is not needed. Is there a way of smart-sleeping without the hearteat? normal sleep does not work with the recieving part of the sketch...

        mfalkviddM 1 Reply Last reply
        0
        • J jeti

          ah ok, so it is generating traffic which is not needed. Is there a way of smart-sleeping without the hearteat? normal sleep does not work with the recieving part of the sketch...

          mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by
          #4

          @jeti without the heartbeat the controller wouldn't know when the node is awake, so the controller wouldn't know when to send the message.

          J 1 Reply Last reply
          1
          • mfalkviddM mfalkvidd

            @jeti without the heartbeat the controller wouldn't know when the node is awake, so the controller wouldn't know when to send the message.

            J Offline
            J Offline
            jeti
            wrote on last edited by
            #5

            @mfalkvidd : ok thanks i think i got it now.
            As i only want to send the temperature and humidity once every x seconds/minutes, but the IR must be always ready for receiving/sending i can not use sleep (otherwise the sensor only sends when the nod is awake.

            I have now used

            wait
            

            which does the trick :smiley: : So temp and hum only every minute but IR signals whenever i want. Is "wait" the right tool here or a band aid?

            thanks!

            mfalkviddM 1 Reply Last reply
            0
            • J jeti

              @mfalkvidd : ok thanks i think i got it now.
              As i only want to send the temperature and humidity once every x seconds/minutes, but the IR must be always ready for receiving/sending i can not use sleep (otherwise the sensor only sends when the nod is awake.

              I have now used

              wait
              

              which does the trick :smiley: : So temp and hum only every minute but IR signals whenever i want. Is "wait" the right tool here or a band aid?

              thanks!

              mfalkviddM Offline
              mfalkviddM Offline
              mfalkvidd
              Mod
              wrote on last edited by
              #6

              @jeti wait is the correct solution.

              1 Reply Last reply
              1
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              32

              Online

              11.7k

              Users

              11.2k

              Topics

              113.1k

              Posts


              Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • MySensors
              • OpenHardware.io
              • Categories
              • Recent
              • Tags
              • Popular