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. Temperature not presented to controller

Temperature not presented to controller

Scheduled Pinned Locked Moved Troubleshooting
7 Posts 4 Posters 2.3k Views 2 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.
  • Sander StolkS Offline
    Sander StolkS Offline
    Sander Stolk
    wrote on last edited by Sander Stolk
    #1

    Hi there,

    I've got this sketch running on a Arduino Nano with a 5V 2.1A powersupply and I cannot get the Temp presented to the gateway.

    Below is my sketch and my debug-log:

    sensor started, id 4
    send: 4-4-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1
    send: 4-4-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
    read: 4-1-0 s=255,c=3,t=6,pt=1,l=1:0
    read: 4-1-0 s=255,c=3,t=6,pt=1,l=1:0
    read: 0-0-4 s=255,c=3,t=6,pt=0,l=1:M
    send: 4-4-0-0 s=255,c=3,t=11,pt=0,l=8,st=ok:Whatever
    send: 4-4-0-0 s=255,c=3,t=12,pt=0,l=1,st=ok:7
    send: 4-4-0-0 s=0,c=0,t=16,pt=0,l=0,st=ok:
    send: 4-4-0-0 s=1,c=0,t=16,pt=0,l=0,st=fail:
    send: 4-4-0-0 s=2,c=0,t=16,pt=0,l=0,st=fail:
    send: 4-4-0-0 s=8,c=0,t=6,pt=0,l=0,st=fail:
    send: 4-4-0-0 s=3,c=0,t=0,pt=0,l=0,st=fail:
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=fail:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:487
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:430
    send: 4-4-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 0-0-4 s=255,c=3,t=8,pt=1,l=1:0
    new parent=0, d=1
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=ok:386
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=ok:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=ok:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:353
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:335
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=fail:350
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=fail:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=fail:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:350
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:332
    send: 4-4-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=ok:347
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=ok:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=ok:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:351
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:333
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=fail:348
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=fail:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=fail:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:349
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:331
    send: 4-4-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 0-0-4 s=255,c=3,t=8,pt=1,l=1:0
    new parent=0, d=1
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=ok:346
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=ok:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=ok:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:349
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:330
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=fail:346
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=fail:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=fail:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:350
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:331
    send: 4-4-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=ok:346
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=ok:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=ok:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:351
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:332
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=fail:348
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=fail:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=fail:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:348
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:330
    send: 4-4-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=ok:345
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=ok:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=ok:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:349
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:330
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=fail:346
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=fail:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=fail:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:346
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:327
    send: 4-4-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=ok:343
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=ok:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=ok:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:349
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:331
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=fail:346
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=fail:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=fail:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:346
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:327
    send: 4-4-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 0-0-4 s=255,c=3,t=8,pt=1,l=1:0
    new parent=0, d=1
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=ok:343
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=ok:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=ok:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:346
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:327
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=fail:343
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=fail:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=fail:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:344
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:326
    send: 4-4-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=ok:341
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=ok:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=ok:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:347
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:328
    send: 4-4-0-0 s=2,c=1,t=23,pt=2,l=2,st=fail:344
    send: 4-4-0-0 s=3,c=1,t=16,pt=2,l=2,st=fail:0
    send: 4-4-0-0 s=8,c=1,t=0,pt=7,l=5,st=fail:-127.0
    send: 4-4-0-0 s=0,c=1,t=23,pt=2,l=2,st=fail:344
    send: 4-4-0-0 s=1,c=1,t=23,pt=2,l=2,st=fail:325
    send: 4-4-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 4-1-255 s=255,c=3,t=7,pt=0,l=0:
    read: 0-0-4 s=255,c=3,t=8,pt=1,l=1:0```]
    
    
    ```#include <SPI.h>
    #include <MySensor.h>
    #include <DallasTemperature.h>
    #include <OneWire.h>
    #include <Bounce2.h>
    
    #define LIGHT_SENSOR_ANALOG_PIN_0 0 // Wasmachine
    #define LIGHT_SENSOR_ANALOG_PIN_1 1 // Droger
    #define LIGHT_SENSOR_ANALOG_PIN_2 2 // Zon
    #define BUTTON_PIN_1 3 // Balkondeur
    #define TEMP_1 8 // Pin where dallas sensor is connected
    
    unsigned long SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds)
    
    OneWire oneWire(TEMP_1);
    DallasTemperature sensors(&oneWire);
    boolean metric = true;
    
    MySensor gw;
    MyMessage msgW(LIGHT_SENSOR_ANALOG_PIN_0,V_LIGHT_LEVEL);
    MyMessage msgD(LIGHT_SENSOR_ANALOG_PIN_1,V_LIGHT_LEVEL);
    MyMessage msgZ(LIGHT_SENSOR_ANALOG_PIN_2,V_LIGHT_LEVEL);
    MyMessage msgTemp(TEMP_1,V_TEMP);
    MyMessage msgBD(BUTTON_PIN_1,V_TRIPPED);
    
    void setup()
    {
      gw.begin();
      // Startup OneWire
      sensors.begin();
    
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("Whatever", "7");
    
      // Register all sensors to gateway (they will be created as child devices)
      gw.present(LIGHT_SENSOR_ANALOG_PIN_0,S_LIGHT_LEVEL);
      gw.present(LIGHT_SENSOR_ANALOG_PIN_1,S_LIGHT_LEVEL);
      gw.present(LIGHT_SENSOR_ANALOG_PIN_2,S_LIGHT_LEVEL);
      gw.present(TEMP_1,S_TEMP);
      gw.present(BUTTON_PIN_1,S_DOOR);
      
      pinMode(BUTTON_PIN_1,INPUT);
      // Activate internal pull-up
      digitalWrite(BUTTON_PIN_1,HIGH);
    }
    
    void loop()
    {
      //Read temp from sensor
      sensors.requestTemperatures();
      float temperature = static_cast<float>(static_cast<int> (sensors.getTempCByIndex(TEMP_1) * 10.)) / 10.;
      gw.send(msgTemp.set(temperature, 1));
      //delay(5000);
      
      int lightLevel0 = analogRead(LIGHT_SENSOR_ANALOG_PIN_0);
      //delay(5000);
      int lightLevel1 = analogRead(LIGHT_SENSOR_ANALOG_PIN_1);
      //delay(5000);
      int lightLevel2 = analogRead(LIGHT_SENSOR_ANALOG_PIN_2);
      //delay(5000);
      //Serial.println(lightLevel0);
      //Serial.println(lightLevel1);
      //Serial.println(lightLevel2);
      gw.send(msgW.set(lightLevel0));
      gw.send(msgD.set(lightLevel1));
      gw.send(msgZ.set(lightLevel2));
      gw.send(msgBD.set(BUTTON_PIN_1==HIGH ? 1 : 0));
    
      
      gw.sleep(SLEEP_TIME);
    }
    

    I'm using 1.4 version in combination with a Arduino Gateway Nano.

    Everything else is presented to the controller but not the temperature.
    When I build a sketch with only the temp it works but that differs from this code above.

    1 Reply Last reply
    0
    • rvendrameR Offline
      rvendrameR Offline
      rvendrame
      Hero Member
      wrote on last edited by
      #2

      You might try to add a capacitor between radio's VCC/GND, if not yet. Another try is to add a gw.wait(100) after each gw.send() (this made the trick for me).
      If after that you still getting a lot of st=fails, try replacing PSU / radio.

      Home Assistant / Vera Plus UI7
      ESP8266 GW + mySensors 2.3.2
      Alexa / Google Home

      1 Reply Last reply
      0
      • Sander StolkS Offline
        Sander StolkS Offline
        Sander Stolk
        wrote on last edited by
        #3

        Cap is present and I will proceed to add a 100ms delay between those messages.
        Otherwise I will replace the radio.

        Let you know!

        1 Reply Last reply
        0
        • Sander StolkS Offline
          Sander StolkS Offline
          Sander Stolk
          wrote on last edited by Sander Stolk
          #4

          Implemented the wait time but no luck
          Replaced the radio and the cap but no luck
          Checked the wires but no luck

          Next thing is checking the code because the door is working and comes after the tempsensor.
          The reading of the tempsensor says -127.0

          Is there somebody who knows what kind of error -127.0 degrees means except my bedroom is very cold :P

          1 Reply Last reply
          0
          • hekH Offline
            hekH Offline
            hek
            Admin
            wrote on last edited by
            #5

            https://github.com/mysensors/Arduino/blob/master/libraries/DallasTemperature/DallasTemperature.h#L57

            1 Reply Last reply
            1
            • Tomasz PazioT Offline
              Tomasz PazioT Offline
              Tomasz Pazio
              wrote on last edited by
              #6

              Sander, I have the same issue on my side.
              http://forum.mysensors.org/topic/1715/multiple-ds18d20-does-not-report-temperature

              1 Reply Last reply
              0
              • Sander StolkS Offline
                Sander StolkS Offline
                Sander Stolk
                wrote on last edited by Sander Stolk
                #7

                Boom! Got it!

                The sketch above does not send the temp because -127.0 / disconnected however with this sketch and implemented in my sketch above and it works...

                #include <MySensor.h>  
                #include <SPI.h>
                #include <DallasTemperature.h>
                #include <OneWire.h>
                
                #define ONE_WIRE_BUS 8 // Pin where dallase sensor is connected 
                #define MAX_ATTACHED_DS18B20 16
                
                unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) 30000 orig
                OneWire oneWire(ONE_WIRE_BUS);
                DallasTemperature sensors(&oneWire);
                MySensor gw;
                float lastTemperature[MAX_ATTACHED_DS18B20];
                int numSensors=0;
                boolean receivedConfig = false;
                boolean metric = true; 
                // Initialize temperature message
                MyMessage msg(0,V_TEMP);
                
                void setup()  
                { 
                  // Startup OneWire 
                  sensors.begin();
                
                  // Startup and initialize MySensors library. Set callback for incoming messages. 
                  //gw.begin(); 
                  gw.begin();
                
                  // Send the sketch version information to the gateway and Controller
                  gw.sendSketchInfo("test temp");
                
                  // Fetch the number of attached temperature sensors  
                  numSensors = sensors.getDeviceCount();
                
                  // Present all sensors to controller
                  for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
                     gw.present(i, V_TEMP);
                  }
                }
                
                
                void loop()     
                {     
                  // Process incoming messages (like config from server)
                  gw.process(); 
                
                  // Fetch temperatures from Dallas sensors
                  sensors.requestTemperatures(); 
                
                  // Read temperatures and send them to controller 
                  for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
                 
                    // Fetch and round temperature to one decimal
                    float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
                 
                    // Only send data if temperature has changed more then 1 degC and no error
                    if (int(lastTemperature[i]) != int(temperature) && temperature != -127.00) { //added integer
                 
                      // Send in the new temperature
                      gw.send(msg.setSensor(i).set(temperature,1));
                      lastTemperature[i]=temperature;
                    }
                  }
                  //gw.sleep(SLEEP_TIME);
                }
                

                Same hardware, same libs and different code...
                You tell me whats wrong because I don't know it anymore...

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


                13

                Online

                11.7k

                Users

                11.2k

                Topics

                113.0k

                Posts


                Copyright 2019 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