Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. siod
    3. Posts
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by siod

    • RE: [SOLVED] call of overloaded 'sleep(int, int)' is ambiguous

      Hi, thanks for your help, that´s the solution!!

      posted in Troubleshooting
      siod
      siod
    • RE: [SOLVED] Node not uisng it´s ID!?

      damn it, that did the trick!! Just haven´t noticed...

      Thx for your superfast support!!

      posted in Troubleshooting
      siod
      siod
    • [SOLVED] Node not uisng it´s ID!?

      I have a problem with one of my nodes. I assigned Node ID 10 to it, but it seems like it´s requesting an ID from the gateway!? This is my gateway output when I power on the Node:

      0;255;3;0;9;3513128927 TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;3513128933 TSF:MSG:BC
      0;255;3;0;9;3513128936 TSF:MSG:FPAR REQ,ID=255
      0;255;3;0;9;3513128941 TSF:PNG:SEND,TO=0
      0;255;3;0;9;3513128944 TSF:CKU:OK
      0;255;3;0;9;3513128947 TSF:MSG:GWL OK
      0;255;3;0;9;3513130002 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
      0;255;3;0;9;3513130893 TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
      0;255;3;0;9;3513130900 Sending message on topic: mygateway1-out/255/255/3/0/3
      0;255;3;0;9;3513132862 TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
      0;255;3;0;9;3513132869 Sending message on topic: mygateway1-out/255/255/3/0/3
      0;255;3;0;9;3513134829 TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
      0;255;3;0;9;3513134836 Sending message on topic: mygateway1-out/255/255/3/0/3
      0;255;3;0;9;3513136797 TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
      0;255;3;0;9;3513136804 Sending message on topic: mygateway1-out/255/255/3/0/3
      0;255;3;0;9;3513148605 TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;3513148612 TSF:MSG:BC
      0;255;3;0;9;3513148615 TSF:MSG:FPAR REQ,ID=255
      0;255;3;0;9;3513148619 TSF:PNG:SEND,TO=0
      0;255;3;0;9;3513148623 TSF:CKU:OK
      

      and this is my Node´s sketch:

      
      #define MY_RADIO_NRF24
      
      #include <MySensors.h>
      #include <SPI.h>
      
      
      // Define Node ID
      #define MY_NODE_ID 10
      #define MY_PARENT_NODE_ID 0
      #define MY_PARENT_NODE_IS_STATIC
      
      //Batterysensor
      int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
      int oldBatteryPcnt = 0;
      #define CHILD_ID_BATT 7
      
      //Kontaktschalter
      #define CHILD_ID 1
      #define BUTTON_PIN  3  // Arduino Digital I/O pin for button/reed switch
      
      
      //MySensor gw;
      
      
      // Change to V_LIGHT if you use S_LIGHT in presentation below
      MyMessage msg(CHILD_ID,V_TRIPPED);
      MyMessage msgbatt(CHILD_ID_BATT,V_VOLTAGE);
      
      void setup()  
      {  
        int  buzzer = 7;  //Buzzer Anschlusspin
        pinMode(buzzer, OUTPUT); 
        pinMode(13,OUTPUT);
        digitalWrite(13,HIGH); 
        digitalWrite(buzzer, HIGH);
        wait(50);
        digitalWrite(buzzer, LOW);
        wait(50);
        digitalWrite(buzzer, HIGH);
        wait(50);
        digitalWrite(buzzer, LOW);
        wait(50);
        digitalWrite(buzzer, HIGH);
        wait(50);
        digitalWrite(buzzer, LOW);
        //gw.begin(NULL, MY_NODE_ID, true);
      
       // Setup the button
        pinMode(BUTTON_PIN,INPUT);
      
        // Activate internal pull-up
        digitalWrite(BUTTON_PIN,HIGH);
      
      
      
          //Batterysensor
           // use the 1.1 V internal reference
      #if defined(__AVR_ATmega2560__)
         analogReference(INTERNAL1V1);
      #else
         analogReference(INTERNAL);
      #endif
         // Send the sketch version information to the gateway and Controller
      }
        // Register binary input sensor to gw (they will be created as child devices)
        // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 
        // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
        void presentation()
      {
          sendSketchInfo("Wohunungstuer Alarm", "1.0");
          wait(500);
          present(CHILD_ID, S_DOOR);
          wait(500);
      }
      
      
      //  Check if digital input has changed and send in new value
      void loop() 
      {
           //Türkontakt prüfen:
        uint8_t value;
        static uint8_t sentValue = 2;
        
         value = digitalRead(BUTTON_PIN);
      
        if (value==HIGH){
               //Buzzer wird ausgelöst
             int  buzzer = 7;  //Buzzer Anschlusspin
        pinMode(buzzer, OUTPUT);
        digitalWrite(buzzer, HIGH);
        wait(500);
        digitalWrite(buzzer, LOW);
        wait(500);
        digitalWrite(buzzer, HIGH);
        wait(500);
        digitalWrite(buzzer, LOW);
        wait(500);
        digitalWrite(buzzer, HIGH);
        wait(500);
        digitalWrite(buzzer, LOW);
        wait(2000);
        digitalWrite(buzzer, HIGH);
        wait(500);
        digitalWrite(buzzer, LOW);
        wait(500);
        digitalWrite(buzzer, HIGH);
        wait(500);
        digitalWrite(buzzer, LOW);
        wait(500);
        digitalWrite(buzzer, HIGH);
        wait(500);
        digitalWrite(buzzer, LOW);  
        }
      
      
        // Short wait to allow buttons to properly settle
        wait(5);
      
        //Batterysensor
        // get the battery Voltage
         int sensorValue = analogRead(BATTERY_SENSE_PIN);
         #ifdef DEBUG
         Serial.println(sensorValue);
         #endif
         
         // 1M, 470K divider across battery and using internal ADC ref of 1.1V
         // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
         // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
         // 3.44/1023 = Volts per bit = 0.003363075
         float batteryV  = sensorValue * 0.003363075;
         int batteryPcnt = sensorValue / 10;
      
         #ifdef DEBUG
         Serial.print("Battery Voltage: ");
         Serial.print(batteryV);
         Serial.println(" V");
      
         Serial.print("Battery percent: ");
         Serial.print(batteryPcnt);
         Serial.println(" %");
         #endif
      
         if (oldBatteryPcnt != batteryPcnt) {
           // Power up radio after sleep
           sendBatteryLevel(batteryPcnt);
           wait(500);
           send(msgbatt.set(batteryPcnt),true);
           wait(500);
           oldBatteryPcnt = batteryPcnt;
         }
      
      
      
      
        if (value != sentValue) {
          // Value has changed from last transmission, send the updated value
          send(msg.set(value == HIGH ? 1 : 0),true);
          wait(500);
          sentValue = value;
        }
      
        // Sleep until something happens with the sensor
        digitalWrite(13,LOW);
        Serial.println("Sleep");
        sleep(BUTTON_PIN - 2, CHANGE);// changing Secondary button to correct pin (-3) does not work. So keep it on (-2)
       }
      

      What is wrong here?

      posted in Troubleshooting
      siod
      siod
    • [SOLVED] call of overloaded 'sleep(int, int)' is ambiguous

      Hi,

      I have an older sketch which I modified and want to upload again now to my Arduino. I am using Lib 2.2.0 now, but I am getting this error at this line:

      sleep(BUTTON_PIN - 2, CHANGE);
      
      call of overloaded 'sleep(int, int)' is ambiguous
      

      The code worked very well in the past, so whats wrong here now?

      edit: I´m using Arduino IDE 1.8.5
      edit2: I can compile using lib 2.0.0. So there must have been a change in the meantime.

      posted in Troubleshooting
      siod
      siod
    • Sonoff Pow with Tasmota: HowTo MQTT?

      Hi,

      I´ve successfully flashed Tasmota to my Sonoff Pow and I see it´s connected to my MQTT Broker, but I haven´t understood how to send commands to the Pow over MQTT.

      e.g. in the docs they are saying this:

      *To execute these, issue (publish) these MQTT requests

      MQTT topic MQTT payload
      cmnd/my_device/power <empty>
      cmnd/my_device/power on
      cmnd/my_device/power off*

      But actually the device is not turning off or on. One imortant thing is I don´t know what is "my_device".
      Finally I need to know how I could best combine this device with my Openhab2 and Mysesnsors setup.

      Any help is appreciated, thanks in advance!

      posted in Hardware
      siod
      siod
    • RE: Need help with ESP8266 Node in MQTT Network

      Hi guys,

      thanks to both of you! Thanks @TimO for the general information and thanks to @kimot for finding the exact solution for what I was looking for. Awesome!!

      I will give it a try as soon as possible...

      posted in Development
      siod
      siod
    • RE: Need help with ESP8266 Node in MQTT Network

      well, this looks quiet interesting, but I think I´m quicker if I just use my actual Arduino IDE setup and some lines of code to achieve my goal because I feel more comfortable wit this IDE...

      But I will have a look at ESPEasy anyway, thanks for that!!

      edit: Do I have to upload the ESP8266 Gateway Code to every ESP8266 Node?

      What I actually want to achieve is to build a IR Sender which sends IR commands to my TV or other IR devices that where sent by openhab.

      posted in Development
      siod
      siod
    • Need help with ESP8266 Node in MQTT Network

      Hi guys,

      I would like to add an ESP8266 WIFI Node to my existing NRF24 MQTT Network. I´ve set up a Mosquitto broker on my LAN connected Raspberry pi with openhab2 running on it acting as the controller.
      Unfortunately I have no idea where to start to include the new WIFI node to talk to my controller. Does someone know a tutorial could give me some code examples of where to start?

      Thanks in advance!

      posted in Development
      siod
      siod
    • What settings for ESP8266 Node?

      Hi,

      I would like to convert the below sketch to a ESP8266 /WeMos D1 Mini compatible sketch. Do I have to change MY RADIO NRF24 to ESP8266 or sth like that? PS I am using MQTT and Openhab 2...

      /*
       * IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
       * An IR LED must be connected to Arduino PWM pin 3.
       * Version 0.1 July, 2009
       * Copyright 2009 Ken Shirriff
       * http://arcfn.com
       */
      
      #define MY_RADIO_NRF24 
      // Define Node ID
      #define MY_NODE_ID 5
      //#define MY_PARENT_NODE_ID 50 //Repeater Node 1!
      //#define MY_PARENT_NODE_IS_STATIC
      
      #include <MySensors.h>
      #include <SPI.h>
      #include <IRremote.h>
      
      #define CHILD_ID 1   // Id of the sensor child
      
      IRsend irsend;
      
      // Initialize message
      MyMessage msg(CHILD_ID, V_IR_SEND);
      
      void setup()
      {
        Serial.begin(9600);
      }
      
      void presentation()
      {
          // Send the sketch version information to the gateway and Controller
          sendSketchInfo("LED Licht TV Steuerung", "1.0");
      
          // Register all sensors to gw (they will be created as child devices)
          present(CHILD_ID, S_IR);
      }
      
      void loop() {
      
      
      }
      
      void receive(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
         Serial.println(F("Incoming Message:"));
         Serial.println(message.getString());
        if (message.type == V_IR_RECEIVE) {
          // Send command to Turn LEDs On
          if (message.getString("anaus")) { 
          for (int i = 0; i < 3; i++) {
              irsend.sendNEC(0xFF02FD, 32);
              Serial.println(message.getString());
              Serial.println("Message sent");
              delay(40);
            }
          } 
              // Send command to Turn LEDs Red
          else if (message.getString("rot")) { 
          for (int i = 0; i < 3; i++) {
              irsend.sendNEC(0xFF1AE5, 32);
              Serial.println(message.getString());
              Serial.println("Message sent");
              delay(40);
            }
          }
              // Send command to Turn LEDs green
          else if (message.getString("gruen")) { 
          for (int i = 0; i < 3; i++) {
              irsend.sendNEC(0xFF9A65, 32);
              Serial.println(message.getString());
              Serial.println("Message sent");
              delay(40);
            }
          }
                  // Send command to Turn LEDs blue
          else if (message.getString("blau")) { 
          for (int i = 0; i < 3; i++) {
              irsend.sendNEC(0xFFA25D, 32);
              Serial.println(message.getString());
              Serial.println("Message sent");
              delay(40);
            }
          }
                      // Send command to Turn LEDs white
          else if (message.getString("weiss")) { 
          for (int i = 0; i < 3; i++) {
              irsend.sendNEC(0xFF22DD, 32);
              Serial.println(message.getString());
              Serial.println("Message sent");
              delay(40);
            }
          }
                          // Send command to Turn LEDs faster
          else if (message.getString("schneller")) { 
          for (int i = 0; i < 3; i++) {
              irsend.sendNEC(0xFFE817, 32);
              Serial.println(message.getString());
              Serial.println("Message sent");
              delay(40);
            }
          }
                              // Send command to Turn LEDs slower
          else if (message.getString("langsamer")) { 
          for (int i = 0; i < 3; i++) {
              irsend.sendNEC(0xFFC837, 32);
              Serial.println(message.getString());
              Serial.println("Message sent");
              delay(40);
            }
          }
                     // Send command to Turn LEDs brighter
          else if (message.getString("heller")) { 
          for (int i = 0; i < 3; i++) {
              irsend.sendNEC(0xFF3AC5, 32);
              Serial.println(message.getString());
              Serial.println("Message sent");
              delay(40);
            }
          }
              // Send command to Turn LEDs darker
          else if (message.getString("dunkler")) { 
          for (int i = 0; i < 3; i++) {
              irsend.sendNEC(0xFFBA45, 32);
              Serial.println(message.getString());
              Serial.println("Message sent");
              delay(40);
            }
          }
                  // Send command to Turn LEDs Fade7
          else if (message.getString("fade7")) { 
          for (int i = 0; i < 3; i++) {
              irsend.sendNEC(0xFFE01F, 32);
              Serial.println(message.getString());
              Serial.println("Message sent");
              delay(40);
            }
          }
                      // Send command to Turn LEDs flash
          else if (message.getString("flash")) { 
          for (int i = 0; i < 3; i++) {
              irsend.sendNEC(0xFFD02F, 32);
              Serial.println(message.getString());
              Serial.println("Message sent");
              delay(40);
            }
          }
          // Send command to Turn LEDs Jump7
          else if (message.getString("jump")) { 
          for (int i = 0; i < 3; i++) {
              irsend.sendNEC(0xFFA05F, 32);
              Serial.println(message.getString());
              Serial.println("Message sent");
              delay(40);
            }
          }
          else{ 
            // if nothing else matches, do the default
            // default is optional
            Serial.println("Nicht belegt");
            }
         }
       }
      
      posted in Troubleshooting
      siod
      siod
    • RE: How to send MQTT message from controller to Node?

      This the code I got so far, which does not work 😞

      #define MY_RADIO_NRF24 //MySensor Library auf NRF24 Funkmodul einstellen, muss vor MySensor.h Initialisierung geschehen
      // Define Node ID
      #define MY_NODE_ID 5
      //#define MY_PARENT_NODE_ID 50 //Repeater Node 1!
      //#define MY_PARENT_NODE_IS_STATIC
      
      #include <MySensors.h>
      #include <SPI.h>
      #include <IRremote.h>
      
      #define CHILD_ID 1   // Id of the sensor child
      
      IRsend irsend;
      
      // Initialize motion message
      MyMessage msg(CHILD_ID, V_IR_SEND);
      
      void setup()
      {
        Serial.begin(9600);
      }
      
      void presentation()
      {
          // Send the sketch version information to the gateway and Controller
          sendSketchInfo("LED Licht TV Steuerung", "1.0");
      
          // Register all sensors to gw (they will be created as child devices)
          present(CHILD_ID, S_IR);
      }
      
      void loop() {
      
      
      }
      
      void receive(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type == V_IR_SEND) {
          // Send command to Turn LEDs On
          if (message.getString() == "FF02FD") { // ???
            for (int i = 0; i < 3; i++) {
              irsend.sendNEC(0xFF02FD, 32);
              Serial.println(message.getString());
              Serial.println("Message sent");
              delay(40);
            }
          }
        }
      }
      

      edit: from the serial monitor I see that the node receives the "FF02FD" String, but it does not enter this part

          if (message.getString() == "FF02FD") { // ???
            for (int i = 0; i < 3; i++) {
              irsend.sendNEC(0xFF02FD, 32);
              Serial.println(message.getString());
              Serial.println("Message sent");
              delay(40);
            }
          }
      

      edit2:

      This is what I am sending from openhab over MQTT:

      mygateway1-in/5/1/1/0/32
      

      edit3:

      Ok, now I see where it fails:

      message.getString()
      

      contains FF02FD

      but when I say

      if (message.getString() == "FF02FD")
      

      it does not recognise the FF02FD. But I don´t understand why

      edit4:

      Ok, I got it, finally...:

      message.getString("FF02FD");
      

      😲 👊

      posted in Troubleshooting
      siod
      siod
    • RE: How to send MQTT message from controller to Node?

      So, if I want to send HEX Values to the node, can I send them through openahb over MQTT like this (Node 2 / Sensor 2 / SET / NO ACK / V_IR_RECEIVE):

      Switch MQTTTestSwitch  "MQTT Test Switch"  (gBasement)  {mqtt=">[mysensor:mygateway1-in/2/2/1/0/33:command:ON:1E240],>[mysensor:mygateway1-in/2/2/1/0/33:command:OFF:1E249]"}  //????
      

      and pick it up on the node uisng the receive() function like this:

      void receive(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type==V_IR_RECEIVE) {
           // Send command to Turn LEDs On
           if (message.getstring()==1E240){   // ??? 
              Irsend.NEC(1E240)   //send IR command using IRemote Library over IR LED attached to PIN 4
          }
         } 
      

      ??? ??? ???

      Of course I could sned 1 or 0 to turn it On or Off, but when going to send color HEX Codes I thought I should start working whith HEX Codes from the beginning...

      posted in Troubleshooting
      siod
      siod
    • How to send MQTT message from controller to Node?

      Hi,

      I´ve set up a IR sender to control a RGB LED behind my TV. Now I want to communicate with this node using openhab and MQTT over NRF24. Unfortunately I have no idea how to send commands to a node, until now I was only sending informations from the Nodes/Sensors to the controller.

      So, I need to create functions for the Node like

      If command "ON/Off" received from openhab
      -send IR Command for ON/OFF
      If Command "Red" received from openhab
      -send IR Command for color red
      If Command "Fade" received from openhab
      -send IR Command for fading through colors

      I need to know how to send this from openhab or Mosquitto for example and especially how to catch these messages and process them in the Arduino code.

      I guess this is a beginners task but I have no idea where to start...

      Thanks for your help!

      posted in Troubleshooting
      siod
      siod
    • RE: 💬 Motion Sensor

      Hi, I´ve read this above

      "however this sensor requires 5 VDC so you will need to use a step-up regulator if you are running the 3.3V version of the Arduino Pro Mini."

      So I am using 3 V, could you propose a fitting step up regulator so I can use this PIR (best from ebay)? Thank you!

      posted in Announcements
      siod
      siod
    • Repeater Node not working, pls help debug...

      Hi,

      unfortunately I can´t get my first repeater node to work. Actually it worked a few times, now I only get these messages and it is not communicating correctly with my GW:

      Log Parser Link

      This is my repeater node code:

      // Repeater Node1, Repeater Nodes starten bei ID 50
      //#define MY_DEBUG
      #define MY_RADIO_NRF24 //MySensor Library auf NRF24 Funkmodul einstellen, muss vor MySensor.h Initialisierung geschehen
      // Define Node ID
      #define MY_NODE_ID 50
      #define MY_PARENT_NODE_ID 0
      #define MY_PARENT_NODE_IS_STATIC
      #define MY_REPEATER_FEATURE
      
      #include <MySensors.h>
      #include <SPI.h>
      #include "Timer.h"
      
      
      //Variables
      Timer t;
      
      //Messages
      
      //Presentation; present sensors to gateway!
      void presentation(){
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Repeater Node 1", "1.0");
        wait(500);
      }
      
      //Setup
      void setup()  
      {  
        Serial.begin(9600);
        sendImAlive();
        t.every(60000, sendImAlive);
      }
      
      //Starte den Loop
      void loop() 
      {
        Serial.println("Sending Update...");
        t.update();
        Serial.println("...Done!");
      } 
      
      void sendImAlive() {
          sendHeartbeat();
      }
      
      

      I hope you can help me! Thanks in advance!!!

      posted in Troubleshooting
      siod
      siod
    • RE: Pls help debug this...

      @tbowmo I removed the 100 uF cap, now it is working 👍

      posted in Troubleshooting
      siod
      siod
    • Pls help debug this...

      can someone help me debug this output of my repeater node:

      402795 !TSF:MSG:SEND,50-50-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=3,st=NACK:1
      404802 TSM:UPL
      406402 !TSF:MSG:SEND,50-50-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=4,st=NACK:1
      408410 TSM:UPL
      410009 !TSF:MSG:SEND,50-50-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=5,st=NACK:1
      412017 TSM:UPL
      413617 !TSF:MSG:SEND,50-50-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=6,st=NACK:1
      415625 !TSM:UPL:FAIL
      415626 TSM:FPAR
      415628 TSM:FPAR:STATP=0
      415630 TSM:ID
      415632 TSM:ID:OK
      415633 TSM:UPL
      

      this is continuosly repeating.

      posted in Troubleshooting
      siod
      siod
    • RE: 💬 Serial Protocol - 2.x

      @gvorster Thank you for explanation!

      One more thing: I wanted to implement a sendHeartbeat() into a Repeater node (which should never sleep!), where should I put this function and how? When putting it just into the loop it is of course spamming my gateway with heartbeat messages...Is it possible anyway?

      posted in Announcements
      siod
      siod
    • RE: 💬 Serial Protocol - 2.x

      how can I handle sendheartbeat() messages in my controller? What payload will be sent? 1 or 0, True or False...?

      ps I´m using openhab

      posted in Announcements
      siod
      siod
    • RE: Windows GUI/Controller for MySensors

      Hi, I am trying your software but I only get "connection refused" though in the status bar it says Connected... what can I do?

      posted in Controllers
      siod
      siod
    • RE: Slim Node as a Mini 2AA Battery PIR Motion Sensor

      Nope, 2.2 is giving me the same fail trip messages.
      When using IDE 1.6.5 with 1.5.4 I don´t even get it compiled, Arduino is automatically using 2.2.0 library from 1.8.2 version which is, of course, still installed on my system and I don´t want to uninstall it...

      edit: Ok, the way @komaandy proposed is working, though I like the other sketch more...

      edit2: Well, seems like it has sth. to do with the battery sensing: when removing this part from void loop() it works as it is supposed to (see what I commented out between /* and */):

      void loop() 
      {
          //Batterysensor
        // get the battery Voltage
         /*int sensorValue = analogRead(BATTERY_SENSE_PIN);
         #ifdef DEBUG
         #endif
         
         int batteryPcnt = sensorValue / 10;
           
           gw.sendBatteryLevel(batteryPcnt);
           gw.wait(500);
           gw.send(msgbatt.set(batteryPcnt));
           gw.wait(500);
        */
        if (interruptReturn) {  // Woke up by rising pin
        gw.send(msg.set("1"));  // Just send trip (set) commands to controller. (Let controller reset and decide what to do with it.)
        irtCounter++;
      
        }
        
        gw.sleep(3000);  // Make sure everything is stable before start to sleep with interrupts. (don't use "gw.wait()" here). Tests shows false trip ~2s after battery report otherwise.
      
        // Sleep until interrupt comes in on motion sensor or sleep time passed.
        interruptReturn = gw.sleep(MOTION_INPUT_PIN-2,CHANGE, ONE_DAY_SLEEP_TIME);
        // DEBUG_PRINT("interruptReturn: ");DEBUG_PRINTLN(interruptReturn);
      
      } 
      

      edit3: I obviously mixed up things, now it seems like it´s working... I will report back after some time of testing, but this should be my working code:

      /**
       * EgSlimReed2
       * Sketch for Slim Node and HC-SR505 based motion sensor. 
       * Inspired by:
       * - MySensors motion sensor example: http://www.mysensors.org/build/motion
       * - AWI's CR123A based Slim Node motion sensor: http://forum.mysensors.org/topic/2478/slim-cr123a-2aa-battery-node
       *
       * Created by m26872
       * Documentation: http://forum.mysensors.org...
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Test to if node can operate in some way dealing with the Pir extreme sensitivity to noise on Vcc.
       * Version 2.0 - First "production node". "Inactivity day counter" introduced.
       * 
       * DESCRIPTION
       * This sketch will only send trips as "1" to the controller. It's up to the controller to deal with the info. 
       * The motion node will not notify controller when resets back to low state and is ready for a new trip. In reality 
       * this is ~10s. And EVEN IF motion is detected continuously, there will be no new trip until motion has stopped for ~10s.  
       * The HC-SR505 is very noise sensitive and will trigger spuriously for almost any activity 
       * on Vcc (test thoroughly). To run the HC-505 at low voltages (tested flawlessly down to 1.6V), 
       * the 7133-reg and diode are removed (and possibly increase the sensitivity even further). 
       * Solution is to deal with it by interrupt type, check which source, block by sleep time etc.
       * 
       * HC-505 output connects to MOTION_INPUT_PIN (here D3) without any supporting component. Input pull-up disabled.
       * Every 24 hrs without trip, increments a counter and after "BATTERY_REPORT_DAY" counts a battery report will be sent as a heartbeat signal.
       * Else a battery report will be sent after every "BATTERY_REPORT_BY_IRT_CYCLE" motion trips.
       *
       */
      
       #define MY_RADIO_NRF24 //MySensor Library auf NRF24 Funkmodul einstellen, muss vor MySensor.h Initialisierung geschehen
      // Define Node ID
      #define MY_NODE_ID 21
      #define MY_PARENT_NODE_ID 0 //Repeater Node 1=50 / Gateway=0!
      #define MY_PARENT_NODE_IS_STATIC
      
      //Batterysensor
      int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
      int oldBatteryPcnt = 0;
      #define CHILD_ID_BATT 7
       
      #include <MySensor.h>
      #include <SPI.h>
      #include <Vcc.h>
      
      //#define DEBUG
      
      #define SKETCH_NAME "Motion PIR Keller_1"
      #define SKETCH_VERSION "2.0"
      #define CHILD_ID 1
      #define MOTION_INPUT_PIN 3
      #define BATTERY_REPORT_DAY 2   // Desired heartbeat(battery report) interval when inactive. 
      #define BATTERY_REPORT_BY_IRT_CYCLE 10  // Make a battery report after this many trips. Maximum report interval will also be equal to this number of days.
      #define ONE_DAY_SLEEP_TIME 86400000
      #define VCC_MIN 1.9
      #define VCC_MAX 3.3
      
      
      #ifdef DEBUG
      #define DEBUG_SERIAL(x) Serial.begin(x)
      #define DEBUG_PRINT(x) Serial.print(x)
      #define DEBUG_PRINTLN(x) Serial.println(x)
      #else
      #define DEBUG_SERIAL(x)
      #define DEBUG_PRINT(x) 
      #define DEBUG_PRINTLN(x) 
      #endif
      
      int dayCounter = BATTERY_REPORT_DAY;
      int irtCounter = 0;
      
      
      bool interruptReturn = false; // "false" will make the first loop disregard high output from HV-505 (from start-up) and make a battery report instead.
       
      Vcc vcc;
      MySensor gw;
      MyMessage msg(CHILD_ID, V_TRIPPED);
      //Battery
      MyMessage msgbatt(CHILD_ID_BATT,V_VOLTAGE);
      
      void setup()  
      {  
            //Batterysensor
           // use the 1.1 V internal reference
      #if defined(__AVR_ATmega2560__)
         analogReference(INTERNAL1V1);
      #else
         analogReference(INTERNAL);
      #endif
      
        DEBUG_SERIAL(9600);
        DEBUG_PRINTLN(("Serial started"));
        delay(100); // to settle power for radio
        gw.begin(NULL,MY_NODE_ID);
        pinMode(MOTION_INPUT_PIN, INPUT);
        digitalWrite(MOTION_INPUT_PIN, LOW);    // Disable internal pull-ups
        gw.sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
        gw.present(CHILD_ID, S_MOTION);
        DEBUG_PRINTLN("Warming and blocking PIR trip for 20s.");
        gw.sleep(20000); // Wait until HC-505 warmed-up and output returned low.
      }
      void presentation()
      {
          // Send the sketch version information to the gateway and Controller
          gw.sendSketchInfo("Motion Sensor Keller_1", "1.0");
      
          // Register all sensors to gw (they will be created as child devices)
          gw.present(CHILD_ID, S_MOTION);
          
          //Battery
          gw.present(CHILD_ID_BATT,V_VOLTAGE);
      }
      
      void loop() 
      {
          //Batterysensor
        // get the battery Voltage
         /*int sensorValue = analogRead(BATTERY_SENSE_PIN);
         #ifdef DEBUG
         #endif
         
         int batteryPcnt = sensorValue / 10;
           
           gw.sendBatteryLevel(batteryPcnt);
           gw.wait(500);
           gw.send(msgbatt.set(batteryPcnt));
           gw.wait(500);
        */
        if (interruptReturn) {  // Woke up by rising pin
        gw.send(msg.set("1"));  // Just send trip (set) commands to controller. (Let controller reset and decide what to do with it.)
          irtCounter++;
        if (irtCounter>=BATTERY_REPORT_BY_IRT_CYCLE) {
          irtCounter=0;
          sendBatteryReport();
        }
        }
        else { // Woke up by timer  (or it's the first run)
        dayCounter++; 
        if (dayCounter >= BATTERY_REPORT_DAY) {
            dayCounter = 0;
            sendBatteryReport();
        }
        }
      
        
        
        gw.sleep(3000);  // Make sure everything is stable before start to sleep with interrupts. (don't use "gw.wait()" here). Tests shows false trip ~2s after battery report otherwise.
      
        // Sleep until interrupt comes in on motion sensor or sleep time passed.
        interruptReturn = gw.sleep(MOTION_INPUT_PIN-2,CHANGE, ONE_DAY_SLEEP_TIME);
        // DEBUG_PRINT("interruptReturn: ");DEBUG_PRINTLN(interruptReturn);
      
      } 
      
      void sendBatteryReport() {
            float p = vcc.Read_Perc(VCC_MIN, VCC_MAX, true);
            int batteryPcnt = static_cast<int>(p);
            gw.sendBatteryLevel(batteryPcnt);
      }
      

      edit4: ok, with my edited code this sketch is also working fine now with IDE 1.8.2 and lib 2.2.0 beta. So now everythings works fine!

      /**
       * EgSlimReed2
       * Sketch for Slim Node and HC-SR505 based motion sensor. 
       * Inspired by:
       * - MySensors motion sensor example: http://www.mysensors.org/build/motion
       * - AWI's CR123A based Slim Node motion sensor: http://forum.mysensors.org/topic/2478/slim-cr123a-2aa-battery-node
       *
       * Created by m26872
       * Documentation: http://forum.mysensors.org...
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Test to if node can operate in some way dealing with the Pir extreme sensitivity to noise on Vcc.
       * Version 2.0 - First "production node". "Inactivity day counter" introduced.
       * 
       * DESCRIPTION
       * This sketch will only send trips as "1" to the controller. It's up to the controller to deal with the info. 
       * The motion node will not notify controller when resets back to low state and is ready for a new trip. In reality 
       * this is ~10s. And EVEN IF motion is detected continuously, there will be no new trip until motion has stopped for ~10s.  
       * The HC-SR505 is very noise sensitive and will trigger spuriously for almost any activity 
       * on Vcc (test thoroughly). To run the HC-505 at low voltages (tested flawlessly down to 1.6V), 
       * the 7133-reg and diode are removed (and possibly increase the sensitivity even further). 
       * Solution is to deal with it by interrupt type, check which source, block by sleep time etc.
       * 
       * HC-505 output connects to MOTION_INPUT_PIN (here D3) without any supporting component. Input pull-up disabled.
       * Every 24 hrs without trip, increments a counter and after "BATTERY_REPORT_DAY" counts a battery report will be sent as a heartbeat signal.
       * Else a battery report will be sent after every "BATTERY_REPORT_BY_IRT_CYCLE" motion trips.
       *
       */
      
       //Sensor 21, erster PIR Sensor
      
      #define MY_RADIO_NRF24 //MySensor Library auf NRF24 Funkmodul einstellen, muss vor MySensor.h Initialisierung geschehen
      // Define Node ID
      #define MY_NODE_ID 21
      #define MY_PARENT_NODE_ID 50 //Repeater Node 1!
      #define MY_PARENT_NODE_IS_STATIC
      
      //Batterysensor
      int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
      int oldBatteryPcnt = 0;
      #define CHILD_ID_BATT 7
       
      #include <MySensors.h>
      #include <SPI.h>
      #include <Vcc.h>
      
      
      unsigned long SLEEP_TIME = 86400000; // Sleep time between reports (in milliseconds)
      #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      #define CHILD_ID 1   // Id of the sensor child
      #define BATTERY_REPORT_DAY 2   // Desired heartbeat(battery report) interval when inactive. 
      #define BATTERY_REPORT_BY_IRT_CYCLE 10  // Make a battery report after this many trips. Maximum report interval will also be equal to this number of days.
      #define ONE_DAY_SLEEP_TIME 86400000
      #define VCC_MIN 1.9
      #define VCC_MAX 3.3
      
      int dayCounter = BATTERY_REPORT_DAY;
      int irtCounter = 0;
      bool interruptReturn = false; // "false" will make the first loop disregard high output from HV-505 (from start-up) and make a battery report instead.
      Vcc vcc;
      
      //Battery
      MyMessage msgbatt(CHILD_ID_BATT,V_VOLTAGE);
      // Initialize motion message
      MyMessage msg(CHILD_ID, V_TRIPPED);
      
      void setup()
      {
          pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
      
          //Batterysensor
           // use the 1.1 V internal reference
      #if defined(__AVR_ATmega2560__)
         analogReference(INTERNAL1V1);
      #else
         analogReference(INTERNAL);
      #endif
      }
      
      void presentation()
      {
          // Send the sketch version information to the gateway and Controller
          sendSketchInfo("Motion Sensor Keller_1", "1.0");
      
          // Register all sensors to gw (they will be created as child devices)
          present(CHILD_ID, S_MOTION);
          
          //Battery
          present(CHILD_ID_BATT,V_VOLTAGE);
      }
      
      void loop()
      {
          //Batterysensor
        // get the battery Voltage
         /*int sensorValue = analogRead(BATTERY_SENSE_PIN);
         #ifdef DEBUG
         #endif
         
         // 1M, 470K divider across battery and using internal ADC ref of 1.1V
         // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
         // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
         // 3.44/1023 = Volts per bit = 0.003363075
         //float batteryV  = sensorValue * 0.003363075;
         int batteryPcnt = sensorValue / 10;
           
           sendBatteryLevel(batteryPcnt);
           wait(500);
           send(msgbatt.set(batteryPcnt));
           wait(500);
          */
          // Read digital motion value
          bool tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;
      
          Serial.println(tripped);
          send(msg.set(tripped?"1":"0"));  // Send tripped value to gw
      
              irtCounter++;
        if (irtCounter>=BATTERY_REPORT_BY_IRT_CYCLE) {
          irtCounter=0;
          sendBatteryReport();
        }
        else { // Woke up by timer  (or it's the first run)
        dayCounter++; 
        if (dayCounter >= BATTERY_REPORT_DAY) {
            dayCounter = 0;
            sendBatteryReport();
        }
        }
      
          sleep(3000);  // Sleep 3s to make sure everything is stable before we start to sleep with interrupts.
      
          // Sleep until interrupt comes in on motion sensor. Send update every 24 hours.
          sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
      }
      void sendBatteryReport() {
            float p = vcc.Read_Perc(VCC_MIN, VCC_MAX, true);
            int batteryPcnt = static_cast<int>(p);
            sendBatteryLevel(batteryPcnt);
      }
      
      posted in My Project
      siod
      siod
    • RE: Slim Node as a Mini 2AA Battery PIR Motion Sensor

      ok guys, I tried the mini PIR and the big one, on the mini PIR I removed the regulator and diode just as explained and I uploaded this sketch

      /**
       * EgSlimReed2
       * Sketch for Slim Node and HC-SR505 based motion sensor. 
       * Inspired by:
       * - MySensors motion sensor example: http://www.mysensors.org/build/motion
       * - AWI's CR123A based Slim Node motion sensor: http://forum.mysensors.org/topic/2478/slim-cr123a-2aa-battery-node
       *
       * Created by m26872
       * Documentation: http://forum.mysensors.org...
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Test to if node can operate in some way dealing with the Pir extreme sensitivity to noise on Vcc.
       * Version 2.0 - First "production node". "Inactivity day counter" introduced.
       * 
       * DESCRIPTION
       * This sketch will only send trips as "1" to the controller. It's up to the controller to deal with the info. 
       * The motion node will not notify controller when resets back to low state and is ready for a new trip. In reality 
       * this is ~10s. And EVEN IF motion is detected continuously, there will be no new trip until motion has stopped for ~10s.  
       * The HC-SR505 is very noise sensitive and will trigger spuriously for almost any activity 
       * on Vcc (test thoroughly). To run the HC-505 at low voltages (tested flawlessly down to 1.6V), 
       * the 7133-reg and diode are removed (and possibly increase the sensitivity even further). 
       * Solution is to deal with it by interrupt type, check which source, block by sleep time etc.
       * 
       * HC-505 output connects to MOTION_INPUT_PIN (here D3) without any supporting component. Input pull-up disabled.
       * Every 24 hrs without trip, increments a counter and after "BATTERY_REPORT_DAY" counts a battery report will be sent as a heartbeat signal.
       * Else a battery report will be sent after every "BATTERY_REPORT_BY_IRT_CYCLE" motion trips.
       *
       */
      
       //Sensor 21, erster PIR Sensor
      
      #define MY_RADIO_NRF24 //MySensor Library auf NRF24 Funkmodul einstellen, muss vor MySensor.h Initialisierung geschehen
      // Define Node ID
      #define MY_NODE_ID 21
      #define MY_PARENT_NODE_ID 0 //Repeater Node 1!
      #define MY_PARENT_NODE_IS_STATIC
      
      //Batterysensor
      int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
      int oldBatteryPcnt = 0;
      #define CHILD_ID_BATT 7
       
      #include <MySensors.h>
      #include <SPI.h>
      #include <Vcc.h>
      
      
      unsigned long SLEEP_TIME = 86400000; // Sleep time between reports (in milliseconds)
      #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      #define CHILD_ID 1   // Id of the sensor child
      
      //Battery
      MyMessage msgbatt(CHILD_ID_BATT,V_VOLTAGE);
      // Initialize motion message
      MyMessage msg(CHILD_ID, V_TRIPPED);
      
      void setup()
      {
          pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
      
          //Batterysensor
           // use the 1.1 V internal reference
      #if defined(__AVR_ATmega2560__)
         analogReference(INTERNAL1V1);
      #else
         analogReference(INTERNAL);
      #endif
      }
      
      void presentation()
      {
          // Send the sketch version information to the gateway and Controller
          sendSketchInfo("Motion Sensor Keller_1", "1.0");
      
          // Register all sensors to gw (they will be created as child devices)
          present(CHILD_ID, S_MOTION);
          
          //Battery
          present(CHILD_ID_BATT,V_VOLTAGE);
      }
      
      void loop()
      {
          //Batterysensor
        // get the battery Voltage
         int sensorValue = analogRead(BATTERY_SENSE_PIN);
         #ifdef DEBUG
         #endif
         
         // 1M, 470K divider across battery and using internal ADC ref of 1.1V
         // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
         // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
         // 3.44/1023 = Volts per bit = 0.003363075
         //float batteryV  = sensorValue * 0.003363075;
         int batteryPcnt = sensorValue / 10;
           
           sendBatteryLevel(batteryPcnt);
           wait(500);
           send(msgbatt.set(batteryPcnt));
           wait(500);
          // Read digital motion value
          bool tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;
      
          Serial.println(tripped);
          send(msg.set(tripped?"1":"0"));  // Send tripped value to gw
      
          sleep(3000);  // Sleep 3s to make sure everything is stable before we start to sleep with interrupts.
      
          // Sleep until interrupt comes in on motion sensor. Send update every 24 hours.
          sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
      }
      

      But with any PIR I get continuos trip messages every 3 seconds. Any idea?

      posted in My Project
      siod
      siod
    • Who can Debug this GW Messages?

      when trying to connect one node with my Gateway I get these messages from my gateway:

      0;255;3;0;9;TSP:MSG:READ 21-21-0 s=255,c=3,t=24,pt=1,l=1,sg=0:1
      0;255;3;0;9;TSP:MSG:PINGED (ID=21, hops=1)
      0;255;3;0;9;!TSP:MSG:SEND 0-0-21-21 s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=fail:1
      

      Can someone explain what this exactly means?

      https://www.mysensors.org/build/parser?log=0%3B255%3B3%3B0%3B9%3BTSP%3AMSG%3AREAD 21-21-0 s%3D255%2Cc%3D3%2Ct%3D24%2Cpt%3D1%2Cl%3D1%2Csg%3D0%3A1 0%3B255%3B3%3B0%3B9%3BTSP%3AMSG%3APINGED (ID%3D21%2C hops%3D1) 0%3B255%3B3%3B0%3B9%3B!TSP%3AMSG%3ASEND 0-0-21-21 s%3D255%2Cc%3D3%2Ct%3D25%2Cpt%3D1%2Cl%3D1%2Csg%3D0%2Cft%3D0%2Cst%3Dfail%3A1

      posted in Troubleshooting
      siod
      siod
    • RE: Repeater Node Question

      ok, thanks for clarifying this!

      posted in Troubleshooting
      siod
      siod
    • RE: Repeater Node Question

      one more question: that´s what I have so far, is this all? I think I´ve read somewehere that there must be a special command included and I also read this:

      // Repeater Node1, Repeater Nodes starten bei ID 50
      #define MY_RADIO_NRF24 //MySensor Library auf NRF24 Funkmodul einstellen, muss vor MySensor.h Initialisierung geschehen
      // Define Node ID
      #define MY_NODE_ID 50
      #define MY_PARENT_NODE_ID 0
      #define MY_PARENT_NODE_IS_STATIC
      #define MY_REPEATER_FEATURE
      
      #include <MySensors.h>
      #include <SPI.h>
      
      //Messages
      
      //Presentation; present sensors to gateway!
      void presentation(){
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Repeater Node 1", "1.0");
        wait(500);
      }
      
      //Setup
      void setup()  
      {  
      
      }
      
      //Starte den Loop
      void loop() 
      {
          
        
      } 
      

      *Handling incoming radio messages
      Nodes that expects incoming data, such as an actuator or repeating nodes, must implement the receive()-function to handle the incoming messages. Do not sleep a node where you expect incoming data or you will lose messages.

      void receive(const MyMessage &message)
      message - The incoming message data*

      where do I have to add this?

      posted in Troubleshooting
      siod
      siod
    • RE: Repeater Node Question

      @mfalkvidd great, thanks for your quick and short answer! 👍

      posted in Troubleshooting
      siod
      siod
    • Repeater Node Question

      Hi,

      I would like to add a repeater Node to my Network and I would like to know a few things:

      MY_PARENT_ID for the repeater node is the gateways ID, right? So which MY_PARENT_ID will the repeated Nodes have? The ID of the Repeater Node?

      Does someone have an example sketch of a repeater node for me?

      Thanks in advance!

      posted in Troubleshooting
      siod
      siod
    • RE: My Slim 2AA Battery Node

      just want to mention that I am using successfully the same Bootloader @Komaandy is using for about 2 weeks now. So it seems like my problems with freezing nodes are depending on a bad or too slow bootloader...

      posted in My Project
      siod
      siod
    • RE: Slim Node as a Mini 2AA Battery PIR Motion Sensor

      @m26872 said in Slim Node as a Mini 2AA Battery PIR Motion Sensor:

      Removing the 7133-regulator did not affect anything significantly due to its very low quiescent current (see datasheet, perhaps useful in some other project?)

      ok, does that mean one does not have to remove the voltage regulator and the diode? @AWI is saying one must modify the PIR and now I am irritated...

      posted in My Project
      siod
      siod
    • RE: 💬 Various bootloader files based on Optiboot 6.2

      Hi guys,

      thx for your quick reply. I could upload the bootloader using ver 1.6.5 of the Arduino IDE. After that I realized ther is already a 1.8.2 version released which is closing the gaps between arduino.cc and arduino.org.
      I havent tested this version now, but I guess it was just an IDE error, so everything´s fine now...

      posted in OpenHardware.io
      siod
      siod
    • RE: 💬 Various bootloader files based on Optiboot 6.2

      Hi guys,

      I am getting an errror when trying to burn the bootloader, any idea what´s wrong? Im using Arduino IDE 1.6.10 and these settings:
      0_1495966865551_upload-48973443-91a2-4504-a73b-96557383d6bf

      and that´s the error:

      avrdude: Version 6.3, compiled on Jun 22 2016 at 16:05:21
               Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
               Copyright (c) 2007-2014 Joerg Wunsch
      
               System wide configuration file is "T:\Programme\Arduino 1.6.10\hardware\tools\avr/etc/avrdude.conf"
      
               Using Port                    : COM10
               Using Programmer              : stk500v1
               Overriding Baud Rate          : 19200
               AVR Part                      : ATmega328P
               Chip Erase delay              : 9000 us
               PAGEL                         : PD7
               BS2                           : PC2
               RESET disposition             : dedicated
               RETRY pulse                   : SCK
               serial program mode           : yes
               parallel program mode         : yes
               Timeout                       : 200
               StabDelay                     : 100
               CmdexeDelay                   : 25
               SyncLoops                     : 32
               ByteDelay                     : 0
               PollIndex                     : 3
               PollValue                     : 0x53
               Memory Detail                 :
      
                                        Block Poll               Page                       Polled
                 Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
                 ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
                 eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
                 flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                 lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                 hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                 efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                 lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                 calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                 signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
      
               Programmer Type : STK500
               Description     : Atmel STK500 Version 1.x firmware
               Hardware Version: 2
               Firmware Version: 1.18
               Topcard         : Unknown
               Vtarget         : 0.0 V
               Varef           : 0.0 V
               Oscillator      : Off
               SCK period      : 0.1 us
      
      avrdude: AVR device initialized and ready to accept instructions
      
      Reading | ################################################## | 100% 0.06s
      
      avrdude: Device signature = 0x1e950f (probably m328p)
      avrdude: erasing chip
      avrdude: reading input file "0x3F"
      avrdude: writing lock (1 bytes):
      
      Writing | ################################################## | 100% 0.03s
      
      avrdude: 1 bytes of lock written
      avrdude: verifying lock memory against 0x3F:
      avrdude: load data lock data from input file 0x3F:
      avrdude: input file 0x3F contains 1 bytes
      avrdude: reading on-chip lock data:
      
      Reading | ################################################## | 100% 0.02s
      
      avrdude: verifying ...
      avrdude: 1 bytes of lock verified
      avrdude: reading input file "0x06"
      avrdude: writing efuse (1 bytes):
      
      Writing |  ***failed;  
      ################################################## | 100% 0.16s
      
      avrdude: 1 bytes of efuse written
      avrdude: verifying efuse memory against 0x06:
      avrdude: load data efuse data from input file 0x06:
      avrdude: input file 0x06 contains 1 bytes
      avrdude: reading on-chip efuse data:
      
      Fehler beim Brennen des Bootloaders.
      Reading | ################################################## | 100% 0.02s
      
      avrdude: verifying ...
      avrdude: verification error, first mismatch at byte 0x0000
               0xfe != 0x06
      avrdude: verification error; content mismatch
      
      avrdude done.  Thank you.
      
      posted in OpenHardware.io
      siod
      siod
    • RE: My Slim 2AA Battery Node

      @m26872 First of all: I already got so much help and I am very grateful for that, awesome community!

      I don´t think I will ever find the problem with those sensors and because of the lack of time I have (familiy, work...) I think looking for the problem would take longer than just build a new sensor. And that´s what I will do next: I will just build another node, one step after the other and so I can validate if it maybe is a hardware problem or a code problem. BTW my whole sketch is just a few posts above this one...

      So I will come back after I started over...

      posted in My Project
      siod
      siod
    • RE: My Slim 2AA Battery Node

      Hi @Komaandy ,

      unfortunately I must report that I made the same expiriences you made. I am running 5 "My SLim 2AA Battery Node" Sensors from which only 2 really work. The others keep freezing after an hour, a day, are sometimes after a few days. I have still no idea why this is happening, but because of this I stopped building more of the "My SLim 2AA Battery Node" sensors, which is very sad, because it´s an ingeniuous design.

      I am using MQTT and therefore I installed NRF24L01 modules. Some of them are really weak, so I thought that´s the problem: The node does not freeze, it´s just the NRF24L01 that is not sending any info anymore. So I attached a LED to my node to see if it is still alive. Whenever I opened a window the LED must lid. So when I did not got any info from the node I checked if the node is still operational by opening a window and there I noticed when the LED did not lid, that the node was completely frozen. So It was not a wireless connection problem, but the NRF24L01 of course could still be the problem.
      A lot of my investigastions was about figuring out what is happening when entering the sleep mode, because I thought (and still believe) the node is just not waking up from sleep anymore. Unluckily I still did not find a solution.
      Anywhere you said that the none battery driven nodes are working flawlessly, that´s another point I was thinking about. I have one MQTT Arduino Nano device in the basement which is directly powered over USB and I never had problems with it, also the MQTT / NRF24L01 range is awesome.
      But I have no oscillator or anything to check if it a power problem with the "My Slim 2AA Battery Node".
      Maybe you´ll find a solution for your problems which could help me, too. I´m looking forward hearing from you.

      posted in My Project
      siod
      siod
    • Security System - send message like TCP/with confirmation

      Hi Guys,

      I´d like to setup a home security system based on MySensors using MQTT. Because a security system must be 100% reliable I must confirm that a message like "Door opened" reaches first: the gateway, second: the controller (openhab in my case).
      From my point of view this can only be achieved if the sensor is not only sending the info about the open/closed state of a door, but also receives an acknowledge that the sent messages received the Controller, because that´s the point where the user gets the info from. So the node should send the state message again and again until it receives the info like "message reached controller, stop sending now".
      Any idea how I can realise this? I´ve read a lot about "ACK" but I don´t think that´s what I need!? Thanks in advance!

      posted in Development
      siod
      siod
    • RE: Multiple sensor node freeze

      Hi guys,

      can you report an update? I also have problems with freezing nodes, did you find a solution?

      Thank you!!

      posted in Bug Reports
      siod
      siod
    • Send custom Message to gw

      Hi,

      I would like to send some Info like node ID to the gw and from there to my Controller which is openhab. How can I achieve that?

      posted in Troubleshooting
      siod
      siod
    • RE: My Slim 2AA Battery Node

      deleted - it´s working now, I must have made a mistake... 😊

      edit:

      one strange thing: The sensor should report every 15 minutes (900000 milisecs), but it reports only every 18 minutes. Don´t know why.

      posted in My Project
      siod
      siod
    • RE: My Slim 2AA Battery Node

      @m26872 said in My Slim 2AA Battery Node:

      @siod
      Gateway issue? Other sensors working or all down at same time? Do you have a sniffer or listen-only gateway, or heartbeat LED attached to each sensor?

      What's the purpose of the delay(1000)? It usually safer to use wait() or sleep() and perhaps also to deal with the interrupt results first. You could also try level interrupt instead of "change". You're not using indefinite sleep so it shouldn't be a problem, but try anyway..

      @m26872
      Gateway seems to work fine as the 3rd and still working sensor is still communicating. Also the freezed sensors start communicating after I restarted the sensor, not the GW. So I don´t see a problem with the GW.
      "Do you have a sniffer or listen-only gateway" -sorry, don´t know what this is o0 !?
      I have not attached a heartbeat LED yet, but that´s sth. I could do as a next step...
      The delay (1000) was initially planned to settle the sensors a bit and gie me abetter Battery reading, but as it is not working as it was intended I will delete it in a future update...
      You could also try level interrupt instead of "change" -again, I don´t know what you are talking about here, hope you can help me out.

      Thanks so far!!

      posted in My Project
      siod
      siod
    • RE: My Slim 2AA Battery Node

      No, not really, but if you want to you can check my code:

      // Sensor Node Schlafzimmer mit HTU21D Temp/Hum Sensor, Fensterkontakte an Interrupt PINS Digital 5&6. Sleep Time 15 Minutwn, wake up wenn Fenster geöffnet/geschlossen wird.
      #define MY_RADIO_NRF24 //MySensor Library auf NRF24 Funkmodul einstellen, muss vor MySensor.h Initialisierung geschehen
      // Define Node ID
      #define MY_NODE_ID 1
      #define MY_PARENT_NODE_ID 0
      #define MY_PARENT_NODE_IS_STATIC
      
      //Batterysensor
      int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
      int oldBatteryPcnt = 0;
      #define CHILD_ID_BATT 7
      
      //Kontaktschalter
      //#include <Bounce2.h>
      #define CHILD1_ID 1 // Kontaktschalter 1
      #define CHILD2_ID 2 // Kontaktschalter 2
      #define BUTTON1_PIN  2  // Kontaktschalter 1
      #define BUTTON2_PIN  3  // Kontaktschalter 2
      int oldValueReed1=-1;
      int oldValueReed2=-1;
      
      //Tempsensor
      #include <SparkFunHTU21D.h>
      #include <Wire.h>
      #define CHILD_ID_HUM 3
      #define CHILD_ID_TEMP 4
      unsigned long SLEEP_TIME = 900000; // Sleep time between reads (in milliseconds)
      
      #include <MySensors.h>
      #include <SPI.h>
      
      //tempsensor
      HTU21D myHumidity;
      float lastTemp;
      float lastHum;
      //boolean metric = true; 
      
      //Messages
      //Battery
      MyMessage msgbatt(CHILD_ID_BATT,V_VOLTAGE);
      // Kontaktschalter
      MyMessage msgReed1(CHILD1_ID,V_TRIPPED); // Kontaktschalter 1
      MyMessage msgReed2(CHILD2_ID,V_TRIPPED); // Kontaktschalter 2
      //TempMessage
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      
      //Presentation; present sensors to gateway!
      void presentation(){
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Schlafzimmer Messstation", "2.0");
          
        // Register binary input sensor to gw (they will be created as child devices)
        // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 
        // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
        present(CHILD1_ID, S_DOOR); 
        present(CHILD2_ID, S_DOOR); 
          
        //Tempsensor
        present(CHILD_ID_HUM, S_HUM);
        present(CHILD_ID_TEMP, S_TEMP); 
        //metric = getConfig().isMetric;
      
        //Battery
        present(CHILD_ID_BATT,V_VOLTAGE);
      }
      
      //Setup
      void setup()  
      {  
        //Serial.begin(9600);
        Serial.println("Hello!");
        //Batterysensor
           // use the 1.1 V internal reference
      #if defined(__AVR_ATmega2560__)
         analogReference(INTERNAL1V1);
      #else
         analogReference(INTERNAL);
      #endif
      
      //Tempsensor
        Serial.println("Setting up TempSensor...");
        myHumidity.begin();
        Serial.println("...done!");
      
      // Setup Kontaktschalter 1
        pinMode(BUTTON1_PIN,INPUT);
          // Activate internal pull-up
        digitalWrite(BUTTON1_PIN,HIGH);
      // Setup Kontaktschalter 2
        pinMode(BUTTON2_PIN,INPUT);
        // Activate internal pull-up
        digitalWrite(BUTTON2_PIN,HIGH);
      }
      
      //Starte den Loop
      void loop() 
      {
        //Batterysensor
        // get the battery Voltage
        delay(1000);
         int sensorValue = analogRead(BATTERY_SENSE_PIN);
         #ifdef DEBUG
         #endif
         
         // 1M, 470K divider across battery and using internal ADC ref of 1.1V
         // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
         // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
         // 3.44/1023 = Volts per bit = 0.003363075
         float batteryV  = sensorValue * 0.003363075;
         int batteryPcnt = sensorValue / 10;
      
         #ifdef DEBUG
         Serial.print("Battery Voltage: ");
         Serial.print(batteryV);
         Serial.println(" V");
      
         Serial.print("Battery percent: ");
         Serial.print(batteryPcnt);
         Serial.println(" %");
         #endif
      
         if (oldBatteryPcnt != batteryPcnt) {
           // Power up radio after sleep
           sendBatteryLevel(batteryPcnt);
           send(msgbatt.set(batteryPcnt));
           oldBatteryPcnt = batteryPcnt;
         }
         
        //Kontakstschalter 1
         // Short delay to allow buttons to properly settle
        wait(10);
        // Get the update value
        int valueReed1 = digitalRead(BUTTON1_PIN);
       
        if (valueReed1 != oldValueReed1) {
           // Send in the new value
           send(msgReed1.set(valueReed1==HIGH ? 1 : 0));
           Serial.println("Button 1 geschaltet");
           oldValueReed1 = valueReed1;
        }
        //Kontakstschalter 2
        // Get the update value
        int valueReed2 = digitalRead(BUTTON2_PIN);
       
        if (valueReed2 != oldValueReed2) {
           // Send in the new value
           send(msgReed2.set(valueReed2==HIGH ? 1 : 0));
           Serial.println("Button 2 geschaltet");
           oldValueReed2 = valueReed2;
        }
       
       //Tempsensor
      Serial.println("Starte Messung...");
        
          float temp = myHumidity.readTemperature();
      
        if (isnan(temp)) {
            Serial.println("Failed reading temperature from DHT");
        } else if (temp != lastTemp) {
          lastTemp = temp;
          send(msgTemp.set(temp, 1));
          Serial.print("T: ");
          Serial.println(temp);
        }
        
       float humd = myHumidity.readHumidity();
        if (isnan(humd)) {
            Serial.println("Failed reading humidity from DHT");
        } else if (humd != lastHum) {
            lastHum = humd;
            send(msgHum.set(humd, 1));
            Serial.print("H: ");
            Serial.println(humd);
        }
      
       Serial.println("Sleep...");
       sleep(BUTTON1_PIN - 2, CHANGE, BUTTON2_PIN - 2, CHANGE, SLEEP_TIME); //sleep a bit 
        
      } 
      
      
      posted in My Project
      siod
      siod
    • RE: My Slim 2AA Battery Node

      Ok, just want to give you an update:

      I have 3 sensors running in the moment, initially I planned to run a lot more, but I still have problems with freezing of the sensors. The Sensors ran 2 months now until they were not coummunicating anymore, 1 is still working. I restarted 1 of the freezed sensors and it just came back up and works fine again, I leave the other one "freezed" just to see if it would come up again...

      It´s sad that they are not very reliable but I don´t get what makes them freeze after working quiet good for such a long time (they are reporting every 15 minutes 24/7 and whenever a window is opened/closed).

      I don´t think it´s a temp thing, also power should be no problem, batteries are still about 80 % loaded...

      posted in My Project
      siod
      siod
    • RE: gw.sleep on battery powered magnet door switch

      Ok guys you convinced me, I will set them LOW instead of HIGH.

      So now the reed switches are connected: GND | Reed Switch | PIN 2
      Doing it your way I must connect them: VCC | 1M Ohm Resistor | Reed Switch | PIN2

      Correct?

      I just did it the way described here: https://www.mysensors.org/build/binary
      There is nothing abaout any resistor...

      But will this solve my problem? I am not sure. I had the feeling that the sensors won´t wake up from sleep or so...

      posted in My Project
      siod
      siod
    • RE: gw.sleep on battery powered magnet door switch

      No gentlemen, I don´t think it is a battery problem, maybe a radio problem, but not a battery problem.

      But my sketch seems to be ok?

      posted in My Project
      siod
      siod
    • RE: gw.sleep on battery powered magnet door switch

      no Sir, batteries are still at around 90% charged.

      posted in My Project
      siod
      siod
    • RE: gw.sleep on battery powered magnet door switch

      Hi guys,

      unfortunately I have to answer again to this topic because I don´t get my nodes work longer then up to two weeks. I guess it is still a sleep function problem and the problem persits though I am usin ver 2.0 now. Please have a look at my code, any hint is very appreciated!!

      I have attached 2 reed switches which should trigger a wakeup and one Hum/Temp Sensor is attached, too. I would like the device to send temp/hum measurements every 15 minutes, what works, but only for a few days or so. Then I also send battery level, that´s all.

      I have 3 devices up and running right now, they all fail once in while...

      // Sensor Node Schlafzimmer mit HTU21D Temp/Hum Sensor, Fensterkontakte an Interrupt PINS Digital 5&6. Sleep Time 15 Minutwn, wake up wenn Fenster geöffnet/geschlossen wird.
      #define MY_RADIO_NRF24 //MySensor Library auf NRF24 Funkmodul einstellen, muss vor MySensor.h Initialisierung geschehen
      // Define Node ID
      #define MY_NODE_ID 200
      
      //Batterysensor
      int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
      int oldBatteryPcnt = 0;
      #define CHILD_ID_BATT 7
      
      //Kontaktschalter
      //#include <Bounce2.h>
      #define CHILD1_ID 1 // Kontaktschalter 1
      #define CHILD2_ID 2 // Kontaktschalter 2
      #define BUTTON1_PIN  2  // Kontaktschalter 1
      #define BUTTON2_PIN  3  // Kontaktschalter 2
      int oldValueReed1=-1;
      int oldValueReed2=-1;
      
      //Tempsensor
      #include <SparkFunHTU21D.h>
      #include <Wire.h>
      #define CHILD_ID_HUM 3
      #define CHILD_ID_TEMP 4
      unsigned long SLEEP_TIME = 900000; // Sleep time between reads (in milliseconds)
      
      #include <MySensors.h>
      #include <SPI.h>
      
      //tempsensor
      HTU21D myHumidity;
      float lastTemp;
      float lastHum;
      //boolean metric = true; 
      
      //Messages
      //Battery
      MyMessage msgbatt(CHILD_ID_BATT,V_VOLTAGE);
      // Kontaktschalter
      MyMessage msgReed1(CHILD1_ID,V_TRIPPED); // Kontaktschalter 1
      MyMessage msgReed2(CHILD2_ID,V_TRIPPED); // Kontaktschalter 2
      //TempMessage
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      
      //Presentation; present sensors to gateway!
      void presentation(){
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Schlafzimmer Messstation", "2.0");
          
        // Register binary input sensor to gw (they will be created as child devices)
        // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 
        // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
        present(CHILD1_ID, S_DOOR); 
        present(CHILD2_ID, S_DOOR); 
          
        //Tempsensor
        present(CHILD_ID_HUM, S_HUM);
        present(CHILD_ID_TEMP, S_TEMP); 
        //metric = getConfig().isMetric;
      
        //Battery
        present(CHILD_ID_BATT,V_VOLTAGE);
      }
      
      //Setup
      void setup()  
      {  
        //Serial.begin(9600);
        Serial.println("Hello!");
        //Batterysensor
           // use the 1.1 V internal reference
      #if defined(__AVR_ATmega2560__)
         analogReference(INTERNAL1V1);
      #else
         analogReference(INTERNAL);
      #endif
      
      //Tempsensor
        Serial.println("Setting up TempSensor...");
        myHumidity.begin();
        Serial.println("...done!");
      
      // Setup Kontaktschalter 1
        pinMode(BUTTON1_PIN,INPUT);
          // Activate internal pull-up
        digitalWrite(BUTTON1_PIN,HIGH);
      // Setup Kontaktschalter 2
        pinMode(BUTTON2_PIN,INPUT);
        // Activate internal pull-up
        digitalWrite(BUTTON2_PIN,HIGH);
      }
      
      //Starte den Loop
      void loop() 
      {
        //Batterysensor
        // get the battery Voltage
        delay(1000);
         int sensorValue = analogRead(BATTERY_SENSE_PIN);
         #ifdef DEBUG
         #endif
         
         // 1M, 470K divider across battery and using internal ADC ref of 1.1V
         // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
         // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
         // 3.44/1023 = Volts per bit = 0.003363075
         float batteryV  = sensorValue * 0.003363075;
         int batteryPcnt = sensorValue / 10;
      
         #ifdef DEBUG
         Serial.print("Battery Voltage: ");
         Serial.print(batteryV);
         Serial.println(" V");
      
         Serial.print("Battery percent: ");
         Serial.print(batteryPcnt);
         Serial.println(" %");
         #endif
      
         if (oldBatteryPcnt != batteryPcnt) {
           // Power up radio after sleep
           sendBatteryLevel(batteryPcnt);
           send(msgbatt.set(batteryPcnt));
           oldBatteryPcnt = batteryPcnt;
         }
         
        //Kontakstschalter 1
         // Short delay to allow buttons to properly settle
        sleep(10);
        // Get the update value
        int valueReed1 = digitalRead(BUTTON1_PIN);
       
        if (valueReed1 != oldValueReed1) {
           // Send in the new value
           send(msgReed1.set(valueReed1==HIGH ? 1 : 0));
           Serial.println("Button 1 geschaltet");
           oldValueReed1 = valueReed1;
        }
        //Kontakstschalter 2
        // Get the update value
        int valueReed2 = digitalRead(BUTTON2_PIN);
       
        if (valueReed2 != oldValueReed2) {
           // Send in the new value
           send(msgReed2.set(valueReed2==HIGH ? 1 : 0));
           Serial.println("Button 2 geschaltet");
           oldValueReed2 = valueReed2;
        }
       
       //Tempsensor
      Serial.println("Starte Messung...");
        
          float temp = myHumidity.readTemperature();
      
        if (isnan(temp)) {
            Serial.println("Failed reading temperature from DHT");
        } else if (temp != lastTemp) {
          lastTemp = temp;
          send(msgTemp.set(temp, 1));
          Serial.print("T: ");
          Serial.println(temp);
        }
        
       float humd = myHumidity.readHumidity();
        if (isnan(humd)) {
            Serial.println("Failed reading humidity from DHT");
        } else if (humd != lastHum) {
            lastHum = humd;
            send(msgHum.set(humd, 1));
            Serial.print("H: ");
            Serial.println(humd);
        }
      
       Serial.println("Sleep...");
       sleep(BUTTON1_PIN - 2, CHANGE, BUTTON2_PIN - 2, CHANGE, SLEEP_TIME); //sleep a bit 
        
      } 
      
      
      posted in My Project
      siod
      siod
    • RE: My Slim 2AA Battery Node

      mmh, no, that would mean I would have to run my computer for maybe 2 weeks 24/7...

      I guess it has somehting to do with the sleep function, the device seems to nat wake up after a while for some reason

      posted in My Project
      siod
      siod
    • RE: My Slim 2AA Battery Node

      @carmelo42 no, unfortunately I don´t have any logs, any idea how to create logs?

      posted in My Project
      siod
      siod
    • RE: My Slim 2AA Battery Node

      I would like to know if your nodes are working all fine. I have the problem that my nodes freeze after a day or sometimes after a week.

      posted in My Project
      siod
      siod
    • RE: 💬 Door, Window and Push-button Sensor

      what is "debouncer" for? I removed it from my sketch and it still works...

      posted in Announcements
      siod
      siod
    • problem getting Id from GW (parent)

      Hi all,

      I´ve built a NRF24l01 quality meter from AWI, unfortunately I don´t get the node connected to my Gateway. This is what my gateway tells me on the serial output:

      0;255;3;0;9;TSP:MSG:SEND 0-0-250-250 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0
      0;255;3;0;9;TSP:MSG:READ 250-250-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=250)
      0;255;3;0;9;TSP:CHKUPL:OK
      0;255;3;0;9;TSP:MSG:GWL OK
      

      As far as I understand there is a radio connection, but the node and the gw don´t want to talk to each other. Could anybody help me to understand what is going wrong here please?

      edit: I must mention that it occasionally works, so it must be wired correctly...

      edit2: Output of Node Serial monitor:

      Starting sensor (RNNNA-, 2.0.0)
      TSM:INIT
      TSM:RADIO:OK
      TSP:ASSIGNID:OK (ID=100)
      TSM:FPAR
      TSP:MSG:SEND 100-100-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSP:MSG:READ 0-0-0 s=0,c=0,t=0,pt=0,l=0,sg=0:
      !TSP:MSG:PVER mismatch
      
      posted in Troubleshooting
      siod
      siod
    • RE: Redesign: MySensors.org!

      looks great and it´s easier to find tutorials and How-to´s.

      What I am missing is a "Search in topic" field. I know there is a button in the profile´s settings menu, but it´s not easy to find when you don´t know where to look for it. Also it does not work for me/my browser (Firefox): I am getting a "Error - no-plugins-available" message...

      posted in Announcements
      siod
      siod
    • RE: 💬 Building a MQTT Gateway

      As Ernst79 already mentioned: please add #include <SPI.h> as a switch to your code, thank you!

      posted in Announcements
      siod
      siod
    • RE: cannot compile new MQTT GW sketch

      Mmh, thx, I just copied and pasted it from the instructions from the main page... So it must get corrected there as well...

      Thank you, I will try it later!

      edit:

      For the sake of completeness, I want to mention, that @Ernst79 already gave the hint in the comments section of "Building a MQTT Gateway" Install-Instruction on the mainpage. I just did not see it, but I would love to see @tbowmo to add this line to the code. Thank you!

      posted in Troubleshooting
      siod
      siod
    • cannot compile new MQTT GW sketch

      When trying to compile my MQTT Gateway sketch:

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik Ekblad
       *
       * DESCRIPTION
       * The W5100 MQTT gateway sends radio network (or locally attached sensors) data to your MQTT broker.
       * The node also listens to MY_MQTT_TOPIC_PREFIX and sends out those messages to the radio network
       *
       * LED purposes:
       * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
       * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
       * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
       * - ERR (red) - fast blink on error during transmission error or recieve crc error
       *
       * See http://www.mysensors.org/build/esp8266_gateway for wiring instructions.
       * nRF24L01+  ESP8266
       * VCC        VCC
       * CE         GPIO4
       * CSN/CS     GPIO15
       * SCK        GPIO14
       * MISO       GPIO12
       * MOSI       GPIO13
       *
       * Not all ESP8266 modules have all pins available on their external interface.
       * This code has been tested on an ESP-12 module.
       * The ESP8266 requires a certain pin configuration to download code, and another one to run code:
       * - Connect REST (reset) via 10K pullup resistor to VCC, and via switch to GND ('reset switch')
       * - Connect GPIO15 via 10K pulldown resistor to GND
       * - Connect CH_PD via 10K resistor to VCC
       * - Connect GPIO2 via 10K resistor to VCC
       * - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch')
       *
        * Inclusion mode button:
       * - Connect GPIO5 via switch to GND ('inclusion switch')
       *
       * Hardware SHA204 signing is currently not supported!
       *
       * Make sure to fill in your ssid and WiFi password below for ssid & pass.
       */
      
      
      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      // Enables and select radio type (if attached)
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #define MY_GATEWAY_MQTT_CLIENT
      
      // Set this node's subscribe and publish topic prefix
      #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
      #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
      
      // Set MQTT client id
      #define MY_MQTT_CLIENT_ID "mysensors-1"
      
      // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
      //#define MY_W5100_SPI_EN 4
      
      // Enable Soft SPI for NRF radio (note different radio wiring is required)
      // The W5100 ethernet module seems to have a hard time co-operate with
      // radio on the same spi bus.
      #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
        #define MY_SOFTSPI
        #define MY_SOFT_SPI_SCK_PIN 14
        #define MY_SOFT_SPI_MISO_PIN 16
        #define MY_SOFT_SPI_MOSI_PIN 15
      #endif
      
      // When W5100 is connected we have to move CE/CSN pins for NRF radio
      #ifndef MY_RF24_CE_PIN
        #define MY_RF24_CE_PIN 5
      #endif
      #ifndef MY_RF24_CS_PIN
        #define MY_RF24_CS_PIN 6
      #endif
      
      // Enable these if your MQTT broker requires usenrame/password
      //#define MY_MQTT_USER "username"
      //#define MY_MQTT_PASSWORD "password"
      
      // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
      #define MY_IP_ADDRESS 192,168,1,51
      
      // If using static ip you need to define Gateway and Subnet address as well
      #define MY_IP_GATEWAY_ADDRESS 192,168,1,1
      #define MY_IP_SUBNET_ADDRESS 255,255,255,0
      
      // MQTT broker ip address or url. Define one or the other.
      //#define MY_CONTROLLER_URL_ADDRESS "m20.cloudmqtt.com"
      #define MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 50
      
      // The MQTT broker port to to open
      #define MY_PORT 1883
      
       /*
      // Enable inclusion mode
      #define MY_INCLUSION_MODE_FEATURE
      // Enable Inclusion mode button on gateway
      //#define MY_INCLUSION_BUTTON_FEATURE
      // Set inclusion mode duration (in seconds)
      #define MY_INCLUSION_MODE_DURATION 60
      // Digital pin used for inclusion mode button
      //#define MY_INCLUSION_MODE_BUTTON_PIN  3
      
      // Set blinking period
      #define MY_DEFAULT_LED_BLINK_PERIOD 300
      
      // Flash leds on rx/tx/err
      // Uncomment to override default HW configurations
      //#define MY_DEFAULT_ERR_LED_PIN 16  // Error led pin
      //#define MY_DEFAULT_RX_LED_PIN  16  // Receive led pin
      //#define MY_DEFAULT_TX_LED_PIN  16  // the PCB, on board LED
      */
      
      #include <Ethernet.h>
      #include <MySensors.h>
      
      void setup() {
      }
      
      void presentation() {
        // Present locally attached sensors here
      }
      
      
      void loop() {
        // Send locally attached sensors data here
      }
      

      I am getting this error:

      
      
      
      
      
      
      
      T:\Programme\Arduino 1.6.10\arduino-builder -dump-prefs -logger=machine -hardware "T:\Programme\Arduino 1.6.10\hardware" -hardware "C:\Users\Cito\AppData\Local\Arduino15\packages" -tools "T:\Programme\Arduino 1.6.10\tools-builder" -tools "T:\Programme\Arduino 1.6.10\hardware\tools\avr" -tools "C:\Users\Cito\AppData\Local\Arduino15\packages" -built-in-libraries "T:\Programme\Arduino 1.6.10\libraries" -libraries "T:\Arduino Projekte\libraries" -fqbn=arduino:avr:uno -ide-version=10610 -build-path "C:\Users\Cito\AppData\Local\Temp\buildff641abe5d5d7a6894d7381b35e917c8.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "T:\Arduino Projekte\MQTTClientGateway_Ver_2.1\MQTTClientGateway_Ver_2.1.ino"
      T:\Programme\Arduino 1.6.10\arduino-builder -compile -logger=machine -hardware "T:\Programme\Arduino 1.6.10\hardware" -hardware "C:\Users\Cito\AppData\Local\Arduino15\packages" -tools "T:\Programme\Arduino 1.6.10\tools-builder" -tools "T:\Programme\Arduino 1.6.10\hardware\tools\avr" -tools "C:\Users\Cito\AppData\Local\Arduino15\packages" -built-in-libraries "T:\Programme\Arduino 1.6.10\libraries" -libraries "T:\Arduino Projekte\libraries" -fqbn=arduino:avr:uno -ide-version=10610 -build-path "C:\Users\Cito\AppData\Local\Temp\buildff641abe5d5d7a6894d7381b35e917c8.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "T:\Arduino Projekte\MQTTClientGateway_Ver_2.1\MQTTClientGateway_Ver_2.1.ino"
      Using board 'uno' from platform in folder: T:\Programme\Arduino 1.6.10\hardware\arduino\avr
      Using core 'arduino' from platform in folder: T:\Programme\Arduino 1.6.10\hardware\arduino\avr
      Warning: Board arduino:avr:apm96 doesn't define a 'build.board' preference. Auto-set to: AVR_APM96
      Detecting libraries used...
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "C:\Users\Cito\AppData\Local\Temp\buildff641abe5d5d7a6894d7381b35e917c8.tmp\sketch\MQTTClientGateway_Ver_2.1.ino.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\libraries\Ethernet\src" "C:\Users\Cito\AppData\Local\Temp\buildff641abe5d5d7a6894d7381b35e917c8.tmp\sketch\MQTTClientGateway_Ver_2.1.ino.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\libraries\Ethernet\src" "-IT:\Programme\Arduino 1.6.10\libraries\MySensors" "C:\Users\Cito\AppData\Local\Temp\buildff641abe5d5d7a6894d7381b35e917c8.tmp\sketch\MQTTClientGateway_Ver_2.1.ino.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\libraries\Ethernet\src" "-IT:\Programme\Arduino 1.6.10\libraries\MySensors" "T:\Programme\Arduino 1.6.10\libraries\Ethernet\src\Dhcp.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\libraries\Ethernet\src" "-IT:\Programme\Arduino 1.6.10\libraries\MySensors" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI\src" "T:\Programme\Arduino 1.6.10\libraries\Ethernet\src\Dhcp.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\libraries\Ethernet\src" "-IT:\Programme\Arduino 1.6.10\libraries\MySensors" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI\src" "T:\Programme\Arduino 1.6.10\libraries\Ethernet\src\Dns.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\libraries\Ethernet\src" "-IT:\Programme\Arduino 1.6.10\libraries\MySensors" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI\src" "T:\Programme\Arduino 1.6.10\libraries\Ethernet\src\Ethernet.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\libraries\Ethernet\src" "-IT:\Programme\Arduino 1.6.10\libraries\MySensors" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI\src" "T:\Programme\Arduino 1.6.10\libraries\Ethernet\src\EthernetClient.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\libraries\Ethernet\src" "-IT:\Programme\Arduino 1.6.10\libraries\MySensors" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI\src" "T:\Programme\Arduino 1.6.10\libraries\Ethernet\src\EthernetServer.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI\src" "-IT:\Programme\Arduino 1.6.10\libraries\Ethernet\src" "-IT:\Programme\Arduino 1.6.10\libraries\MySensors" "T:\Programme\Arduino 1.6.10\libraries\Ethernet\src\EthernetUdp.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\libraries\Ethernet\src" "-IT:\Programme\Arduino 1.6.10\libraries\MySensors" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI\src" "T:\Programme\Arduino 1.6.10\libraries\Ethernet\src\utility\socket.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI\src" "-IT:\Programme\Arduino 1.6.10\libraries\Ethernet\src" "-IT:\Programme\Arduino 1.6.10\libraries\MySensors" "T:\Programme\Arduino 1.6.10\libraries\Ethernet\src\utility\w5100.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\libraries\Ethernet\src" "-IT:\Programme\Arduino 1.6.10\libraries\MySensors" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI\src" "C:\Users\Cito\AppData\Local\Temp\buildff641abe5d5d7a6894d7381b35e917c8.tmp\sketch\MQTTClientGateway_Ver_2.1.ino.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\libraries\Ethernet\src" "-IT:\Programme\Arduino 1.6.10\libraries\MySensors" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI\src" "T:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI\src\SPI.cpp" -o "nul"
      Generating function prototypes...
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\libraries\Ethernet\src" "-IT:\Programme\Arduino 1.6.10\libraries\MySensors" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI\src" "C:\Users\Cito\AppData\Local\Temp\buildff641abe5d5d7a6894d7381b35e917c8.tmp\sketch\MQTTClientGateway_Ver_2.1.ino.cpp" -o "C:\Users\Cito\AppData\Local\Temp\buildff641abe5d5d7a6894d7381b35e917c8.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
      "T:\Programme\Arduino 1.6.10\tools-builder\ctags\5.8-arduino10/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\Cito\AppData\Local\Temp\buildff641abe5d5d7a6894d7381b35e917c8.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
      Sketch wird kompiliert...
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\libraries\Ethernet\src" "-IT:\Programme\Arduino 1.6.10\libraries\MySensors" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI\src" "C:\Users\Cito\AppData\Local\Temp\buildff641abe5d5d7a6894d7381b35e917c8.tmp\sketch\MQTTClientGateway_Ver_2.1.ino.cpp" -o "C:\Users\Cito\AppData\Local\Temp\buildff641abe5d5d7a6894d7381b35e917c8.tmp\sketch\MQTTClientGateway_Ver_2.1.ino.cpp.o"
      In file included from T:\Programme\Arduino 1.6.10\libraries\MySensors/drivers/RF24/RF24.cpp:23:0,
      
                       from T:\Programme\Arduino 1.6.10\libraries\MySensors/MySensors.h:261,
      
                       from T:\Arduino Projekte\MQTTClientGateway_Ver_2.1\MQTTClientGateway_Ver_2.1.ino:137:
      
      T:\Programme\Arduino 1.6.10\libraries\MySensors/drivers/RF24/RF24.h:34:31: error: 'SPI_MODE0' was not declared in this scope
      
       #define MY_RF24_SPI_DATA_MODE SPI_MODE0
      
                                     ^
      
      T:\Programme\Arduino 1.6.10\libraries\MySensors/drivers/RF24/RF24.h:38:76: note: in expansion of macro 'MY_RF24_SPI_DATA_MODE'
      
         SoftSPI<MY_SOFT_SPI_MISO_PIN, MY_SOFT_SPI_MOSI_PIN, MY_SOFT_SPI_SCK_PIN, MY_RF24_SPI_DATA_MODE> _SPI;
      
                                                                                  ^
      
      T:\Programme\Arduino 1.6.10\libraries\MySensors/drivers/RF24/RF24.h:38:97: error: template argument 4 is invalid
      
         SoftSPI<MY_SOFT_SPI_MISO_PIN, MY_SOFT_SPI_MOSI_PIN, MY_SOFT_SPI_SCK_PIN, MY_RF24_SPI_DATA_MODE> _SPI;
      
                                                                                                       ^
      
      T:\Programme\Arduino 1.6.10\libraries\MySensors/drivers/RF24/RF24.h:38:103: error: invalid type in declaration before ';' token
      
         SoftSPI<MY_SOFT_SPI_MISO_PIN, MY_SOFT_SPI_MOSI_PIN, MY_SOFT_SPI_SCK_PIN, MY_RF24_SPI_DATA_MODE> _SPI;
      
                                                                                                             ^
      
      In file included from T:\Programme\Arduino 1.6.10\libraries\MySensors/MySensors.h:261:0,
      
                       from T:\Arduino Projekte\MQTTClientGateway_Ver_2.1\MQTTClientGateway_Ver_2.1.ino:137:
      
      T:\Programme\Arduino 1.6.10\libraries\MySensors/drivers/RF24/RF24.cpp: In function 'uint8_t RF24_spiMultiByteTransfer(uint8_t, uint8_t*, uint8_t, bool)':
      
      T:\Programme\Arduino 1.6.10\libraries\MySensors/drivers/RF24/RF24.cpp:44:24: error: request for member 'transfer' in '_SPI', which is of non-class type 'int'
      
        uint8_t status = _SPI.transfer( cmd );
      
                              ^
      
      T:\Programme\Arduino 1.6.10\libraries\MySensors/drivers/RF24/RF24.cpp:47:18: error: request for member 'transfer' in '_SPI', which is of non-class type 'int'
      
          status = _SPI.transfer( NOP );
      
                        ^
      
      T:\Programme\Arduino 1.6.10\libraries\MySensors/drivers/RF24/RF24.cpp:49:24: error: request for member 'transfer' in '_SPI', which is of non-class type 'int'
      
         } else status = _SPI.transfer(*current++);
      
                              ^
      
      T:\Programme\Arduino 1.6.10\libraries\MySensors/drivers/RF24/RF24.cpp: In function 'bool RF24_initialize()':
      
      T:\Programme\Arduino 1.6.10\libraries\MySensors/drivers/RF24/RF24.cpp:261:7: error: request for member 'begin' in '_SPI', which is of non-class type 'int'
      
        _SPI.begin();
      
             ^
      
      Bibliothek Ethernet in Version 1.1.2 im Ordner: T:\Programme\Arduino 1.6.10\libraries\Ethernet  wird verwendet
      Bibliothek MySensors in Version 2.0.0 im Ordner: T:\Programme\Arduino 1.6.10\libraries\MySensors  wird verwendet
      Bibliothek SPI in Version 1.0 im Ordner: T:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI  wird verwendet
      exit status 1
      Fehler beim Kompilieren für das Board Arduino/Genuino Uno.
      

      Library is installed, using Arduino IDE 1.6.10. Any idea?

      posted in Troubleshooting
      siod
      siod
    • RE: how to search within a thread

      I get "error - no plugins available" 😞

      posted in General Discussion
      siod
      siod
    • RE: nRf24L01+ connection quality meter

      Hi @AWI,

      thanks for the code and the project! ~~Unfortunately my biggest problem is to get my LCD working. It does not do anything with your code, other testcode to test the display is working fine. I am using this line and it should work fine:

      LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address
      

      Any idea what else I could check? I am using arduino IDE 1.6.10

      edit: getting this in the serial monitor of the device:

      Starting sensor (RNNNA-, 2.0.0)
      TSM:INIT
      TSM:RADIO:OK
      TSP:ASSIGNID:OK (ID=250)
      TSM:FPAR
      TSP:MSG:SEND 250-250-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSM:FPAR
      TSP:MSG:SEND 250-250-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSM:FPAR
      TSP:MSG:SEND 250-250-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSM:FPAR
      TSP:MSG:SEND 250-250-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSP:MSG:READ 3-3-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      TSP:MSG:BC
      !TSM:FPAR:FAIL
      !TSM:FAILURE
      TSM:PDT
      

      then it starts over again...
      ~~
      edit2:
      Think I got it now, seems like my gateway wasn´t responding or whatever, now it seems to work...

      Edit3:

      I got 1 fail and 5000 miss 60%...
      Now what does this mean??

      Edit4:

      I think I need some help: Most of the time I get this on my gw´s Serial Monitor:

      0;255;3;0;9;TSP:MSG:SEND 0-0-250-250 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0
      0;255;3;0;9;TSP:MSG:READ 250-250-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=250)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;TSP:MSG:SEND 0-0-250-250 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0
      0;255;3;0;9;TSP:MSG:READ 250-250-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=250)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;TSP:MSG:SEND 0-0-250-250 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0
      0;255;3;0;9;TSP:MSG:READ 250-250-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=250)
      0;255;3;0;9;TSP:CHKUPL:OK
      0;255;3;0;9;TSP:MSG:GWL OK
      

      After some reboots of the quality meter and I guess with a lot of luck it starts working occasionally

      This is from the serial monitor of the quality meter:

      TSP:MSG:READ 0-0-0 s=0,c=0,t=0,pt=0,l=0,sg=0:
      !TSP:MSG:PVER mismatch
      !TSM:FPAR:FAIL
      !TSM:FAILURE
      TSM:PDT
      

      I already added a 47u Cap and added those lines to the code:

      #define MY_PARENT_NODE_ID 0                         // fixed parent to controller when 0 (else comment out = AUTO)
      #define MY_PARENT_NODE_IS_STATIC
      

      no luck at all...

      edit5:
      Now I opened the serial output of my GW again, which seems to started the communication:

      0;255;3;0;9;TSP:MSG:READ 250-250-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=250)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;TSP:MSG:SEND 0-0-250-250 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0
      0;255;3;0;9;TSP:MSG:READ 250-250-0 s=255,c=3,t=24,pt=1,l=1,sg=0:1
      0;255;3;0;9;TSP:MSG:PINGED (ID=250, hops=1)
      0;255;3;0;9;TSP:MSG:SEND 0-0-250-250 s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=ok:1
      0;255;3;0;9;TSP:MSG:READ 250-250-0 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      0;255;3;0;9;!TSP:MSG:SEND 0-0-250-250 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=fail:0100
      0;255;3;0;9;TSP:MSG:READ 250-250-0 s=255,c=0,t=17,pt=0,l=5,sg=0:2.0.0
      0;255;3;0;9;Sending message on topic: mygateway1-out/250/255/0/0/17
      0;255;3;0;9;TSP:MSG:READ 250-250-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
      0;255;3;0;9;Sending message on topic: mygateway1-out/250/255/3/0/6
      0;255;3;0;9;TSP:MSG:READ 250-250-0 s=0,c=0,t=4,pt=0,l=21,sg=0:Quality counter Q 250
      0;255;3;0;9;Sending message on topic: mygateway1-out/250/0/0/0/4
      0;255;3;0;9;TSP:MSG:READ 250-250-0 s=255,c=3,t=26,pt=1,l=1,sg=0:2
      0;255;3;0;9;TSP:MSG:SEND 0-0-250-250 s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=ok:1
      0;255;3;0;9;TSP:MSG:READ 250-250-0 s=255,c=3,t=26,pt=1,l=1,sg=0:2
      0;255;3;0;9;TSP:MSG:SEND 0-0-250-250 s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=ok:1
      0;255;3;0;9;TSP:MSG:READ 250-250-0 s=255,c=3,t=26,pt=1,l=1,sg=0:2
      0;255;3;0;9;TSP:MSG:SEND 0-0-250-250 s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=ok:1
      0;255;3;0;9;TSP:MSG:READ 250-250-0 s=0,c=1,t=3,pt=2,l=2,sg=0:0
      0;255;3;0;9;TSP:MSG:ACK msg
      0;255;3;0;9;TSP:MSG:SEND 0-0-250-250 s=0,c=1,t=3,pt=2,l=2,sg=0,ft=0,st=ok:0
      0;255;3;0;9;Sending message on topic: mygateway1-out/250/0/1/0/3
      0;255;3;0;9;TSP:MSG:READ 250-250-0 s=0,c=1,t=3,pt=2,l=2,sg=0:1
      0;255;3;0;9;TSP:MSG:ACK msg
      0;255;3;0;9;TSP:MSG:SEND 0-0-250-250 s=0,c=1,t=3,pt=2,l=2,sg=0,ft=0,st=ok:1
      0;255;3;0;9;Sending message on topic: mygateway1-out/250/0/1/0/3
      0;255;3;0;9;TSP:MSG:READ 250-250-0 s=0,c=1,t=3,pt=2,l=2,sg=0:2
      0;255;3;0;9;TSP:MSG:ACK msg
      

      I don´t get it what is going on here. Restarted quality meter: blank LCD... 😞

      posted in My Project
      siod
      siod
    • how to search within a thread

      Hi,

      how can I search within a single thread, not only the whole froum?

      posted in General Discussion
      siod
      siod
    • RE: Please help with Serial Montor Message

      mmh, but as I mentioned in my first post the node (and all my other notes) reported their status instantly when I restarted my gateway, so I guess it´s a gateway problem.

      posted in Troubleshooting
      siod
      siod
    • Please help with Serial Montor Message

      Hi,

      after a while my Temp Sensor Node stopped communitcating over MQTT with my Gateway properly, now I only get those messages repeatingly:

      0;255;3;0;9;TSP:MSG:READ 1-1-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=1)
      0;255;3;0;9;TSP:CHKUPL:OK
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;!TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
      

      Could someone explain what this means? Unfortunately I cannot read the serial output of my node because I am using the "My 2 AA Battery Slim Node" layout...

      edit: I restarted my gateway and now the communication is successful again o0 ! What went wrong on my gateway??

      posted in Troubleshooting
      siod
      siod
    • RE: How To Debug

      Ok guys, thanks for your quick replies and please excuse my late reply...

      posted in Troubleshooting
      siod
      siod
    • How To Debug

      I´ve read this thread https://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help and I uncommented #define MY_DEBUG in MyConfig.h and also added #define MY_DEBUG to my node´s sketch (at the very top). After Uploading the sketch I thought I´d be able to see the debugging on the Serial Monitor of my GATEWAY (I cannot access the serial monitor output of my node), but the output was just the same as before. Isn´t it possible to see the debug info on the gateways serial monitor?

      posted in Troubleshooting
      siod
      siod
    • RE: My Slim 2AA Battery Node

      each one goes around a corner and so one wall is partly between the nodes and the gateway and it´s not even concrete. I have one node in my basement attached to an arduino nano and I have no range problems...

      The batteries are all fully loaded.

      edit:
      I would like to post my Node sketch as well as my gateway sketch and MyConfig.h. Maybe there is some optimization potential:

      Node sktech:

      // Sensor Node Schlafzimmer mit HTU21D Temp/Hum Sensor, Fensterkontakte an Interrupt PINS Digital 5&6. Sleep Time 15 Minutwn, wake up wenn Fenster geöffnet/geschlossen wird.
      #define MY_RADIO_NRF24 //MySensor Library auf NRF24 Funkmodul einstellen, muss vor MySensor.h Initialisierung geschehen
      // Define Node ID
      #define MY_NODE_ID 4
      
      //Batterysensor
      int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
      int oldBatteryPcnt = 0;
      #define CHILD_ID_BATT 7
      
      //Kontaktschalter
      //#include <Bounce2.h>
      #define CHILD1_ID 1 // Kontaktschalter 1
      #define CHILD2_ID 2 // Kontaktschalter 2
      #define BUTTON1_PIN  2  // Kontaktschalter 1
      #define BUTTON2_PIN  3  // Kontaktschalter 2
      int oldValueReed1=-1;
      int oldValueReed2=-1;
      
      //Tempsensor
      #include <SparkFunHTU21D.h>
      #include <Wire.h>
      #define CHILD_ID_HUM 3
      #define CHILD_ID_TEMP 4
      unsigned long SLEEP_TIME = 900000; // Sleep time between reads (in milliseconds)
      
      #include <MySensors.h>
      #include <SPI.h>
      
      //tempsensor
      HTU21D myHumidity;
      float lastTemp;
      float lastHum;
      //boolean metric = true; 
      
      //Messages
      //Battery
      MyMessage msgbatt(CHILD_ID_BATT,V_VOLTAGE);
      // Kontaktschalter
      MyMessage msgReed1(CHILD1_ID,V_TRIPPED); // Kontaktschalter 1
      MyMessage msgReed2(CHILD2_ID,V_TRIPPED); // Kontaktschalter 2
      //TempMessage
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      
      //Presentation; present sensors to gateway!
      void presentation(){
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Küche Messstation", "2.0", true);
          
        // Register binary input sensor to gw (they will be created as child devices)
        // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 
        // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
        present(CHILD1_ID, S_DOOR); 
        present(CHILD2_ID, S_DOOR); 
          
        //Tempsensor
        present(CHILD_ID_HUM, S_HUM);
        present(CHILD_ID_TEMP, S_TEMP); 
        //metric = getConfig().isMetric;
      
        //Battery
        present(CHILD_ID_BATT,V_VOLTAGE);
      }
      
      //Setup
      void setup()  
      {  
        //Serial.begin(9600);
        Serial.println("Hello!");
        //Batterysensor
           // use the 1.1 V internal reference
      #if defined(__AVR_ATmega2560__)
         analogReference(INTERNAL1V1);
      #else
         analogReference(INTERNAL);
      #endif
      
      //Tempsensor
        Serial.println("Setting up TempSensor...");
        myHumidity.begin();
        Serial.println("...done!");
      
      // Setup Kontaktschalter 1
        pinMode(BUTTON1_PIN,INPUT);
          // Activate internal pull-up
        digitalWrite(BUTTON1_PIN,HIGH);
      // Setup Kontaktschalter 2
        pinMode(BUTTON2_PIN,INPUT);
        // Activate internal pull-up
        digitalWrite(BUTTON2_PIN,HIGH);
      }
      
      //Starte den Loop
      void loop() 
      {
        //Batterysensor
        // get the battery Voltage
        delay(1000);
         int sensorValue = analogRead(BATTERY_SENSE_PIN);
         #ifdef DEBUG
         #endif
         
         // 1M, 470K divider across battery and using internal ADC ref of 1.1V
         // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
         // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
         // 3.44/1023 = Volts per bit = 0.003363075
         float batteryV  = sensorValue * 0.003363075;
         int batteryPcnt = sensorValue / 10;
      
         #ifdef DEBUG
         Serial.print("Battery Voltage: ");
         Serial.print(batteryV);
         Serial.println(" V");
      
         Serial.print("Battery percent: ");
         Serial.print(batteryPcnt);
         Serial.println(" %");
         #endif
      
         if (oldBatteryPcnt != batteryPcnt) {
           // Power up radio after sleep
           sendBatteryLevel(batteryPcnt,true);
           send(msgbatt.set(batteryPcnt),true);
           oldBatteryPcnt = batteryPcnt;
         }
         
        //Kontakstschalter 1
         // Short delay to allow buttons to properly settle
        sleep(10);
        // Get the update value
        int valueReed1 = digitalRead(BUTTON1_PIN);
       
        if (valueReed1 != oldValueReed1) {
           // Send in the new value
           send(msgReed1.set(valueReed1==HIGH ? 1 : 0),true);
           Serial.println("Button 1 geschaltet");
           oldValueReed1 = valueReed1;
        }
        //Kontakstschalter 2
        // Get the update value
        int valueReed2 = digitalRead(BUTTON2_PIN);
       
        if (valueReed2 != oldValueReed2) {
           // Send in the new value
           send(msgReed2.set(valueReed2==HIGH ? 1 : 0),true);
           Serial.println("Button 2 geschaltet");
           oldValueReed2 = valueReed2;
        }
       
       //Tempsensor
      Serial.println("Starte Messung...");
        
          float temp = myHumidity.readTemperature();
      
        if (isnan(temp)) {
            Serial.println("Failed reading temperature from DHT");
        } else if (temp != lastTemp) {
          lastTemp = temp;
          send(msgTemp.set(temp, 1),true);
          Serial.print("T: ");
          Serial.println(temp);
        }
        
       float humd = myHumidity.readHumidity();
        if (isnan(humd)) {
            Serial.println("Failed reading humidity from DHT");
        } else if (humd != lastHum) {
            lastHum = humd;
            send(msgHum.set(humd, 1),true);
            Serial.print("H: ");
            Serial.println(humd);
        }
      
       Serial.println("Sleep...");
       sleep(BUTTON1_PIN - 2, CHANGE, BUTTON2_PIN - 2, CHANGE, SLEEP_TIME); //sleep a bit 
        
      } 
      
      
      

      Gateway sketch:

      #include <SPI.h>
      
      // Enable debug prints to serial monitor
      #define MY_DEBUG 
      
      // Enables and select radio type (if attached)
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #define MY_GATEWAY_MQTT_CLIENT
      
      // Set this nodes subscripe and publish topic prefix
      #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
      #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
      
      // Set MQTT client id
      #define MY_MQTT_CLIENT_ID "mysensors-1"
      
      // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
      //#define MY_W5100_SPI_EN 4  
      
      // Enable Soft SPI for NRF radio (note different radio wiring is required)
      // The W5100 ethernet module seems to have a hard time co-operate with 
      // radio on the same spi bus.
      #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
        #define MY_SOFTSPI
        #define MY_SOFT_SPI_SCK_PIN 14
        #define MY_SOFT_SPI_MISO_PIN 16
        #define MY_SOFT_SPI_MOSI_PIN 15
      #endif  
      
      // When W5100 is connected we have to move CE/CSN pins for NRF radio
      #ifndef MY_RF24_CE_PIN 
        #define MY_RF24_CE_PIN 5
      #endif
      #ifndef MY_RF24_CS_PIN 
        #define MY_RF24_CS_PIN 6
      #endif
      
      // Enable these if your MQTT broker requires usenrame/password
      //#define MY_MQTT_USER "username"
      //#define MY_MQTT_PASSWORD "password"
      
      // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
      #define MY_IP_ADDRESS 192,168,1,51
      
      // If using static ip you need to define Gateway and Subnet address as well
      #define MY_IP_GATEWAY_ADDRESS 192,168,1,1
      #define MY_IP_SUBNET_ADDRESS 255,255,255,0
      
      // MQTT broker ip address or url. Define one or the other. 
      //#define MY_CONTROLLER_URL_ADDRESS "m20.cloudmqtt.com"
      #define MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 50
      
      // The MQTT broker port to to open 
      #define MY_PORT 1883      
      
       /*
      // Flash leds on rx/tx/err
      #define MY_LEDS_BLINKING_FEATURE
      // Set blinking period
      #define MY_DEFAULT_LED_BLINK_PERIOD 300
      
      // Enable inclusion mode
      #define MY_INCLUSION_MODE_FEATURE
      // Enable Inclusion mode button on gateway
      #define MY_INCLUSION_BUTTON_FEATURE
      // Set inclusion mode duration (in seconds)
      #define MY_INCLUSION_MODE_DURATION 60 
      // Digital pin used for inclusion mode button
      #define MY_INCLUSION_MODE_BUTTON_PIN  3 
      
      // Uncomment to override default HW configurations
      //#define MY_DEFAULT_ERR_LED_PIN 16  // Error led pin
      //#define MY_DEFAULT_RX_LED_PIN  16  // Receive led pin
      //#define MY_DEFAULT_TX_LED_PIN  16  // the PCB, on board LED
      */
      
      #include <Ethernet.h>
      #include <MySensors.h>
      
      void setup() { 
      }
      
      void presentation() {
        // Present locally attached sensors here    
      }
      
      
      void loop() {
        // Send locally attech sensors data here
      }
      

      MyConfig.h

      /*
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       */
      
      /**
       * @file MyConfig.h
       *
       * MySensors specific configurations
       */
      #ifndef MyConfig_h
      #define MyConfig_h
      #include <stdint.h>
      
      
      /**********************************
      *  Serial and debug options
      ***********************************/
      
      // Enable MY_DEBUG in sketch to show debug prints. This option will add a lot to the size of the
      // final sketch but is helpful to see what is actually is happening during development
      //#define MY_DEBUG
      
      // Enable MY_SPECIAL_DEBUG in sketch to activate I_DEBUG messages if MY_DEBUG is disabled.
      // I_DEBUG requests are:
      // R: routing info (only repeaters): received msg XXYY (as stream), where XX is the node and YY the routing node
      // V: CPU voltage
      // F: CPU frequency
      // M: free memory
      // E: clear MySensors EEPROM area and reboot (i.e. "factory" reset)
      //#define MY_SPECIAL_DEBUG
      
      // Enable MY_DEBUG_VERBOSE_SIGNING flag for verbose debug prints related to signing.
      // Requires DEBUG to be enabled.
      // This will add even more to the size of the final sketch!
      //#define MY_DEBUG_VERBOSE_SIGNING
      
      // Enable this in sketch if you want to use TX(1), RX(0) as normal I/O pin
      //#define MY_DISABLED_SERIAL
      
      // Enable MY_CORE_ONLY flag if you want to use core functions without loading the framework
      //#define MY_CORE_ONLY
      
      // Turn off debug if serial pins is used for other stuff
      #ifdef MY_DISABLED_SERIAL
      #undef MY_DEBUG
      #endif
      
      /**
       * @def MY_BAUD_RATE
       * @brief Serial output baud rate (debug prints and serial gateway speed).
       */
      #ifndef MY_BAUD_RATE
      #define MY_BAUD_RATE 115200
      #endif
      
      // Disables over-the-air reset of node
      //#define MY_DISABLE_REMOTE_RESET
      
      /**********************************
      *  Radio selection and node config
      ***********************************/
      
      // Selecting uplink transport layer is optional (for a gateway node).
      
      //#define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      //#define MY_RS485
      
      /**
      * @def MY_TRANSPORT_SANITY_CHECK
      * @brief If enabled, node will check transport in regular intervals to detect HW issues and re-initialize in case of failure. This feature is enabled for all repeater nodes (incl. GW)
      */
      //#define MY_TRANSPORT_SANITY_CHECK
      /**
      * @def MY_TRANSPORT_SANITY_CHECK_INTERVAL
      * @brief Interval (in ms) of transport sanity checks
      */
      #ifndef MY_TRANSPORT_SANITY_CHECK_INTERVAL
      #define MY_TRANSPORT_SANITY_CHECK_INTERVAL ((uint32_t)60000)
      #endif
      /**
       * @def MY_REGISTRATION_FEATURE
       * @brief If enabled, node has to register to gateway/controller before allowed to send sensor data.
       */
      #define MY_REGISTRATION_FEATURE
      
       /**
       * @def MY_REGISTRATION_RETRIES
       * @brief Number of registration retries if no reply received from GW/controller
       */
      
      #ifndef MY_REGISTRATION_RETRIES
      #define MY_REGISTRATION_RETRIES 3
      #endif
      
       /**
       * @def MY_REGISTRATION_DEFAULT
       * @brief Node registration default - this applies if no registration response is recieved from controller
       */
      
      #define MY_REGISTRATION_DEFAULT true
      
       /**
       * @def MY_REGISTRATION_CONTROLLER
       * @brief If enabled, node registration request has to be handled by controller
       */
       // #define MY_REGISTRATION_CONTROLLER
      
       /**
       * @def MY_CORE_COMPATIBILITY_CHECK
       * @brief If enabled, library compatibility is checked during node registration. Incompatible libraries are unable to send sensor data.
       */
      #define MY_CORE_COMPATIBILITY_CHECK
      
      /**
       * @def MY_NODE_ID
       * @brief Node id defaults to AUTO (tries to fetch id from controller).
       */
      #ifndef MY_NODE_ID
      #define MY_NODE_ID AUTO
      #endif
      
      /**
       * @def MY_PARENT_NODE_ID
       * @brief Node parent defaults to AUTO (tries to find a parent automatically).
       */
      #ifndef MY_PARENT_NODE_ID
      #define MY_PARENT_NODE_ID AUTO
      #endif
      
      /**
       * @def MY_PARENT_NODE_IS_STATIC
       * @brief Enable MY_PARENT_NODE_IS_STATIC to disable fall back if parent node fails
       */
      //#define MY_PARENT_NODE_IS_STATIC
      
      // Enables repeater functionality (relays messages from other nodes)
      // #define MY_REPEATER_FEATURE
      
      /**
       * @def MY_SMART_SLEEP_WAIT_DURATION
       * @brief The wait period before going to sleep when using smartSleep-functions.
       *
       * This period has to be long enough for controller to be able to send out
       * potential buffered messages.
       */
      #ifndef MY_SMART_SLEEP_WAIT_DURATION
      #define MY_SMART_SLEEP_WAIT_DURATION 500
      #endif
      
      /**********************************
      *  Over the air firmware updates
      ***********************************/
      
      // Enable MY_OTA_FIRMWARE_FEATURE in sketch to allow safe over-the-air firmware updates.
      // This feature requires external flash and the DualOptiBoot boot-loader.
      // Note: You can still have OTA FW updates without external flash but it
      // requires the MYSBootloader and disabled MY_OTA_FIRMWARE_FEATURE
      //#define MY_OTA_FIRMWARE_FEATURE
      
      /**
       * @def MY_OTA_FLASH_SS
       * @brief Slave select pin for external flash.
       */
      #ifndef MY_OTA_FLASH_SS
      #define MY_OTA_FLASH_SS 8
      #endif
      
      /**
       * @def MY_OTA_FLASH_JDECID
       * @brief Flash jdecid.
       */
      #ifndef MY_OTA_FLASH_JDECID
      #define MY_OTA_FLASH_JDECID 0x1F65
      #endif
      
      
      /**********************************
      *  Gateway config
      ***********************************/
      
      /**
       * @def MY_GATEWAY_MAX_RECEIVE_LENGTH
       * @brief Max buffersize needed for messages coming from controller.
       */
      #ifndef MY_GATEWAY_MAX_RECEIVE_LENGTH
      #define MY_GATEWAY_MAX_RECEIVE_LENGTH 100
      #endif
      
      /**
       * @def MY_GATEWAY_MAX_SEND_LENGTH
       * @brief Max buffer size when sending messages.
       */
      #ifndef MY_GATEWAY_MAX_SEND_LENGTH
      #define MY_GATEWAY_MAX_SEND_LENGTH 120
      #endif
      
      /**
       * @def MY_GATEWAY_MAX_CLIENTS
       * @brief Max number of parallel clients (sever mode).
       */
      #ifndef MY_GATEWAY_MAX_CLIENTS
      #define MY_GATEWAY_MAX_CLIENTS 1
      #endif
      
      
      
      /**********************************
      *  Information LEDs blinking
      ***********************************/
      // This feature enables LEDs blinking on message receive, transmit
      // or if some error occurred. This was commonly used only in gateways,
      // but now can be used in any sensor node. Also the LEDs can now be
      // disabled in the gateway.
      
      #define MY_LEDS_BLINKING_FEATURE
      
      // The following setting allows you to inverse the blinking feature MY_LEDS_BLINKING_FEATURE
      // When MY_WITH_LEDS_BLINKING_INVERSE is enabled LEDSs are normally turned on and switches
      // off when blinking
      
      //#define MY_WITH_LEDS_BLINKING_INVERSE
      
      // The following defines can be used to set the port pin, that the LED is connected to
      // If one of the following is defined here, or in the sketch, MY_LEDS_BLINKING_FEATURE will be
      // enabled by default. (Replace x with the pin number you have the LED on)
      //#define MY_DEFAULT_ERR_LED_PIN x
      //#define MY_DEFAULT_TX_LED_PIN x
      //#define MY_DEFAULT_RX_LED_PIN x
      
      /**********************************************
      *  Gateway inclusion button/mode configuration
      **********************************************/
      // Enabled inclusion mode feature
      //#define MY_INCLUSION_MODE_FEATURE
      
      // Enables inclusion-mode button feature on the gateway device
      //#define MY_INCLUSION_BUTTON_FEATURE
      
      // Disable inclusion mode button if inclusion mode feature is not enabled
      #ifndef MY_INCLUSION_MODE_FEATURE
      #undef MY_INCLUSION_BUTTON_FEATURE
      #endif
      
      /**
       * @def MY_INCLUSION_MODE_BUTTON_PIN
       * @brief The default input pin used for the inclusion mode button.
       */
      #ifndef MY_INCLUSION_MODE_BUTTON_PIN
      	#if defined(ARDUINO_ARCH_ESP8266)
      		#define MY_INCLUSION_MODE_BUTTON_PIN 5
      	#else
      		#define MY_INCLUSION_MODE_BUTTON_PIN 3
      	#endif
      #endif
      
      /**
       * @def MY_INCLUSION_MODE_DURATION
       * @brief Number of seconds (default one minute) inclusion mode should be enabled.
       */
      
      #ifndef MY_INCLUSION_MODE_DURATION
      #define MY_INCLUSION_MODE_DURATION 60
      #endif
      
      /**
       * @def MY_INCLUSION_BUTTON_PRESSED
       * @brief The logical level indicating a pressed inclusion mode button.
       */
      #if defined(MY_INCLUSION_BUTTON_EXTERNAL_PULLUP)
      #define MY_INCLUSION_BUTTON_PRESSED HIGH
      #else
      #define MY_INCLUSION_BUTTON_PRESSED LOW
      #endif
      
      /**********************************
      *  Message Signing Settings
      ***********************************/
      /**
       * @def MY_SIGNING_ATSHA204
       * @brief Enables HW backed signing functionality in library.
       *
       * For any signing related functionality to be included, this define or @ref MY_SIGNING_SOFT has to be enabled.
       */
      //#define MY_SIGNING_ATSHA204
      
      /**
       * @def MY_SIGNING_SOFT
       * @brief Enables SW backed signing functionality in library.
       *
       * For any signing related functionality to be included, this define or @ref MY_SIGNING_ATSHA204 has to be enabled.
       */
      //#define MY_SIGNING_SOFT
      
      /**
       * @def MY_SIGNING_REQUEST_SIGNATURES
       * @brief Enable this to inform gateway to sign all messages sent to this node.
       *
       * If used for a gateway, gateway will only request signatures from nodes that in turn
       * request signatures from gateway.
       */
      //#define MY_SIGNING_REQUEST_SIGNATURES
      
      /**
       * @def MY_VERIFICATION_TIMEOUT_MS
       * @brief Define a suitable timeout for a signature verification session
       *
       * Consider the turnaround from a nonce being generated to a signed message being received
       * which might vary, especially in networks with many hops. 5s ought to be enough for anyone.
       */
      #ifndef MY_VERIFICATION_TIMEOUT_MS
      #define MY_VERIFICATION_TIMEOUT_MS 5000
      #endif
      
      /**
       * @def MY_SIGNING_NODE_WHITELISTING
       * @brief Enable to turn on whitelisting
       *
       * When enabled, a signing node will salt the signature with it's unique signature and nodeId.<br>
       * The verifying node will look up the sender in a local table of trusted nodes and
       * do the corresponding salting in order to verify the signature.<br>
       * For this reason, if whitelisting is enabled on one of the nodes in a sign-verify pair, both
       * nodes have to implement whitelisting for this to work.<br>
       * Note that a node can still transmit a non-salted message (i.e. have whitelisting disabled)
       * to a node that has whitelisting enabled (assuming the receiver does not have a matching entry
       * for the sender in it's whitelist). The whitelist to use is defined as the value of the flag.
       */
      //#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}}
      
      /**
       * @def MY_SIGNING_ATSHA204_PIN
       * @brief Atsha204 default pin setting
       *
       * Pin where ATSHA204 is attached
       */
      #ifndef MY_SIGNING_ATSHA204_PIN
      #define MY_SIGNING_ATSHA204_PIN 17
      #endif
      
      /**
       * @def MY_SIGNING_SOFT_RANDOMSEED_PIN
       * @brief Pin used for random generation in soft signing
       *
       * Do not connect anything to this when soft signing is enabled
       */
      #ifndef MY_SIGNING_SOFT_RANDOMSEED_PIN
      #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
      #endif
      
      /**********************************
      *  RS485 Driver Defaults
      ***********************************/
      
      /**
       * @def MY_RS485_BAUD_RATE
       * @brief The RS485 BAUD rate.
       */
      #ifndef MY_RS485_BAUD_RATE
      #define MY_RS485_BAUD_RATE 9600
      #endif
      
      /**
       * @def MY_RS485_MAX_MESSAGE_LENGTH
       * @brief The maximum message length used for RS485.
       */
      #ifndef MY_RS485_MAX_MESSAGE_LENGTH
      #define MY_RS485_MAX_MESSAGE_LENGTH 40
      #endif
      
      /**********************************
      *  NRF24L01P Driver Defaults
      ***********************************/
      
      // Enables RF24 encryption (all nodes and gateway must have this enabled, and all must be personalized with the same AES key)
      //#define MY_RF24_ENABLE_ENCRYPTION
      
      /**
       * @def MY_DEBUG_VERBOSE_RF24
       * @brief Enable MY_DEBUG_VERBOSE_RF24 flag for verbose debug prints related to the RF24 driver. Requires DEBUG to be enabled.
       */
      //#define MY_DEBUG_VERBOSE_RF24
      
      /**
       * @def MY_RF24_SPI_MAX_SPEED
       * @brief MY_RF24_SPI_MAX_SPEED to overrule default nRF24L01+ SPI speed.
       */
      //#define MY_RF24_SPI_MAX_SPEED 4000000
      
      /**
       * @def MY_RF24_CE_PIN
       * @brief Default RF24 chip enable pin setting. Override in sketch if needed.
       */
      #ifndef MY_RF24_CE_PIN
      	#if defined(ARDUINO_ARCH_ESP8266)
      		#define MY_RF24_CE_PIN 4
      	#elif defined(ARDUINO_ARCH_SAMD)
      		#define MY_RF24_CE_PIN 27
      	#else
      		#define MY_RF24_CE_PIN 9
      	#endif
      #endif
      
      /**
       * @def MY_RF24_CS_PIN
       * @brief Default RF24 chip select pin setting. Override in sketch if needed.
       */
      #ifndef MY_RF24_CS_PIN
      	#if defined(ARDUINO_ARCH_ESP8266)
      		#define MY_RF24_CS_PIN 15
      	#elif defined(ARDUINO_ARCH_SAMD)
      		#define MY_RF24_CS_PIN 3
      	#else
      		#define MY_RF24_CS_PIN 10
      	#endif
      #endif
      
      /**
       * @def MY_RF24_PA_LEVEL
       * @brief Default RF24 PA level. Override in sketch if needed.
       */
      #ifndef MY_RF24_PA_LEVEL
      #define MY_RF24_PA_LEVEL RF24_PA_MAX
      #endif
      
      /**
       * @def MY_RF24_CHANNEL
       * @brief RF channel for the sensor net, 0-125.
       * Frequence: 2400 Mhz - 2525 Mhz Channels: 126
       * http://www.mysensors.org/radio/nRF24L01Plus.pdf
       * 0 => 2400 Mhz (RF24 channel 1)
       * 1 => 2401 Mhz (RF24 channel 2)
       * 76 => 2476 Mhz (RF24 channel 77)
       * 83 => 2483 Mhz (RF24 channel 84)
       * 124 => 2524 Mhz (RF24 channel 125)
       * 125 => 2525 Mhz (RF24 channel 126)
       * In some countries there might be limitations, in Germany for example only the range 2400,0 - 2483,5 Mhz is allowed
       * http://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2013_10_WLAN_2,4GHz_pdf.pdf
       */
      #ifndef MY_RF24_CHANNEL
      #define MY_RF24_CHANNEL	76
      #endif
      
      /**
       * @def MY_RF24_DATARATE
       * @brief RF24 datarate (RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps or RF24_2MBPS for 2Mbps).
       */
      #ifndef MY_RF24_DATARATE
      #define MY_RF24_DATARATE RF24_250KBPS
      #endif
      
      /**
       * @def MY_RF24_BASE_RADIO_ID
       * @brief RF24 radio network identifier.
       *
       * This acts as base value for sensor nodeId addresses. Change this (or channel) if you have more than one sensor network.
       */
      #ifndef MY_RF24_BASE_RADIO_ID
      #define MY_RF24_BASE_RADIO_ID 0x00,0xFC,0xE1,0xA8,0xA8
      #endif
      
      /**
       * @def MY_RF24_ADDR_WIDTH
       * @brief RF24 address width.
       *
       * This defines the width of the base address.
       */
      #ifndef MY_RF24_ADDR_WIDTH
      #define MY_RF24_ADDR_WIDTH 5
      #endif
      
      /**
       * @def MY_RF24_SANITY_CHECK
       * @brief RF24 sanity check to verify functional RF module
       *
       * This reads back and compares configuration registers. Disable if using non-P modules
       */
      #define MY_RF24_SANITY_CHECK
      
      // Enable SOFTSPI for NRF24L01, useful for the W5100 Ethernet module
      //#define MY_SOFTSPI
      
      /**
       * @def MY_SOFT_SPI_SCK_PIN
       * @brief Soft SPI SCK pin.
       */
      #ifndef MY_SOFT_SPI_SCK_PIN
      #define MY_SOFT_SPI_SCK_PIN 14
      #endif
      
      /**
       * @def MY_SOFT_SPI_MISO_PIN
       * @brief Soft SPI MISO pin.
       */
      #ifndef MY_SOFT_SPI_MISO_PIN
      #define MY_SOFT_SPI_MISO_PIN 16
      #endif
      
      /**
       * @def MY_SOFT_SPI_MOSI_PIN
       * @brief Soft SPI MOSI pin.
       */
      #ifndef MY_SOFT_SPI_MOSI_PIN
      #define MY_SOFT_SPI_MOSI_PIN 15
      #endif
      
      /**********************************
      *  RFM69 Driver Defaults
      ***********************************/
      
      /**
       * @def MY_RFM69_FREQUENCY
       * @brief RFM69 frequency to use (RF69_433MHZ for 433MHz, RF69_868MHZ for 868MHz or RF69_915MHZ for 915MHz).
       *
       * This must match the hardware version of the RFM69 radio.
       */
      #ifndef MY_RFM69_FREQUENCY
      #define MY_RFM69_FREQUENCY   RF69_868MHZ
      #endif
      
      /**
       * @def MY_IS_RFM69HW
       * @brief Enable this if you're running the RFM69HW model.
       */
      //#define MY_IS_RFM69HW
      
      /**
       * @def MY_RFM69HW
       * @brief Set to true if @ref MY_IS_RFM69HW is set.
       */
      #ifdef MY_IS_RFM69HW
      	#define MY_RFM69HW true
      #else
      	#define MY_RFM69HW false
      #endif
      
      /**
       * @def MY_RFM69_NETWORKID
       * @brief RFM69 Network ID. Use the same for all nodes that will talk to each other.
       */
      #ifndef MY_RFM69_NETWORKID
      #define MY_RFM69_NETWORKID     100
      #endif
      
      /**
       * @def MY_RF69_IRQ_PIN
       * @brief RF69 IRQ pin.
       */
      #ifndef MY_RF69_IRQ_PIN
      #define MY_RF69_IRQ_PIN RF69_IRQ_PIN
      #endif
      
      /**
       * @def MY_RF69_SPI_CS
       * @brief RF69 SPI chip select pin.
       */
      #ifndef MY_RF69_SPI_CS
      #define MY_RF69_SPI_CS RF69_SPI_CS
      #endif
      
      /**
       * @def MY_RF69_IRQ_NUM
       * @brief RF69 IRQ pin number.
       */
      #ifndef MY_RF69_IRQ_NUM
      	#if defined(ARDUINO_ARCH_ESP8266)
      		#define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
      	#else
      		#define MY_RF69_IRQ_NUM RF69_IRQ_NUM
      	#endif
      #endif
      
      // Enables RFM69 encryption (all nodes and gateway must have this enabled, and all must be personalized with the same AES key)
      //#define MY_RFM69_ENABLE_ENCRYPTION
      
      /**************************************
      * Ethernet Gateway Transport  Defaults
      ***************************************/
      
      // The gateway options available
      //#define MY_GATEWAY_W5100
      //#define MY_GATEWAY_ENC28J60
      //#define MY_GATEWAY_ESP8266
      
      /**
       * @def MY_PORT
       * @brief The Ethernet TCP/UDP port to open on controller or gateway.
       */
      #ifndef MY_PORT
      #define MY_PORT 5003
      #endif
      
      // Static ip address of gateway (if this is disabled, DHCP will be used)
      //#define MY_IP_ADDRESS 192,168,178,66
      
      // Enables UDP mode for Ethernet gateway (W5100)
      //#define MY_USE_UDP
      
      /**
       * @def MY_IP_RENEWAL_INTERVAL
       * @brief DHCP, default renewal setting in milliseconds.
       */
      #ifndef MY_IP_RENEWAL_INTERVAL
      #define MY_IP_RENEWAL_INTERVAL 60000
      #endif
      
      /**
       * @def MY_MAC_ADDRESS
       * @brief Ethernet MAC address.
       *
       * This needs to be unique on the network.
       */
      #ifndef MY_MAC_ADDRESS
      #define MY_MAC_ADDRESS 0xAD, 0xAD, 0xBE, 0xAD, 0xFE, 0xED
      #endif
      
      // Controller ip-address, if this is defined, gateway will act as a client trying to contact controller on MY_PORT.
      // If MY_CONTROLLER_IP_ADDRESS is left un-defined, gateway acts as server allowing incoming connections.
      //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254
      
      /**
       * @defgroup MyLockgrp MyNodeLock
       * @ingroup internals
       * @{
       * @brief The node lock feature is a security related feature. It locks a node that suspect itself for being
       * under some form of attack.
       *
       * This is achieved by having a counter stored in EEPROM which decrements when suspicious activity is detected.
       * If the counter reaches 0, node will not work anymore and will transmit a @ref I_LOCKED message to the
       * gateway/controller with 30m intervals. Payload is a string with a reason for the locking.
       * The string is abbreviated to accomodate a signature. The following abbreviations exist at the moment:
       * - LDB (Locked During Boot)
       * - TMNR (Too Many Nonce Requests)
       * - TMFV (Too Many Failed Verifications)
       *
       * Typically, the counter only decrements when suspicious activity happens in a row.
       * It is reset if legit traffic is present.
      
       * Examples of malicious activity are:
       * - Repeatedly incorrectly checksummed OTA firmware
       * - Repeated requests for signing nonces without properly signed messages arriving
       * - Repeatedly failed signature verifications
       *
       * If counter reaches zero, node locks down and EEPROM has to be erased/reset to reactivate node.
       * Node can also be unlocked by grounding a pin (see @ref MY_NODE_UNLOCK_PIN).
       *
       * The size of the counter can be adjusted using @ref MY_NODE_LOCK_COUNTER_MAX.
       *
       * @def MY_NODE_LOCK_FEATURE
       * @brief Enable this to activate intrusion prevention mechanisms on the node.
       */
      //#define MY_NODE_LOCK_FEATURE
      
      /**
       * @def MY_NODE_UNLOCK_PIN
       * @brief By grounding this pin durig reset of a locked node, the node will unlock.
       *
       * If using a secure bootloader, grounding the pin is the only option to reactivate the node.
       * If using stock Android bootloader or a DualOptiBoot it is also possible to download a sketch
       * using serial protocol to erase EEPROM to unlock the node.
       */
      #ifndef MY_NODE_UNLOCK_PIN
      #define MY_NODE_UNLOCK_PIN 14
      #endif
      
      /**
       * @def MY_NODE_LOCK_COUNTER_MAX
       * @brief Maximum accepted occurances of suspected malicious activity in a node.
       *
       * Counter decrements on reoccuring incidents but resets if legitimate behaviour is identified.
       */
      #ifndef MY_NODE_LOCK_COUNTER_MAX
      #define MY_NODE_LOCK_COUNTER_MAX 5
      #endif
      /** @}*/ // Node lock group
      
      #endif
      
      // Doxygen specific constructs, not included when built normally
      // This is used to enable disabled macros/definitions to be included in the documentation as well.
      #if DOXYGEN
      #define MY_SIGNING_ATSHA204
      #define MY_SIGNING_SOFT
      #define MY_SIGNING_REQUEST_SIGNATURES
      #define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}}
      #define MY_IS_RFM69HW
      #define MY_PARENT_NODE_IS_STATIC
      #define MY_REGISTRATION_CONTROLLER
      #define MY_DEBUG_VERBOSE_RF24
      #define MY_TRANSPORT_SANITY_CHECK
      #endif
      

      edit2:

      Now I get this this from the node on my gateway´s serial monitor:

      0;255;3;0;9;TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=4)
      0;255;3;0;9;TSP:CHKUPL:OK
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;!TSP:MSG:SEND 0-0-4-4 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
      0;255;3;0;9;TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=4)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;!TSP:MSG:SEND 0-0-4-4 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
      0;255;3;0;9;TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=4)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;!TSP:MSG:SEND 0-0-4-4 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
      0;255;3;0;9;TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=4)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;!TSP:MSG:SEND 0-0-4-4 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
      0;255;3;0;9;TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=4)
      0;255;3;0;9;TSP:CHKUPL:OK
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;!TSP:MSG:SEND 0-0-4-4 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
      0;255;3;0;9;TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=4)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;!TSP:MSG:SEND 0-0-4-4 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
      0;255;3;0;9;TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=4)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;!TSP:MSG:SEND 0-0-4-4 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
      0;255;3;0;9;TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=4)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;!TSP:MSG:SEND 0-0-4-4 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
      0;255;3;0;9;TSP:SANCHK:OK
      0;255;3;0;9;TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=4)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;!TSP:MSG:SEND 0-0-4-4 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
      0;255;3;0;9;TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=4)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;!TSP:MSG:SEND 0-0-4-4 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=fail:0
      0;255;3;0;9;TSP:MSG:READ 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=4)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      
      

      and so on...

      edit: I restarted my gateway and the nodes, it is working for a while, but after 1 or 2 days 1 or more nodes freeze. Does anybody else have equal problems?

      posted in My Project
      siod
      siod
    • RE: My Slim 2AA Battery Node

      I've set up two sensors with 2 reed switches and 1 HTU21D attached. When I was testing them around 60 cm away from my gateway they worked very fine. Now I moved them to their final destination which is around 8-10 meters away from the gateway and now they don't reach the gateway anymore. Any idea what could cause this? Any way to increase the range?

      posted in My Project
      siod
      siod
    • RE: [Solved] Manually setting node-id does not work

      @tekka said:

      That's it 🙂

      Nothing more to add, but Thank you! 💐

      posted in Troubleshooting
      siod
      siod
    • RE: [Solved] Manually setting node-id does not work

      This is my Serial Monitor output of my MQTT Gateway:

      0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
      0;255;3;0;9;TSM:INIT
      0;255;3;0;9;TSM:RADIO:OK
      0;255;3;0;9;TSM:GW MODE
      0;255;3;0;9;TSM:READY
      IP: 192.168.1.51
      0;255;3;0;9;No registration required
      0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
      IP: 192.168.1.51
      0;255;3;0;9;Attempting MQTT connection...
      0;255;3;0;9;MQTT connected
      0;255;3;0;9;TSP:MSG:READ 3-3-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=3)
      0;255;3;0;9;TSP:CHKUPL:OK
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;TSP:MSG:SEND 0-0-3-3 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0
      0;255;3;0;9;TSP:MSG:READ 3-3-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=3)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;TSP:MSG:SEND 0-0-3-3 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=255,c=3,t=24,pt=1,l=1,sg=0:1
      0;255;3;0;9;TSP:MSG:PINGED (ID=3, hops=1)
      0;255;3;0;9;TSP:MSG:SEND 0-0-3-3 s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=ok:1
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      0;255;3;0;9;TSP:MSG:SEND 0-0-3-3 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=255,c=0,t=17,pt=0,l=5,sg=0:2.0.0
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/255/0/0/17
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/255/3/0/6
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=255,c=3,t=11,pt=0,l=24,sg=0:Schlafzimmer Messstation
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/255/3/0/11
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=255,c=3,t=12,pt=0,l=3,sg=0:2.0
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/255/3/0/12
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=1,c=0,t=0,pt=0,l=0,sg=0:
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/1/0/0/0
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=2,c=0,t=0,pt=0,l=0,sg=0:
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/2/0/0/0
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=3,c=0,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/3/0/0/7
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=4,c=0,t=6,pt=0,l=0,sg=0:
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/4/0/0/6
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=7,c=0,t=38,pt=0,l=0,sg=0:
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/7/0/0/38
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=255,c=3,t=26,pt=1,l=1,sg=0:2
      0;255;3;0;9;TSP:MSG:SEND 0-0-3-3 s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=ok:1
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=255,c=3,t=0,pt=1,l=1,sg=0:102
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/255/3/0/0
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=7,c=1,t=38,pt=2,l=2,sg=0:102
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/7/1/0/38
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=1,c=1,t=16,pt=2,l=2,sg=0:1
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/1/1/0/16
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=2,c=1,t=16,pt=2,l=2,sg=0:1
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/2/1/0/16
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=4,c=1,t=0,pt=7,l=5,sg=0:24.0
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/4/1/0/0
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=3,c=1,t=1,pt=7,l=5,sg=0:60.7
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/3/1/0/1
      

      And this is my Node´s code:

      // Sensor Node Schlafzimmer mit HTU21D Temp/Hum Sensor, Fensterkontakte an Interrupt PINS Digital 5&6. Sleep Time 15 Minutwn, wake up wenn Fenster geöffnet/geschlossen wird.
      #define MY_RADIO_NRF24 //MySensor Library auf NRF24 Funkmodul einstellen, muss vor MySensor.h Initialisierung geschehen
      
      #include <MySensors.h>
      #include <SPI.h>
      
      // Define Node ID
      #define MY_NODE_ID 1
      
      //Batterysensor
      int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
      int oldBatteryPcnt = 0;
      #define CHILD_ID_BATT 7
      
      //Kontaktschalter
      //#include <Bounce2.h>
      #define CHILD1_ID 1 // Kontaktschalter 1
      #define CHILD2_ID 2 // Kontaktschalter 2
      #define BUTTON1_PIN  5  // Kontaktschalter 1
      #define BUTTON2_PIN  6  // Kontaktschalter 2
      int oldValueReed1=-1;
      int oldValueReed2=-1;
      
      //Tempsensor
      #include <SparkFunHTU21D.h>
      #include <Wire.h>
      #define CHILD_ID_HUM 3
      #define CHILD_ID_TEMP 4
      unsigned long SLEEP_TIME = 900000; // Sleep time between reads (in milliseconds)
      
      //tempsensor
      HTU21D myHumidity;
      float lastTemp;
      float lastHum;
      //boolean metric = true; 
      
      //Messages
      //Battery
      MyMessage msgbatt(CHILD_ID_BATT,V_VOLTAGE);
      // Kontaktschalter
      MyMessage msgReed1(CHILD1_ID,V_TRIPPED); // Kontaktschalter 1
      MyMessage msgReed2(CHILD2_ID,V_TRIPPED); // Kontaktschalter 2
      //TempMessage
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      
      //Presentation; present sensors to gateway!
      void presentation(){
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Schlafzimmer Messstation", "2.0");
          
        // Register binary input sensor to gw (they will be created as child devices)
        // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 
        // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
        present(CHILD1_ID, S_DOOR); 
        present(CHILD2_ID, S_DOOR); 
          
        //Tempsensor
        present(CHILD_ID_HUM, S_HUM);
        present(CHILD_ID_TEMP, S_TEMP); 
        //metric = getConfig().isMetric;
      
        //Battery
        present(CHILD_ID_BATT,V_VOLTAGE);
      }
      
      //Setup
      void setup()  
      {  
        //Serial.begin(9600);
        Serial.println("Hello!");
        //Batterysensor
           // use the 1.1 V internal reference
      #if defined(__AVR_ATmega2560__)
         analogReference(INTERNAL1V1);
      #else
         analogReference(INTERNAL);
      #endif
      
      //Tempsensor
        Serial.println("Setting up TempSensor...");
        myHumidity.begin();
        Serial.println("...done!");
      
      // Setup Kontaktschalter 1
        pinMode(BUTTON1_PIN,INPUT);
          // Activate internal pull-up
        digitalWrite(BUTTON1_PIN,HIGH);
      // Setup Kontaktschalter 2
        pinMode(BUTTON2_PIN,INPUT);
        // Activate internal pull-up
        digitalWrite(BUTTON2_PIN,HIGH);
      }
      
      //Starte den Loop
      void loop() 
      {
        //Batterysensor
        // get the battery Voltage
        delay(1000);
         int sensorValue = analogRead(BATTERY_SENSE_PIN);
         #ifdef DEBUG
         #endif
         
         // 1M, 470K divider across battery and using internal ADC ref of 1.1V
         // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
         // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
         // 3.44/1023 = Volts per bit = 0.003363075
         float batteryV  = sensorValue * 0.003363075;
         int batteryPcnt = sensorValue / 10;
      
         #ifdef DEBUG
         Serial.print("Battery Voltage: ");
         Serial.print(batteryV);
         Serial.println(" V");
      
         Serial.print("Battery percent: ");
         Serial.print(batteryPcnt);
         Serial.println(" %");
         #endif
      
         if (oldBatteryPcnt != batteryPcnt) {
           // Power up radio after sleep
           sendBatteryLevel(batteryPcnt);
           send(msgbatt.set(batteryPcnt));
           oldBatteryPcnt = batteryPcnt;
         }
         
        //Kontakstschalter 1
         // Short delay to allow buttons to properly settle
        sleep(10);
        // Get the update value
        int valueReed1 = digitalRead(BUTTON1_PIN);
       
        if (valueReed1 != oldValueReed1) {
           // Send in the new value
           send(msgReed1.set(valueReed1==HIGH ? 1 : 0));
           Serial.println("Button 1 geschaltet");
           oldValueReed1 = valueReed1;
        }
        //Kontakstschalter 2
        // Get the update value
        int valueReed2 = digitalRead(BUTTON2_PIN);
       
        if (valueReed2 != oldValueReed2) {
           // Send in the new value
           send(msgReed2.set(valueReed2==HIGH ? 1 : 0));
           Serial.println("Button 2 geschaltet");
           oldValueReed2 = valueReed2;
        }
       
       //Tempsensor
      Serial.println("Starte Messung...");
        
          float temp = myHumidity.readTemperature();
      
        if (isnan(temp)) {
            Serial.println("Failed reading temperature from DHT");
        } else if (temp != lastTemp) {
          lastTemp = temp;
          send(msgTemp.set(temp, 1));
          Serial.print("T: ");
          Serial.println(temp);
        }
        
       float humd = myHumidity.readHumidity();
        if (isnan(humd)) {
            Serial.println("Failed reading humidity from DHT");
        } else if (humd != lastHum) {
            lastHum = humd;
            send(msgHum.set(humd, 1));
            Serial.print("H: ");
            Serial.println(humd);
        }
      
       Serial.println("Sleep...");
       sleep(BUTTON1_PIN - 2, CHANGE, BUTTON2_PIN - 2, CHANGE, SLEEP_TIME); //sleep a bit 
        
      } 
      
      

      I have only this one Node powered right now...

      Using MySensors Library ver 2.0 on Gateway and Node

      posted in Troubleshooting
      siod
      siod
    • [Solved] Manually setting node-id does not work

      Ok great!

      One more thing: I manually define Node ID´s like this:

      #define MY_NODE_ID 1
      

      But my serial gate way always receives ID 3 for this Node! Any idea why ??

      0;255;3;0;9;Sending message on topic: mygateway1-out/3/7/1/0/38
      
      posted in Troubleshooting
      siod
      siod
    • RE: Converting a sketch from 1.5.x to 2.0.x

      I built a 2.0 MQTT gateway and am experimenting with a sensor using 1.5 library. I can see incoming data in the serial monitor, but the data is a bit different then when I was using the 1.5 MQTT gateway. In openhab I used this:

      {mqtt="<[mysensor:MyMQTT/3/2/1/V_TRIPPED:state:CLOSED:1],<[mysensor:MyMQTT/3/2/1/V_TRIPPED:state:OPEN:0]"}
      

      But now I must skip the V_Tripped part to make it work like this:

      {mqtt="<[mysensor:mygateway1-out/3/2/1/0/16:state:OPEN:1],<[mysensor:mygateway1-out/3/2/1/0/16:state:CLOSED:0]"}
      

      Is this how it is supposed to be or do I have to make the sensor node 2.0 compatible first? I thought the payload is saved in the V_TRIPPED variable, but it doesn´t seem to work in the new 2.0 library. Pls advise-

      edit:

      Ok, digged a bit deeper: if I understand it right, I don´t need "V_TRIPPED" or any other value in my controllers code (which is openhab actually) anymore but still in my sensor node code of course. So the gateway will transform "V_Tripped" into sub-typ "16". Correct? So all I´ll have to change is my openhab code, right?

      posted in Announcements
      siod
      siod
    • RE: My final setup to get MySensors and OpenHab communicating via MQTT

      @Eric-Buhring said:

      ga

      Hi, thanks for this tutorial, looks great! Maybe you can help me with my problem here:

      https://forum.mysensors.org/topic/4523/problem-building-mqtt-gateway-ver-2-0/7

      pls see last post!

      posted in OpenHAB
      siod
      siod
    • RE: Problem building MQTT Gateway ver 2.0

      Ok, was experimenting a bit, I guess I have to change my Openhab code...

      So this is what I had until now:

      Contact FensterSzR  "Fenster Rechts"  (FF_Sz)  {mqtt="<[mysensor:MyMQTT/1/2/V_TRIPPED:state:OPEN:1],<[mysensor:MyMQTT/1/2/V_TRIPPED:state:CLOSED:0]"}
      

      Now, with library ver 2.0, I think I have to change it to sth. like this, but it doesn´t work, yet. I hope you can help me here:

      Contact FensterKzR  "Fenster Rechts"  (FF_Kz)  {mqtt="<[mysensors-1:mygateway1-out/3/2/V_TRIPPED:state:OPEN:1],<[mysensors-1:mygateway1-out/3/2/V_TRIPPED:state:CLOSED:0]"}
      

      edit: oops, now with correct code snippet

      edit 2: I recieve this in my serial monitor and mosquitto also receives the messages:

      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=2,c=1,t=16,pt=2,l=2,sg=0:0
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/2/1/0/16
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=4,c=1,t=0,pt=7,l=5,sg=0:21.2
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/4/1/0/0
      0;255;3;0;9;TSP:MSG:READ 3-3-0 s=3,c=1,t=1,pt=7,l=5,sg=0:62.5
      0;255;3;0;9;Sending message on topic: mygateway1-out/3/3/1/0/1
      
      posted in Hardware
      siod
      siod
    • RE: Problem building MQTT Gateway ver 2.0

      Ok, I could upload your posted code, seems to work, but MQTT messages don´t have the same format as before. Why was this changed (e.g. #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
      #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in")? I don´t want to edit all my controllers code...

      But I must admit I did not update my sensors yet, but if I cannot easily change the MQTT message format I´ll stick with the older MySensors library.

      posted in Hardware
      siod
      siod
    • RE: Problem building MQTT Gateway ver 2.0

      No Sir, I´ve downloaded it from here: https://www.mysensors.org/build/mqtt_gateway

      posted in Hardware
      siod
      siod
    • RE: Problem building MQTT Gateway ver 2.0

      Hi Yveaux, thanks for your quick reply. So, I installed Arduino IDE 1.6.9, downloaded Mysensors library 2.0 again and copied it into the libraries folder. Still getting this error:

      T:\Programme\arduino-1.6.9\arduino-builder -dump-prefs -logger=machine -hardware "T:\Programme\arduino-1.6.9\hardware" -tools "T:\Programme\arduino-1.6.9\tools-builder" -tools "T:\Programme\arduino-1.6.9\hardware\tools\avr" -built-in-libraries "T:\Programme\arduino-1.6.9\libraries" -libraries "T:\Arduino Projekte\libraries" -fqbn=arduino:avr:uno -ide-version=10609 -build-path "C:\Users\Cito\AppData\Local\Temp\build3eff58a7a75746fb3d7ac5b9b27eba4c.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "T:\Arduino Projekte\MQTTClientGateway_Ver_2.0\MQTTClientGateway_Ver_2.0.ino"
      T:\Programme\arduino-1.6.9\arduino-builder -compile -logger=machine -hardware "T:\Programme\arduino-1.6.9\hardware" -tools "T:\Programme\arduino-1.6.9\tools-builder" -tools "T:\Programme\arduino-1.6.9\hardware\tools\avr" -built-in-libraries "T:\Programme\arduino-1.6.9\libraries" -libraries "T:\Arduino Projekte\libraries" -fqbn=arduino:avr:uno -ide-version=10609 -build-path "C:\Users\Cito\AppData\Local\Temp\build3eff58a7a75746fb3d7ac5b9b27eba4c.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "T:\Arduino Projekte\MQTTClientGateway_Ver_2.0\MQTTClientGateway_Ver_2.0.ino"
      "T:\Programme\arduino-1.6.9\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10609 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\arduino-1.6.9\hardware\arduino\avr\cores\arduino" "-IT:\Programme\arduino-1.6.9\hardware\arduino\avr\variants\standard" "C:\Users\Cito\AppData\Local\Temp\build3eff58a7a75746fb3d7ac5b9b27eba4c.tmp\sketch\MQTTClientGateway_Ver_2.0.ino.cpp" -o "nul"
      "T:\Programme\arduino-1.6.9\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10609 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\arduino-1.6.9\hardware\arduino\avr\cores\arduino" "-IT:\Programme\arduino-1.6.9\hardware\arduino\avr\variants\standard" "C:\Users\Cito\AppData\Local\Temp\build3eff58a7a75746fb3d7ac5b9b27eba4c.tmp\sketch\MQTTClientGateway_Ver_2.0.ino.cpp" -o "C:\Users\Cito\AppData\Local\Temp\build3eff58a7a75746fb3d7ac5b9b27eba4c.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
      T:\Arduino Projekte\MQTTClientGateway_Ver_2.0\MQTTClientGateway_Ver_2.0.ino:77:23: fatal error: DigitalIO.h: No such file or directory
      
       #include <DigitalIO.h>
      
                             ^
      
      compilation terminated.
      
      exit status 1
      Fehler beim Kompilieren für das Board Arduino/Genuino Uno.```
      posted in Hardware
      siod
      siod
    • Problem building MQTT Gateway ver 2.0

      Hi,

      I would like to update my actual MQTT Gateway to the new MySensors 2.0 version library. Unfortunately I wasn´t able to just upload the sketch to another arduino, first it was asking for "DigitalIO.h" which I copied from an older arduino IDE version on my computer to the latest arduino IDE library. But after that it asks for "MySigningNone.h". Don´t know where to find that.

      Why can´t it finally be just a simple task to upload code using an updated library?

      T:\Programme\Arduino 1.6.10\arduino-builder -dump-prefs -logger=machine -hardware "T:\Programme\Arduino 1.6.10\hardware" -tools "T:\Programme\Arduino 1.6.10\tools-builder" -tools "T:\Programme\Arduino 1.6.10\hardware\tools\avr" -built-in-libraries "T:\Programme\Arduino 1.6.10\libraries" -libraries "T:\Arduino Projekte\libraries" -fqbn=arduino:avr:uno -ide-version=10610 -build-path "C:\Users\Cito\AppData\Local\Temp\build3eff58a7a75746fb3d7ac5b9b27eba4c.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "T:\Arduino Projekte\MQTTClientGateway_Ver_2.0\MQTTClientGateway_Ver_2.0.ino"
      T:\Programme\Arduino 1.6.10\arduino-builder -compile -logger=machine -hardware "T:\Programme\Arduino 1.6.10\hardware" -tools "T:\Programme\Arduino 1.6.10\tools-builder" -tools "T:\Programme\Arduino 1.6.10\hardware\tools\avr" -built-in-libraries "T:\Programme\Arduino 1.6.10\libraries" -libraries "T:\Arduino Projekte\libraries" -fqbn=arduino:avr:uno -ide-version=10610 -build-path "C:\Users\Cito\AppData\Local\Temp\build3eff58a7a75746fb3d7ac5b9b27eba4c.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "T:\Arduino Projekte\MQTTClientGateway_Ver_2.0\MQTTClientGateway_Ver_2.0.ino"
      Using board 'uno' from platform in folder: T:\Programme\Arduino 1.6.10\hardware\arduino\avr
      Using core 'arduino' from platform in folder: T:\Programme\Arduino 1.6.10\hardware\arduino\avr
      Detecting libraries used...
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "C:\Users\Cito\AppData\Local\Temp\build3eff58a7a75746fb3d7ac5b9b27eba4c.tmp\sketch\MQTTClientGateway_Ver_2.0.ino.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\libraries\DigitalIO" "C:\Users\Cito\AppData\Local\Temp\build3eff58a7a75746fb3d7ac5b9b27eba4c.tmp\sketch\MQTTClientGateway_Ver_2.0.ino.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\libraries\DigitalIO" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI\src" "C:\Users\Cito\AppData\Local\Temp\build3eff58a7a75746fb3d7ac5b9b27eba4c.tmp\sketch\MQTTClientGateway_Ver_2.0.ino.cpp" -o "nul"
      "T:\Programme\Arduino 1.6.10\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\cores\arduino" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\variants\standard" "-IT:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI\src" "-IT:\Programme\Arduino 1.6.10\libraries\DigitalIO" "C:\Users\Cito\AppData\Local\Temp\build3eff58a7a75746fb3d7ac5b9b27eba4c.tmp\sketch\MQTTClientGateway_Ver_2.0.ino.cpp" -o "C:\Users\Cito\AppData\Local\Temp\build3eff58a7a75746fb3d7ac5b9b27eba4c.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
      T:\Arduino Projekte\MQTTClientGateway_Ver_2.0\MQTTClientGateway_Ver_2.0.ino:80:27: fatal error: MySigningNone.h: No such file or directory
      
       #include <MySigningNone.h>
      
                                 ^
      
      compilation terminated.
      
      Bibliothek DigitalIO im Ordner: T:\Programme\Arduino 1.6.10\libraries\DigitalIO (legacy) wird verwendet
      Bibliothek SPI in Version 1.0 im Ordner: T:\Programme\Arduino 1.6.10\hardware\arduino\avr\libraries\SPI  wird verwendet
      exit status 1
      Fehler beim Kompilieren für das Board Arduino/Genuino Uno.```
      posted in Hardware
      siod
      siod
    • RE: [Tutorial] How to burn 1Mhz & 8Mhz bootloader using Arduino IDE 1.6.5-r5

      @GertSanders said:

      @siod
      For OTA you need to flash the boot loaders that allow this. The standard boot loaders do not have this ability to OTA update.

      Ok, but after the new release of mysensors ver 2.0 lib and my wish to update my gw and sensor nodes I would like to add OTA update ability as well for upcoming updates.

      • So does a 1 MHz Bootloader with OTA exist that is compatible to the one from above?
      • Could OTA easily be added to the above 1MHz Bootloader?
      • Should i just use the "ATmega328 internal 8Mhz with MYSBootloader" instead of the above mentioned bootloaders?
      posted in Development
      siod
      siod
    • RE: Slim Node Si7021 sensor example

      ok, thanks for making it clear for me Gert!!

      update:

      finally found time to build my sensor and it seems to work fine, will do more testing but for now my results are:

      7.5 uA when sleeping, 15,3 mA when working (every 15 minutes for about 2seconds, but I think my cheap multimeter gives bad readings on those spikes, I guess it´s only around 1 mA)

      seems to be okay, isn´t it?

      edit:

      I have 2 reed switches attached. I recognized that I have +0,10 mA for each reed switch when activated. So when reed switches are both touching their counterpart I have a sleeping consumption of 0,20 mA. Why is that??

      posted in My Project
      siod
      siod
    • RE: Slim Node Si7021 sensor example

      so with the correct library there is no need to solder those 3 spots together!?

      posted in My Project
      siod
      siod
    • RE: "Washing machine ended" sensor

      my machine has an "end" led...so I attached a light sensor (LDR) on top of this led...

      just an idea 😉

      posted in My Project
      siod
      siod
    • RE: [Tutorial] How to burn 1Mhz & 8Mhz bootloader using Arduino IDE 1.6.5-r5

      Hi guys,

      I flashed a few sensors already using the 8 MHz and 1MHz bootloaders. I would like to know if I could update my nodes OTA or would I have to modify sth. to make it possible?

      posted in Development
      siod
      siod
    • Ethernet Gateway freezes after a while

      Hi guys,

      unfortunately my Ethernet Gateway freezes after a while (after 2 weeks or so). I think I remember an entry in some topic where other users experienced freezes as well. Is this a known phenomenon? Any ideas how to troubleshoot this? Thanks in advance!

      posted in Troubleshooting
      siod
      siod
    • RE: Update every node?

      mmh, sounds like a lot of work if you have a lot of nodes...especially if you have to expect that more/higher versions will be released in the future, too...

      posted in Troubleshooting
      siod
      siod
    • RE: gw.sleep on battery powered magnet door switch

      well, as you can see, if you don´t know the libraries exactly you accept things as they are or as they seem to be. I wasn´t aware that you can just set the wakeup function to 0. So this said I would like to thank you @AWI for your patience and your willingness of explaining also the most obvious things! 👍

      posted in My Project
      siod
      siod
    • RE: gw.sleep on battery powered magnet door switch

      @AWI
      yes, makes sense, but how should you do this wihout the wakeup ? I guess this is just the disadvantage one must accept...

      posted in My Project
      siod
      siod
    • RE: gw.sleep on battery powered magnet door switch

      @AWI
      Ok thx for explanation, but that means he is using 2 reed switches, right (interrupt at pin2 and int pin3)?

      posted in My Project
      siod
      siod
    • RE: gw.sleep on battery powered magnet door switch

      I would like to build the same but I am still very confused now. Could you upload some pictures so I can make myself an image of how you wirde things together?

      Also I don´t really understand what happens here: gw.sleep(BUTTON_PIN_Deur - 2, CHANGE, BUTTON_PIN_Post - 2, CHANGE, 86400000);

      posted in My Project
      siod
      siod
    • Update every node?

      After Release of a new branch (2.0 for example), should I re-compile and re-upload all my sketches to my nodes and also to my Gateway? Or should I just use the new releases on future nodes?

      posted in Troubleshooting
      siod
      siod
    • RE: Slim Node as a Mini 2AA Battery PIR Motion Sensor

      Hi guys,

      I am wondering, if it wouldn´t be a good idea to use the PinChangeInt Library to wake the arduino from sleep by pin change interrupts. Wouldn´t this be the most power efficient variant? Or did I understand sth. wrong with the pin change interrupts? Thanks for your help in advance!!

      posted in My Project
      siod
      siod
    • RE: MQTT and batterylevel

      @gadu
      where is the imprtoant MQTT code of your sketch? Would be so kind and share it with us?

      Thanks in advance!!

      posted in Development
      siod
      siod
    • RE: My Slim 2AA Battery Node

      OK guys, thanks for the explanation. In this case I need to buy new temp sensors...

      The 3.7v batteries are no option for me because they are too expensive in my eyes. I didn't want to buy new temp sensors as I already bought a couple of the DHT 11 sensors but it seems like there is no other chance now.

      I just think the next time I encounter problems is, when I try to setup a new sensor node with attached pir motion sensor... I will read the data sheet of it first and look out for power consumption 🙂

      posted in My Project
      siod
      siod
    • RE: My Slim 2AA Battery Node

      I wasn't aware that the nrf24l01 is so sensitive to voltage higher than 1.9v. I would like to have a sensor design to which I can add different sensors, just for the purpose I need it right now. So most sensors need 3.3v or 5v and I have to decide if I use 3v cells, which are more expensive or use step up / step down regulators which will drain my batteries. I just want to keep the flexibility to add any sort of sensor to my board... What would you suppose to do, also I think I am not the only one who faces those problems. Of course I am a beginner and still have a lot to learn but I also just want to finish this project as I am working on it for a very long time now...

      posted in My Project
      siod
      siod
    • RE: My Slim 2AA Battery Node

      I really don't want to spam this thread...

      But from my arduino Uno the nrf24l01 module is also powered by 5V!?!

      Edit : ah ok, the arduino is going to regulate down to 3.3v... Then I cant use 3AAs 😞

      posted in My Project
      siod
      siod
    • RE: My Slim 2AA Battery Node

      OK thx for the hint, I guess I will just add a third AA battery, that should solve my problem...

      posted in My Project
      siod
      siod
    • RE: My Slim 2AA Battery Node

      Oh man, one problem solved, next just comes up...

      So what can I Do now? Just upload the 8MHz bootloader and just use 8MHz instead of 1MHz?

      edit: Ok, tested it, it works with the 8MHz Bootloader!

      please explain one more time if I could just use the 8MHz Bootloader, I still could not fully understand why I should use the 1 MHz Bootloader (maybe because of my bad english and also my lack of electronics knowledge). Thank you very much!!

      edit2: I measured 0,02 Ampere consumption, isn´t that too much?

      posted in My Project
      siod
      siod
    • RE: Slim Node Si7021 sensor example

      @carlierd said:

      @ar91 Please find the code I used in 3 different nodes. The good thing with the playground lib is that there is error message if dialog with DHT22 failed.

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       */
      
      /**************************************************************************************/
      /* Temperature, humidity and luminosity measurements.                                 */
      /*                                                                                    */
      /* Version     : 1.1.6                                                                */
      /* Date        : 10/01/2016                                                           */
      /* Modified by : David Carlier                                                        */
      /**************************************************************************************/
      /*                                ---------------                                     */
      /*                            RST |             |  A5                                 */
      /*                            RX  |             |  A4                                 */
      /*                            TX  |   ARDUINO   |  A3                                 */
      /*     RFM69 (DIO0) --------- D2  |     UNO     |  A2                                 */
      /*            DHT22 --------- D3  |             |  A1                                 */
      /*            Power --------- D4  | ATMEGA 328p |  A0 --------- Light dep. resistor   */
      /*              +3v --------- VCC |             | GND --------- GND                   */
      /*              GND --------- GND |  8MHz int.  | REF                                 */
      /*                            OSC |             | VCC --------- +3v                   */
      /*                            OSC |             | D13 --------- RFM69 (SCK)           */
      /*                            D5  |             | D12 --------- RFM69 (MISO)          */
      /*                            D6  |             | D11 --------- RFM69 (MOSI)          */
      /*                            D7  |             | D10 --------- RFM69 (NSS)           */
      /*                            D8  |             |  D9                                 */
      /*                                ---------------                                     */
      /*                                                                                    */
      /* Power = Vcc for LDR.                                                               */
      /* +3v = 2*AA                                                                         */
      /*                                                                                    */
      /**************************************************************************************/
      
      #include <SPI.h>
      #include <MySensor.h>
      #include <dht.h>
      #include <MyTransportRFM69.h>
      #include <MySigningAtsha204Soft.h>
      
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define CHILD_ID_LIGHT 2
      #define CHILD_ID_VOLTAGE 3
      #define LIGHT_SENSOR_ANALOG_PIN 0
      #define HUMIDITY_SENSOR_DIGITAL_PIN 3
      #define POWER_PIN 4
      //unsigned long SLEEP_TIME = 850000; // Sleep time between reads (in milliseconds) (close to 15')
      unsigned long SLEEP_TIME = 275000; // Sleep time between reads (in milliseconds) (close to 5')
      
      //Construct MySensors library
      MySigningAtsha204Soft signer;
      MyHwATMega328 hw;
      MyTransportRFM69 transport;
      MySensor gw(transport, hw, signer);
      dht DHT;
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgLum(CHILD_ID_LIGHT, V_LEVEL);
      MyMessage msgVolt(CHILD_ID_VOLTAGE, V_VOLTAGE);
      
      /**************************************************************************************/
      /* Initialization                                                                     */
      /**************************************************************************************/
      void setup()
        {
        //Get time (for setup duration)
        #ifdef DEBUG
          unsigned long startTime = millis();
        #endif
      
        //Start MySensors
        gw.begin();
      
        //Send the Sketch Version Information to the Gateway
        gw.sendSketchInfo("GHAS sensor", "1.1.5");
      
        //Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID_HUM, S_HUM);
        gw.present(CHILD_ID_TEMP, S_TEMP);
        gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
        gw.present(CHILD_ID_VOLTAGE, S_MULTIMETER);
      
        //Delay for DHT22
        delay(1500);
      
        //Print setup debug
        #ifdef DEBUG
          int duration = millis() - startTime;
          Serial.print("[Setup duration: "); Serial.print(duration, DEC); Serial.println(" ms]");
        #endif
        }
      
      /**************************************************************************************/
      /* Main loop                                                                          */
      /**************************************************************************************/
      void loop()
        {
        //Get time (for a complete loop)
        #ifdef DEBUG
          unsigned long startTime = millis();
        #endif
      
        //Power on
        powerOnPeripherals();
      
        //Get DHT22 data
        int dht22Result = DHT.read22(HUMIDITY_SENSOR_DIGITAL_PIN);
        switch (dht22Result)
          {
          case DHTLIB_OK:  
                      //Serial.println("OK,\t");
                      break;
          case DHTLIB_ERROR_CHECKSUM:
                      #ifdef DEBUG
                        Serial.println("Checksum error,\t");
                      #endif
                      break;
          case DHTLIB_ERROR_TIMEOUT:
                      #ifdef DEBUG
                        Serial.println("Time out error,\t");
                      #endif
                      break;
          case DHTLIB_ERROR_CONNECT:
                      #ifdef DEBUG
                        Serial.println("Connect error,\t");
                      #endif
                      break;
          case DHTLIB_ERROR_ACK_L:
                      #ifdef DEBUG
                        Serial.println("Ack Low error,\t");
                      #endif
                      break;
          case DHTLIB_ERROR_ACK_H:
                      #ifdef DEBUG
                        Serial.println("Ack High error,\t");
                      #endif
                      break;
          default:
                      #ifdef DEBUG
                        Serial.println("Unknown error,\t");
                      #endif
                      break;
          }
      
        //Get temperature and humidity
        float temperature = 0;
        float humidity = 0;
        if (dht22Result == DHTLIB_OK)
          {
          temperature = DHT.temperature;
          humidity = DHT.humidity;
          }
      
        //Get power before luminosity to use real voltage
        float realVoltage = getVoltage() / 100.0;
        int batteryPcnt = realVoltage * 100 / 3.0;
        if (batteryPcnt > 100) {batteryPcnt = 100;}
        int lux = computeIlluminance(realVoltage);
      
        //Power off
        powerOffPeripherals();
      
        //Send data to gateway
        gw.send(msgHum.set(humidity, 1));
        gw.send(msgTemp.set(temperature, 1));
        gw.send(msgLum.set(lux));
        gw.send(msgVolt.set(realVoltage, 2));
        gw.sendBatteryLevel(batteryPcnt);
      
        //Print debug
        #ifdef DEBUG
          Serial.print(temperature, 1);
          Serial.print(" degC");
          Serial.print("   ");
          Serial.print(humidity, 1);
          Serial.print(" %");
          Serial.print("   ");
          Serial.print(lux);
          Serial.print(" lx");
          Serial.print("   ");
          Serial.print(realVoltage);
          Serial.print(" v");
          int duration = millis() - startTime;
          Serial.print("   ");
          Serial.print("["); Serial.print(duration, DEC); Serial.println(" ms]");
          Serial.flush();
        #endif
      
        //Sleep
        gw.sleep(SLEEP_TIME);
        }
      
      /**************************************************************************************/
      /* Allows to compute illuminance (in LUX) from LIGHT_SENSOR_ANALOG_PIN.               */
      /**************************************************************************************/
      int computeIlluminance(float realVoltage)
        {
        //Get luminosity
        int luminosity = analogRead(LIGHT_SENSOR_ANALOG_PIN);
        //Calculating the voltage in the input of the ADC
        double voltage = realVoltage * ((double)luminosity / 1024.0);
        //Calculating the resistance of the photoresistor in the voltage divider
        double resistance = (10.0 * realVoltage) / voltage - 10.0;
        //Calculating the intensity of light in lux and return it
        int illuminance = 255.84 * pow(resistance, -10/9);
        return illuminance;
        }
      
      /**************************************************************************************/
      /* Allows to get the real Vcc (return value * 100).                                   */
      /**************************************************************************************/
      int getVoltage()
        {
        const long InternalReferenceVoltage = 1056L;
        ADMUX = (0<<REFS1) | (1<<REFS0) | (0<<ADLAR) | (1<<MUX3) | (1<<MUX2) | (1<<MUX1) | (0<<MUX0);
        delay(50);  // Let mux settle a little to get a more stable A/D conversion
        //Start a conversion  
        ADCSRA |= _BV( ADSC );
        //Wait for it to complete
        while (((ADCSRA & (1<<ADSC)) != 0));
        //Scale the value
        int result = (((InternalReferenceVoltage * 1023L) / ADC) + 5L) / 10L;
        return result;
        }
      
      /**************************************************************************************/
      /* Allows to power ON peripherals.                                                    */
      /**************************************************************************************/
      void powerOnPeripherals()
        {
        //Power-up
        pinMode (POWER_PIN, OUTPUT);
        digitalWrite (POWER_PIN, HIGH);
        delay(1);
        }
      
      /**************************************************************************************/
      /* Allows to power OFF peripherals.                                                   */
      /**************************************************************************************/
      void powerOffPeripherals()
        {
        //Power off
        digitalWrite (HUMIDITY_SENSOR_DIGITAL_PIN, LOW);
        digitalWrite (POWER_PIN, LOW);
        pinMode (HUMIDITY_SENSOR_DIGITAL_PIN, INPUT);
        pinMode (POWER_PIN, INPUT);
        }
      

      Hope it helps !

      David.

      So the DHT22 works at 1MHz with 2 AAs and your code you´ve posted? No physical differnces?

      posted in My Project
      siod
      siod
    • RE: My Slim 2AA Battery Node

      ok guys, I finally set up my first sensor and it´s communicating well. I´ve attached two reed switch which work fine, only my temp snesor DHT11 doesn´t work. Are there any known issues with this sensor?

      pls have a look at my setup and my code, thank you:

      // Simple binary switch example 
      // Connect button or door/window reed switch between 
      // digitial I/O pin 3 (BUTTON1_PIN below) and GND.
      
      #include <MySensor.h>
      #include <SPI.h>
      
      // Define Node ID
      #define MY_NODE_ID 1
      
      //Kontaktschalter
      #include <Bounce2.h>
      #define CHILD1_ID 1 // Kontaktschalter 1
      #define CHILD2_ID 2 // Kontaktschalter 1
      #define BUTTON1_PIN  5  // Kontaktschalter 1
      #define BUTTON2_PIN  6  // Kontaktschalter 2
      
      //Tempsensor
      #include <DHT.h>  
      #define CHILD_ID_HUM 3
      #define CHILD_ID_TEMP 4
      #define HUMIDITY_SENSOR_DIGITAL_PIN 4
      unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
      
      MySensor gw;
      
      //Kontaktschalter
      Bounce debouncer1 = Bounce(); 
      Bounce debouncer2 = Bounce(); 
      int oldValueReed1=-1;
      int oldValueReed2=-1;
      
      //tempsensor
      DHT dht;
      float lastTemp;
      float lastHum;
      boolean metric = true; 
      
      //Messages
      // Kontaktschalter
      MyMessage msgReed1(CHILD1_ID,V_TRIPPED); // Kontaktschalter 1
      MyMessage msgReed2(CHILD2_ID,V_TRIPPED); // Kontaktschalter 2
      
      //TempMessage
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      
      void setup()  
      {  
        gw.begin(NULL, MY_NODE_ID, true);
      
        //Tempsensor
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
      
      // Setup Kontaktschalter 1
        pinMode(BUTTON1_PIN,INPUT);
          // Activate internal pull-up
        digitalWrite(BUTTON1_PIN,HIGH);
      // Setup Kontaktschalter 2
        pinMode(BUTTON2_PIN,INPUT);
        // Activate internal pull-up
        digitalWrite(BUTTON2_PIN,HIGH);
        
        // After setting up the button, setup debouncer
        debouncer1.attach(BUTTON1_PIN);
        debouncer2.attach(BUTTON2_PIN);
        debouncer1.interval(5);
        debouncer2.interval(5);
        
        // Register binary input sensor to gw (they will be created as child devices)
        // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 
        // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
        gw.present(CHILD1_ID, S_DOOR); 
        gw.present(CHILD2_ID, S_DOOR); 
        //Tempsensor
        gw.present(CHILD_ID_HUM, S_HUM);
        gw.present(CHILD_ID_TEMP, S_TEMP); 
        metric = gw.getConfig().isMetric;
      }
      
      
      //  Check if digital input has changed and send in new value
      void loop() 
      {
        //Kontakstschalter 1
        debouncer1.update();
        // Get the update value
        int valueReed1 = debouncer1.read();
       
        if (valueReed1 != oldValueReed1) {
           // Send in the new value
           gw.send(msgReed1.set(valueReed1==HIGH ? 1 : 0));
           Serial.println("Button 1 geschaltet");
           oldValueReed1 = valueReed1;
        }
        //Kontakstschalter 2
        debouncer2.update();
        // Get the update value
        int valueReed2 = debouncer2.read();
       
        if (valueReed2 != oldValueReed2) {
           // Send in the new value
           gw.send(msgReed2.set(valueReed2==HIGH ? 1 : 0));
           Serial.println("Button 2 geschaltet");
           oldValueReed2 = valueReed2;
        }
        
       //Tempsensor
      
       delay(dht.getMinimumSamplingPeriod());
      
        float temperature = dht.getTemperature();
        if (isnan(temperature)) {
            Serial.println("Failed reading temperature from DHT");
        } else if (temperature != lastTemp) {
          lastTemp = temperature;
          if (!metric) {
            temperature = dht.toFahrenheit(temperature);
          }
          gw.send(msgTemp.set(temperature, 1));
          Serial.print("T: ");
          Serial.println(temperature);
        }
        
        float humidity = dht.getHumidity();
        if (isnan(humidity)) {
            Serial.println("Failed reading humidity from DHT");
        } else if (humidity != lastHum) {
            lastHum = humidity;
            gw.send(msgHum.set(humidity, 1));
            Serial.print("H: ");
            Serial.println(humidity);
        }
      
        //gw.sleep(SLEEP_TIME); //sleep a bit 
      
      } 
      
      

      http://abload.de/image.php?img=20160306_11174141u66.jpg

      posted in My Project
      siod
      siod
    • RE: MQTT, Openhab, Mosquitto and static Node ID Problem

      Thank you Martin, that solved my issue!!

      posted in Troubleshooting
      siod
      siod
    • RE: MQTT, Openhab, Mosquitto and static Node ID Problem

      I've ordered and then built the board from here: http://forum.mysensors.org/topic/2067/my-slim-2aa-battery-node

      posted in Troubleshooting
      siod
      siod
    • RE: MQTT, Openhab, Mosquitto and static Node ID Problem

      Hi Martin, but that's all that comes in, not more. Its also not reacting when I trigger one of my reed switches.

      When triggering the reed switches of another sensor, an arduino nano with autoid configured, I can see mqtt messages coming in, so the gateway works fine.

      posted in Troubleshooting
      siod
      siod
    • MQTT, Openhab, Mosquitto and static Node ID Problem

      I have a setup of openhab and mosquitto on a raspberry pi and also a MQTT Gateway. Everything works fine in my test setup. Now I uploaded a sketch on one of my sensors and I only assigned a static Node_ID as well as child ID´s (Node ID is 1, child´s are 1,2,3,4). When I power up the sensor the serial monitor (of the gateway) gives the following output:

      0;0;3;0;9;read: 1-1-0 s=255,c=3,t=15,pt=2,l=2,sg=0:0
      0;0;3;0;9;read: 1-1-0 s=255,c=0,t=18,pt=0,l=5,sg=0:1.5.4
      0;0;3;0;9;read: 1-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
      0;0;3;0;9;send: 0-0-1-1 s=255,c=3,t=6,pt=0,l=1,sg=0,st=ok:M
      

      If I am correct the "3" means : "I_ID_REQUEST 3 Use this to request a unique node id from the controller."

      So there is something wrong with my static ID!? Funnily enough it worked in my test setup.
      Here is the code where I initialze the gw:

      gw.begin(NULL, MY_NODE_ID, true);

      where MY_NODE_ID is 1.

      Any idea what´s going wrong? Do I have to do some extra settings in mosquitto or openhab to use static Node ID´s? Or is it sth. absolutely different?

      Thank you guys!!

      BTW, here my full code/sketch:

      // Simple binary switch example 
      // Connect button or door/window reed switch between 
      // digitial I/O pin 3 (BUTTON1_PIN below) and GND.
      
      #include <MySensor.h>
      #include <SPI.h>
      
      // Define Node ID
      #define MY_NODE_ID 1
      
      //Kontaktschalter
      #include <Bounce2.h>
      #define CHILD1_ID 1 // Kontaktschalter 1
      #define CHILD2_ID 2 // Kontaktschalter 1
      #define BUTTON1_PIN  9  // Kontaktschalter 1
      #define BUTTON2_PIN  10  // Kontaktschalter 2
      
      //Tempsensor
      #include <DHT.h>  
      #define CHILD_ID_HUM 3
      #define CHILD_ID_TEMP 4
      #define HUMIDITY_SENSOR_DIGITAL_PIN 2
      unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
      
      MySensor gw;
      
      //Kontaktschalter
      Bounce debouncer1 = Bounce(); 
      Bounce debouncer2 = Bounce(); 
      int oldValueReed1=-1;
      int oldValueReed2=-1;
      
      //tempsensor
      DHT dht;
      float lastTemp;
      float lastHum;
      boolean metric = true; 
      
      //Messages
      // Kontaktschalter
      MyMessage msgReed1(CHILD1_ID,V_TRIPPED); // Kontaktschalter 1
      MyMessage msgReed2(CHILD2_ID,V_TRIPPED); // Kontaktschalter 2
      
      //TempMessage
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      
      void setup()  
      {  
        gw.begin(NULL, MY_NODE_ID, true);
      
        //Tempsensor
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
      
      // Setup Kontaktschalter 1
        pinMode(BUTTON1_PIN,INPUT);
          // Activate internal pull-up
        digitalWrite(BUTTON1_PIN,HIGH);
      // Setup Kontaktschalter 2
        pinMode(BUTTON2_PIN,INPUT);
        // Activate internal pull-up
        digitalWrite(BUTTON2_PIN,HIGH);
        
        // After setting up the button, setup debouncer
        debouncer1.attach(BUTTON1_PIN);
        debouncer2.attach(BUTTON2_PIN);
        debouncer1.interval(5);
        debouncer2.interval(5);
        
        // Register binary input sensor to gw (they will be created as child devices)
        // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 
        // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
        gw.present(CHILD1_ID, S_DOOR); 
        gw.present(CHILD2_ID, S_DOOR); 
        //Tempsensor
        gw.present(CHILD_ID_HUM, S_HUM);
        gw.present(CHILD_ID_TEMP, S_TEMP); 
        metric = gw.getConfig().isMetric;
      }
      
      
      //  Check if digital input has changed and send in new value
      void loop() 
      {
        //Kontakstschalter 1
        debouncer1.update();
        // Get the update value
        int valueReed1 = debouncer1.read();
       
        if (valueReed1 != oldValueReed1) {
           // Send in the new value
           gw.send(msgReed1.set(valueReed1==HIGH ? 1 : 0));
           Serial.println("Button 1 geschaltet");
           oldValueReed1 = valueReed1;
        }
        //Kontakstschalter 2
        debouncer2.update();
        // Get the update value
        int valueReed2 = debouncer2.read();
       
        if (valueReed2 != oldValueReed2) {
           // Send in the new value
           gw.send(msgReed2.set(valueReed2==HIGH ? 1 : 0));
           Serial.println("Button 2 geschaltet");
           oldValueReed2 = valueReed2;
        }
        
       //Tempsensor
      
       delay(dht.getMinimumSamplingPeriod());
      
        float temperature = dht.getTemperature();
        if (isnan(temperature)) {
            Serial.println("Failed reading temperature from DHT");
        } else if (temperature != lastTemp) {
          lastTemp = temperature;
          if (!metric) {
            temperature = dht.toFahrenheit(temperature);
          }
          gw.send(msgTemp.set(temperature, 1));
          Serial.print("T: ");
          Serial.println(temperature);
        }
        
        float humidity = dht.getHumidity();
        if (isnan(humidity)) {
            Serial.println("Failed reading humidity from DHT");
        } else if (humidity != lastHum) {
            lastHum = humidity;
            gw.send(msgHum.set(humidity, 1));
            Serial.print("H: ");
            Serial.println(humidity);
        }
      
        //gw.sleep(SLEEP_TIME); //sleep a bit 
      
      } 
      
      
      posted in Troubleshooting
      siod
      siod
    • RE: [Tutorial] How to burn 1Mhz & 8Mhz bootloader using Arduino IDE 1.6.5-r5

      thx for the tutorial. I perfomred every step you described, but I get errors when trying to upload a sketch:

      And I also get this error message:

      I tried to upload the 1MHz version

      edit:

      some more info form verbose mode output:

      edit2:

      Another problem: I could burn the bootloader on to one of my ATMega328 MCU´s but I needed to use a 16MHz Crystal when uploading for the first time. Now I can just burn and burn the bootloader again. Here ist the output:

      But it is the only MCU that works, all the other give the "Yikes" error, also when 16MHz Crystal is connected:

      Any explanation?

      - bootloader burning problem solved by rebuilding the wiring.

      - for some reason I could upload the sketch now, don´t ask me why. In the end I just reuploaded again and again...I hope I will be able to upload sketches to the next MCU´s as well

      Sorry for asking so many questions, but after spending hours and hours of setting up a raspberry pi with openhab, MQTT Broker and MQTT Gateway I am so close to finishing my first standalone sensor and it´s not going any further, I could cry 😢

      posted in Development
      siod
      siod
    • RE: My Slim 2AA Battery Node

      I just installed the NRF module at it´s desired place as well as the two capacitors and the resistors as described above. The crystal is only used for uploading the sketch to the Atmega328 chip, described here: https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard
      alt text

      So a wiring issue should not be the problem. Also, the code should have been uploaded well, because when I put the chip back to the breadboard and fire up my Arduino I at least receive the "radio init fail" message.

      I just wonder if you guys upload your sketches the same way or if you use a different setup. I know there is a way to upload the sketch without the 16MHz crystal and I would like to know if this could be the problem.

      edit: I´ve re-read your first post and also this thread http://forum.mysensors.org/topic/3018/tutorial-how-to-burn-1mhz-8mhz-bootloader-using-arduino-ide-1-6-5-r5/2 ...

      Do I have to burn the bootloader using 1MHz or 8 MHz? I don´t get why this makes a difference, only that the batteries would drain faster the higher the MHz rate is.

      I already uploaded a bootloader on my chips with a 16MHz crystal. Could I just re-upload a new bottloader using 1 or 8 MHz and overwrite the 16MHz bootloader?

      posted in My Project
      siod
      siod