• Categories
    • Recent
    • Tags
    • Popular
    • Register
    • Login

    Exception with "nan" messages

    Scheduled Pinned Locked Moved Developers Zone
    3 Posts 3 Posters 1.1k Views 2 Watching
    Loading More Posts
    • 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.
    • N Offline
      njbuch
      last edited by

      I am debugging now, but I am having some problems with some DHT11 sensors, that are sometimes (once per hour) returning weird values. I want to filter that away at the device, but currently I am getting:

      2018-01-02 21:44:49,590 ERROR [Thread-6] [org.mycontroller.standalone.message.MessageMonitorThread:119] Throws exception while processing!, [RawMessage(gatewayId=1, data=nan, subData=out_esp/ESP_2D5A26/humid-3/C_SET/V_HUM/0, isTxMessage=false, networkType=MY_CONTROLLER, timestamp=1514925889586)]
      java.lang.NumberFormatException: For input string: "nan"
      	at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
      	at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
      	at java.lang.Double.parseDouble(Double.java:538)
      	at java.lang.Double.valueOf(Double.java:502)
      	at org.mycontroller.standalone.utils.McUtils.getDouble(McUtils.java:100)
      	at org.mycontroller.standalone.utils.McUtils.getDouble(McUtils.java:95)
      	at org.mycontroller.standalone.message.McMessageEngine.updateSensorVariable(McMessageEngine.java:913)
      	at org.mycontroller.standalone.message.McMessageEngine.recordSetTypeData(McMessageEngine.java:997)
      	at org.mycontroller.standalone.message.McMessageEngine.execute(McMessageEngine.java:108)
      	at org.mycontroller.standalone.message.McMessageEngine.run(McMessageEngine.java:1117)
      	at org.mycontroller.standalone.message.McMessageUtils.sendToMcMessageEngine(McMessageUtils.java:677)
      	at org.mycontroller.standalone.provider.mc.McProviderBridge.executeRawMessage(McProviderBridge.java:59)
      	at org.mycontroller.standalone.message.McMessageUtils.sendToProviderBridge(McMessageUtils.java:585)
      	at org.mycontroller.standalone.message.MessageMonitorThread.processRawMessage(MessageMonitorThread.java:107)
      	at org.mycontroller.standalone.message.MessageMonitorThread.run(MessageMonitorThread.java:182)
      	at java.lang.Thread.run(Thread.java:748)
      

      I am interested in knowing if there is a message somewhere else than in the server log when bad messages are coming from the devices.

      jkandasaJ T 2 Replies Last reply Reply Quote 0
      • jkandasaJ Offline
        jkandasa @njbuch
        last edited by jkandasa

        @njbuch These type of messages dropped when it sees the error, hence you will not see anywhere other than this log.

        1 Reply Last reply Reply Quote 0
        • T Offline
          Tag MOD @njbuch
          last edited by Tag

          @njbuch

          If your DHT11 returns "nan" it means that it is not possible for the node to read the sensor, or received undeadable data, so the result should not even be send to mycontroller. You could try to make your sensor aware of this reading by using the isnan() function...

          Below is an example i have found.

          https://github.com/adafruit/DHT-sensor-library/blob/master/examples/DHTtester/DHTtester.ino

            // Check if any reads failed and exit early (to try again).
            if (isnan(h) || isnan(t) || isnan(f)) {
              Serial.println("Failed to read from DHT sensor!");
              return;
            }
          

          (DHT11 is from a specs perspective not the best one to use, DHT22 performs much better...)

          1 Reply Last reply Reply Quote 0
          • First post
            Last post

          0

          Online

          587

          Users

          529

          Topics

          3.4k

          Posts
          Copyright © 2015-2025 MyController.org | Contributors | Localization