[SOLVED] Node sending many messages
- 
					
					
					
					
 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  but in debugging mode I see that it seems to send a lot of messages like this: 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:258473so 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.2which is fine It would be greate to understand why these messages are sent and how to avoid this. thanks in advance 
 
- 
					
					
					
					
 @jeti I think they may be the heartbeat messages from smartsleep 
 
- 
					
					
					
					
 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... 
 
- 
					
					
					
					
 @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. 
 
- 
					
					
					
					
 @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 waitwhich does the trick  : So temp and hum only every minute but IR signals whenever i want. Is "wait" the right tool here or a band aid? : So temp and hum only every minute but IR signals whenever i want. Is "wait" the right tool here or a band aid?thanks! 
 
- 
					
					
					
					
 @jeti wait is the correct solution. 
 
 
					
				
