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

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. New MS node creates lots of random sensors, as well as actual sensors [Domoticz]

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

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

    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: https://forum.mysensors.org/topic/404/3-in-1-humidity-temp-and-motion 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
    #define HUMIDITY_SENSOR_DIGITAL_PIN 4
    
    //ldr stuff
    #define CHILD_ID_LIGHT 3
    #define LIGHT_SENSOR_ANALOG_PIN A1
    //
    
    #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
    MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
    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()  
    { 
      gw.begin(NULL,10,false);
      dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
    
      // 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; 
            
      Serial.println(tripped);
      gw.send(msgMot.set(tripped?"1":"0"));  // Send tripped value to gw 
      
      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);
      }
    
      //ldr stuff
      int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23; 
      Serial.print("Light Level: ");
      Serial.println(lightLevel);
      if (lightLevel != lastLightLevel) {
          gw.send(msg.set(lightLevel));
          lastLightLevel = lightLevel;
      }
        // end light measurement
    
      //
     
      // Sleep until interrupt comes in on motion sensor. Send update every two minute. 
      gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME);
    }
    
    

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

    0_1489518405146_upload-c805f67c-06e6-4447-afbe-7487134783c2

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

    1 Reply Last reply
    0
    • H Offline
      H Offline
      HarryDutch
      wrote on last edited by
      #2

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

      gohanG 1 Reply Last reply
      0
      • H HarryDutch

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

        gohanG Offline
        gohanG Offline
        gohan
        Mod
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • V Offline
          V Offline
          velkrosmaak
          wrote on last edited by velkrosmaak
          #4

          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.

          0_1489540411689_upload-1fbefdde-6316-4d5a-9fc3-2c2d89bb975c

          1 Reply Last reply
          0
          • gohanG Offline
            gohanG Offline
            gohan
            Mod
            wrote on last edited by
            #5

            Just wondering why you haven't updated the mysensors library

            1 Reply Last reply
            0
            • V Offline
              V Offline
              velkrosmaak
              wrote on last edited by
              #6

              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?

              gohanG 1 Reply Last reply
              0
              • V velkrosmaak

                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?

                gohanG Offline
                gohanG Offline
                gohan
                Mod
                wrote on last edited by
                #7

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

                1 Reply Last reply
                0
                • V Offline
                  V Offline
                  velkrosmaak
                  wrote on last edited by velkrosmaak
                  #8

                  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?

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


                  12

                  Online

                  11.7k

                  Users

                  11.2k

                  Topics

                  113.1k

                  Posts


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

                  • Don't have an account? Register

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