New MS node creates lots of random sensors, as well as actual sensors [Domoticz]

  • A load of components I ordered have arrived, and I'm busying myself building new MySensors nodes for my Domoticz setup.

    I'm using DHT11, PIR, and LDR on one board, using the 3in1 sketch from here: with the MySensors Light Sensor example sketch from the library.

    This is my version:

    //this is as per the forum 3 in 1, but with ldr
    //node id set msnuslly to 10
    #include <SPI.h>
    #include <MySensor.h>  
    #include <DHT.h>  
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define CHILD_ID_MOT 2   // Id of the sensor child
    //ldr stuff
    #define CHILD_ID_LIGHT 3
    #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
    #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    MySensor gw;
    //ldr stuff
    int lastLightLevel;
    DHT dht;
    float lastTemp;
    float lastHum;
    boolean metric = true; 
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    MyMessage msgMot(CHILD_ID_MOT, V_TRIPPED);
    void setup()  
      // Send the Sketch Version Information to the Gateway
      gw.sendSketchInfo("Humidity/Motion", "1.0");
     pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
      // 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_MOT, S_MOTION);
      //ldr stuff
      gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
      metric = gw.getConfig().isMetric;
    void loop()      
      // Read digital motion value
      boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
      gw.send(msgMot.set(tripped?"1":"0"));  // Send tripped value to gw 
      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: ");
      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: ");
      //ldr stuff
      int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23; 
      Serial.print("Light Level: ");
      if (lightLevel != lastLightLevel) {
          lastLightLevel = lightLevel;
        // end light measurement
      // Sleep until interrupt comes in on motion sensor. Send update every two minute. 

    The sensors appear in Domoticz, and work fine. The next day, a load of additional, random sensors appear:


    Has anybody experienced this before? Does my code look OK? Thanks so much for any help!

  • Domoticz > Settings > uncheck "Accept new Hardware Devices". Don't forget to click Apply Settings.

  • Mod

    I had mine checked all the time but I never had this problem

  • These do look like spurious sensors created by my most recent node, for some reason. Rather than nodes from my neighbours being picked up, or similar.

    Incidentally, the actual sensors on this node have stopped updating in Domoticz since the random sensors have appeared.

    This is what my USB Serial MySensors gateway sees. Using library 1.5.1.


  • Mod

    Just wondering why you haven't updated the mysensors library

  • Because it would require updating my Gateway which is in a somewhat inaccessible place right now. That's running 1.5.1 which is when I started playing with MySensors.

    There's no way I can update it over the air, or somesuch, is there?

  • Mod

    @velkrosmaak unless it's an esp8266, I don't think you can

  • This particular one is running on an Arduino Duemilanove, but the sensor and gateway are both using the same library version (1.5.1) so that should be all good, no?

Log in to reply

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.