BME280 pressure not shown
-
I have added a message for barometric pressure to one of my nodes. The node is able to send the message and gets ACK. Domoticz sees the node in "Hardware" (see screen shot below; I first tried with child_id 4 and then with child_id 6, that's why there are 2 children). I am unable to see the child in "Devices", and there is no widget for the device.
Any ideas on how to troubleshoot this?
Domoticz log
2019-03-05 19:16:19.424 Status: MySensors: Node: 1, Sketch Name: StorageRoom Mar 5 2019 2019-03-05 19:16:19.505 Status: MySensors: Node: 1, Sketch Version: 1.2 2019-03-05 19:16:20.204 (MySensors RFM69) General/Sound Level (Storage RSSI) 2019-03-05 19:16:20.428 (MySensors RFM69) General/Sound Level (Storage RSSI) 2019-03-05 19:16:20.655 (MySensors RFM69) General/Sound Level (Storage RSSI) 2019-03-05 19:16:21.474 (MySensors RFM69) General/Voltage (Storage Voltage Before) 2019-03-05 19:16:21.490 (MySensors RFM69) General/Sound Level (Storage RSSI) 2019-03-05 19:16:21.564 (MySensors RFM69) General/Sound Level (Storage RSSI) 2019-03-05 19:16:21.640 (MySensors RFM69) General/Sound Level (Storage RSSI) 2019-03-05 19:16:21.720 (MySensors RFM69) General/Sound Level (Storage RSSI) 2019-03-05 19:16:21.799 (MySensors RFM69) General/Voltage (Storage Voltage After) 2019-03-05 19:16:21.815 (MySensors RFM69) General/Sound Level (Storage RSSI) 2019-03-05 19:17:05.678 (MySensors RFM69) General/Sound Level (2.4GHz Wifi RSSI RFM69GW)
My sketch:
// Enable debug prints #define MY_DEBUG #define MY_NODE_ID 1 // Enable and select radio type attached #define MY_RFM69_NEW_DRIVER //#define MY_RX_MESSAGE_BUFFER_FEATURE #define MY_RFM69_ATC_MODE_DISABLED #define MY_RFM69_CSMA_LIMIT_DBM -75 #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_RFM69_FREQUENCY RFM69_433MHZ #define MY_RF69_IRQ_PIN 2 #define MY_RF69_SPI_CS 10 //#define MY_DEBUG_VERBOSE_RFM69 // Temporary #define MY_TRANSPORT_WAIT_READY_MS (30000) // Don't stay awake for more than 30s if communication is broken #include <MySensors.h> // From Library Manager #include <Adafruit_BME280.h> Adafruit_BME280 bme; static const uint64_t UPDATE_INTERVAL = 300000; #define WAIT_TIME 150 #define ALTITUDE 6 #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 #define CHILD_ID_VCC_BEFORE 2 #define CHILD_ID_VCC_AFTER 3 #define CHILD_ID_PRESSURE 6 MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgVccBefore(CHILD_ID_VCC_BEFORE, V_VOLTAGE); MyMessage msgVccAfter(CHILD_ID_VCC_AFTER, V_VOLTAGE); MyMessage msgPressure(CHILD_ID_PRESSURE, V_PRESSURE); //TODO: Add light detection (irq-based, LDR) //TODO: Add flooding detection void presentation() { // Send the sketch version information to the gateway sendSketchInfo(F("StorageRoom " __DATE__), F("1.2")); wait(WAIT_TIME); present(CHILD_ID_HUM, S_HUM); wait(WAIT_TIME); present(CHILD_ID_TEMP, S_TEMP); wait(WAIT_TIME); present(CHILD_ID_VCC_BEFORE, S_CUSTOM); wait(WAIT_TIME); present(CHILD_ID_VCC_AFTER, S_CUSTOM); wait(WAIT_TIME); present(CHILD_ID_PRESSURE, S_BARO); } void setup() { if (! bme.begin(0x76)) { Serial.println("Could not find a valid BME280 sensor, check wiring! Continuing without sensor..."); } bme.setSampling(Adafruit_BME280::MODE_FORCED, Adafruit_BME280::SAMPLING_X1, // temperature Adafruit_BME280::SAMPLING_X1, // pressure Adafruit_BME280::SAMPLING_X1, // humidity Adafruit_BME280::FILTER_OFF); } void loop() { static float lastTemp, lastHum, lastPressure; send(msgVccBefore.set(readVcc() / 1000.0, 3)); bme.takeForcedMeasurement(); float temperature = bme.readTemperature(); if (isnan(temperature)) { Serial.println("Failed reading temperature"); } else if (temperature != lastTemp) { // Only send temperature if it changed since the last measurement lastTemp = temperature; send(msgTemp.set(temperature, 1)); } #ifdef MY_DEBUG Serial.print("T: "); Serial.println(temperature); #endif float humidity = bme.readHumidity(); if (isnan(humidity)) { Serial.println("Failed reading humidity"); } else if (humidity != lastHum) { // Only send humidity if it changed since the last measurement lastHum = humidity; send(msgHum.set(humidity, 1)); } #ifdef MY_DEBUG Serial.print("H: "); Serial.println(humidity); #endif float pressure = bme.readPressure() / pow((1.0 - (ALTITUDE / 44330.0)), 5.255); // Adjust to sea level pressure using user altitude if (isnan(pressure)) { Serial.println("Failed reading pressure"); } else if (pressure != lastPressure) { // Only send pressure if it changed since the last measurement lastPressure = pressure; send(msgPressure.set(pressure, 1)); } #ifdef MY_DEBUG Serial.print("P: "); Serial.println(pressure); #endif send(msgVccAfter.set(readVcc() / 1000.0, 3)); // Sleep for a while to save energy sleep(UPDATE_INTERVAL); } long readVcc() { // From http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/ // Read 1.1V reference against AVcc // set the reference to Vcc and the measurement to the internal 1.1V reference #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) ADMUX = _BV(MUX5) | _BV(MUX0); #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) ADMUX = _BV(MUX3) | _BV(MUX2); #else ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); #endif delay(2); // Wait for Vref to settle ADCSRA |= _BV(ADSC); // Start conversion while (bit_is_set(ADCSRA, ADSC)); // measuring uint8_t low = ADCL; // must read ADCL first - it then locks ADCH uint8_t high = ADCH; // unlocks both long result = (high << 8) | low; result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000 return result; // Vcc in millivolts }
Node log:
20:16:17.369 -> 20:16:17.369 -> __ __ ____ 20:16:17.369 -> | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ 20:16:17.369 -> | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __| 20:16:17.369 -> | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ 20:16:17.369 -> |_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/ 20:16:17.369 -> |___/ 2.3.2-beta 20:16:17.369 -> 20:16:17.369 -> 18 MCO:BGN:INIT NODE,CP=RPNNA---,REL=3,VER=2.3.2-beta 20:16:17.369 -> 28 TSM:INIT 20:16:17.369 -> 28 TSF:WUR:MS=30000 20:16:17.369 -> 32 TSM:INIT:TSP OK 20:16:17.369 -> 34 TSM:INIT:STATID=1 20:16:17.369 -> 36 TSF:SID:OK,ID=1 20:16:17.369 -> 38 TSM:FPAR 20:16:17.369 -> 45 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 20:16:18.285 -> 954 TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0 20:16:18.285 -> 960 TSF:MSG:FPAR OK,ID=0,D=1 20:16:19.372 -> 2054 TSM:FPAR:OK 20:16:19.372 -> 2054 TSM:ID 20:16:19.372 -> 2056 TSM:ID:OK 20:16:19.406 -> 2058 TSM:UPL 20:16:19.474 -> 2127 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1 20:16:19.712 -> 2377 TSF:MSG:READ,0-0-1,s=255,c=3,t=25,pt=1,l=1,sg=0:1 20:16:19.712 -> 2383 TSF:MSG:PONG RECV,HP=1 20:16:19.712 -> 2385 TSM:UPL:OK 20:16:19.712 -> 2387 TSM:READY:ID=1,PAR=0,DIS=1 20:16:19.814 -> 2459 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 20:16:20.017 -> 2701 TSF:MSG:READ,0-0-1,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 20:16:20.085 -> 2781 TSF:MSG:SEND,1-1-0-0,s=255,c=0,t=17,pt=0,l=10,sg=0,ft=0,st=OK:2.3.2-beta 20:16:20.187 -> 2861 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0 20:16:20.221 -> 2897 TSF:MSG:READ,0-0-1,s=255,c=3,t=6,pt=0,l=1,sg=0:M 20:16:20.322 -> 2975 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=11,pt=0,l=23,sg=0,ft=0,st=OK:StorageRoom Mar 5 2019 20:16:20.390 -> 3061 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.2 20:16:20.594 -> 3287 TSF:MSG:SEND,1-1-0-0,s=0,c=0,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 20:16:20.831 -> 3512 TSF:MSG:SEND,1-1-0-0,s=1,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=OK: 20:16:21.068 -> 3737 TSF:MSG:SEND,1-1-0-0,s=2,c=0,t=23,pt=0,l=0,sg=0,ft=0,st=OK: 20:16:21.272 -> 3960 TSF:MSG:SEND,1-1-0-0,s=3,c=0,t=23,pt=0,l=0,sg=0,ft=0,st=OK: 20:16:21.509 -> 4184 TSF:MSG:SEND,1-1-0-0,s=6,c=0,t=8,pt=0,l=0,sg=0,ft=0,st=OK: 20:16:21.509 -> 4192 MCO:REG:REQ 20:16:21.577 -> 4261 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2 20:16:21.815 -> 4507 TSF:MSG:READ,0-0-1,s=255,c=3,t=27,pt=1,l=1,sg=0:1 20:16:21.849 -> 4513 MCO:PIM:NODE REG=1 20:16:21.849 -> 4515 MCO:BGN:STP 20:16:22.255 -> 4933 MCO:BGN:INIT OK,TSP=1 20:16:22.357 -> 5007 TSF:MSG:SEND,1-1-0-0,s=2,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:3.339 20:16:22.425 -> 5097 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:22.9 20:16:22.425 -> T: 22.85 20:16:22.527 -> 5175 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:33.8 20:16:22.527 -> H: 33.79 20:16:22.561 -> 5255 TSF:MSG:SEND,1-1-0-0,s=6,c=1,t=4,pt=7,l=5,sg=0,ft=0,st=OK:100240.5 20:16:22.595 -> P: 100240.46 20:16:22.663 -> 5335 TSF:MSG:SEND,1-1-0-0,s=3,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:3.329 20:16:22.663 -> 5343 MCO:SLP:MS=300000,SMS=0,I1=255,M1=255,I2=255,M2=255
Time on my Domoticz server is off by 1 hour, that's why the serial log is one hour ahead.
-
Never mind. I checked again and now it was listed in devices. Don't know why it wasn't there before, but at least it works now.
-
I have seen domoticz not add a device to the list until it actually sees some value from the device (not just presentation). Might be what happened.
-
@nagelc yes that could be it. I have been fooled by that behavior before
The log shows that the value was delivered though
20:16:22.561 -> 5255 TSF:MSG:SEND,1-1-0-0,s=6,c=1,t=4,pt=7,l=5,sg=0,ft=0,st=OK:100240.5