Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Neo Mod
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Neo Mod

    @Neo Mod

    9
    Reputation
    28
    Posts
    564
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Neo Mod Follow

    Best posts made by Neo Mod

    • RE: [SOLVED] ESP8266 MQTT Gateway - Non-Stable Operation, Interrupts after 2-4 hrs

      Hi,

      Thank you very much for your help.

      I have just resetted again the sensor, trying to figure out what is the problem (I've changed the MQTT Topic just for this test).

      This one is the MQTT Subscription:

      2018-08-10 15:04:37.862 Status: MQTT: Connecting to 192.168.1.39:1883
      2018-08-10 15:04:37.963 Status: MQTT: connected to: 192.168.1.39:1883
      2018-08-10 15:04:37.963 Status: MySensorsMQTT: connected to: 192.168.1.39:1883
      2018-08-10 15:04:38.063 Status: MQTT: Subscribed
      2018-08-10 15:04:44.821 Status: MQTT: Worker stopped.
      
      

      This is the MQTT actually working and receiving updates:

      2018-08-10 15:08:59.432 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 29.00
      2018-08-10 15:08:59.436 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:08:59.532 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 57.60
      2018-08-10 15:08:59.536 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:08.283 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 29.00
      2018-08-10 15:09:08.287 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:08.383 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 56.80
      2018-08-10 15:09:08.387 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:17.392 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 28.90
      2018-08-10 15:09:17.397 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:17.493 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 57.70
      2018-08-10 15:09:17.497 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:26.326 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 28.90
      2018-08-10 15:09:26.329 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:26.426 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 58.00
      2018-08-10 15:09:26.429 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:35.436 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 28.80
      2018-08-10 15:09:35.440 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:35.536 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 57.90
      2018-08-10 15:09:35.541 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:44.364 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 28.80
      2018-08-10 15:09:44.369 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:44.465 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 57.90
      2018-08-10 15:09:44.469 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:53.474 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 28.80
      2018-08-10 15:09:53.479 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:53.575 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 58.00
      2018-08-10 15:09:53.580 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:10:02.408 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 28.80
      2018-08-10 15:10:02.412 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:10:02.508 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 58.00
      2018-08-10 15:10:02.513 (fh2-esterno) Temp + Humidity (Esterno)
      
      

      As soon as I got the "freeze" I'll post the LOG.

      posted in Development
      Neo Mod
      Neo Mod
    • RE: [NoviceUser] General notions to start a project: components, layout, connections, etc.

      Thank you so much!

      Well, I just made the first order for components and I have installed a test enviroment for HomeAssistant on a spare ARMBIAN board I had.

      I'll keep reading the forum and try to prepare myself..then I hope to be back with more practical questions 😛

      Thank you again for your precious help!

      posted in Troubleshooting
      Neo Mod
      Neo Mod
    • RE: [SOLVED] ESP8266 MQTT Gateway: Can't Subscribe from Domoticz with Mosquitto running on Pi 3

      Thank you so much! You just saved me (a certified n00b, I know xD) from countless hours of headache!

      @mfalkvidd said in ESP8266 MQTT Gateway: Can't Subscribe from Domoticz with Mosquitto running on Pi 3:

      Just a guess: maybe all you need is to use the rpi3 ip instead of the esp8266 ip?

      posted in Development
      Neo Mod
      Neo Mod
    • RE: [Solved] MySensors WiFi Gateway with NODE-MCU ESP8266 and Capacitive Soil Moisture Sensor : first steps, first errors

      @mfalkvidd thank you! I didn't noticed that among the whole log, my ignorance about this just kicked-in. Thank you again fo your help, I'll read on how to set the beta library and compile again.

      posted in Troubleshooting
      Neo Mod
      Neo Mod
    • RE: [SOLVED] MySensors and DHT22 - difficoulties in getting started

      After a lot of research, trial and error I managed to solve the issue; I’m going to share what I’ve learned, hoping that it might be useful for others.

      NOTE: * If you want the solution “ready to consume” just skip the explaining paragraph and go to the last one.*

      First of all, let me say that I have mixed feelings about this sensor: on paper it should be one of most basic and easy to use but in reality a quick search on the web shows a terrific amount of problems with this sensor.

      From what I could gather It is clear that this sensor (DHT22 – AM2023) IS NOT the best choice in terms of:

      • Usability
      • Accuracy
      • Compatibility

      I compared its readings against a BOSH BME280 and there is always a discrepancy of ~ 2°C and 5% RH.

      One could be tempted to move directly to BME280, and I would agree if not for a relatively big problem: this sensor works with I2C and so it is not usable if you plan on developing a Radio Node / Gateway with MySensors and NodeMCU.

      ( yes, I’m aware of the method to read multiple sensors on I2C by using a pair of Resistance approx. between 3K and 10K – depending on the sensor – but I wasn’t capable of getting the BME280 working with 2.4Ghz Radio on NodeMCU. Each time GW or NODE was trying to access Radio I had a soft reset.)

      Back to the DHT22: another huge problem, from my standpoint, is the incredible mess it has with libraries. Honestly, I could not describe it in another way: there are thousands of libraries “adapted” for the DHT22 and even more users complaining about their usability.

      Now MySensors should have its own Library for DHT22 (and I tried it!) except this library appears to have a problematic approach to NodeMCU ESP8266 and DHT22 Sensors made by “ASAIR”.

      ( And I believe this is something worth being clearly stated in the “Build” page of MySensors; a warning would have been nice for a novice like me, whom bought the “best” DHT22 sensors he could find in order to have a good measurement)

      Another very popular library is the Adafruit one, but it also got problems with ASAIR sensors; moreover it has been “stripped out” of error codes so the only error you might get is a quite meaningless “Can’t connect to DHT22”.

      NodeMCU, MySensors and ASAIR AM2032 DHT22

      So, here we are: how to make this “bloody thing” work with MySensors and ESP8266.

      First of all, you need this specific library: DHT v. 0.1.13 by Rob Tillaart.

      Not the previous, not the updated one: you need EXACTLY the VERSION 0.1.13.

      Secondly, you need to understand that NodeMCU board has a serious issue with PIN Numbering: they probably thought it was funny to rename all ESP8266 Pins differently on the board respect the GPIO ordering.

      (please bear with me for the joke, it took me almost 2 days to figure the issue with pins. Most certainly is because I'm a "n00b" but a little disclaimer would have been a blessing for my headache. 😛 )

      Keep in mind the following picture as reference:

      alt text

      If you have your DHT22 sensor connected to pin “D4” you have to initialize it in the Arduino IDE as “2” because D2 actually corresponds to GPIO2.

      If all this wasn’t enough, wait there is more!

      You have your sketch ready, your sensor wired (eventually with pull-up resistor and stability capacitor, depending on the version you bought. I was lazy and bought the sensor already attached on the micro-board with resistance and capacitor) and still getting “DHT22 Timeout” error in Serial Monitor.

      You don’t have a faulty sensor, do as follows:

      1. Connect the sensor to the board
      2. Load your sketch
      3. Open serial monitor, “DHT22 Timeout” will appear
      4. Disconnect just the sensor, keep the board powered and connected
      5. Reconnect the sensor in this precise order: Ground, VCC, Data
      6. Magically you will start having readings in the Serial Monitor.

      If you cut power to the Node/Gateway you have to repeat steps 4-5-6.

      Conclusions:

      I am happy to have a working sensor, but I’m frustrated about all the time I spent having a such simple sensor working correctly.

      I wish I had this information before, so I could plan a different development.

      I really hope that my experience could help other users.

      posted in Development
      Neo Mod
      Neo Mod
    • [SOLVED] Soft WDT Reset on MQTT ESP8266 GW with NRF24L01+

      I'm trying to replicate a gateway with the same hardware of four others that are already running, but I can't figure out why I'm hitting my head against a "SOFT WDT RESET" cycle that appears to be related to the use of NRF24L01+ radio.

      I did all the "basic" troubleshooting before writing this:

      • changed ESP8266 board (ordered 8 different models, from different producers and sellers)
      • changed NRF24L01+ module (ordered 6 items from different producers and sellers)
      • changed dupoint wires multiple times
      • changed power source (USB, Bench, Wall Charger, Battery)
      • changed library versions, both for MySensors and for BME280

      Setup is as follows:

      • Gateway with MQTT on ESP8266 Nodemcu
      • NRF24L01+
      • BME280

      This is the sketch I'm trying to use:

      #define MY_DEBUG
      #define MY_DEBUG_VERBOSE_GATEWAY
      #define MY_BAUD_RATE 9600
      #define MY_RADIO_RF24
      #define MY_RF24_DATARATE RF24_2MBPS
      #define MY_RF24_PA_LEVEL RF24_PA_HIGH
      #define MY_RF24_CE_PIN 3
      #define MY_GATEWAY_MQTT_CLIENT
      #define MY_GATEWAY_ESP8266
      #define MY_MQTT_PUBLISH_TOPIC_PREFIX "domoticz/in/fh-gateway-esterno-new"
      #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "domoticz/out/fh-gateway-esterno-new"
      #define MY_MQTT_CLIENT_ID "fh-gateway-esterno-new"
      #define MY_WIFI_SSID "iNeo"
      #define MY_WIFI_PASSWORD "password"
      #define MY_HOSTNAME "fh-gateway-esterno-new"
      #define MY_CONTROLLER_IP_ADDRESS 192, 168, 0, 3
      #define MY_PORT 1883
      #define MY_SIGNAL_REPORT_ENABLED
      #define MY_TRANSPORT_SANITY_CHECK
      #include <ESP8266WiFi.h>
      #include <MySensors.h>
      #include <SPI.h> 
      #include <Wire.h>
      #include "BlueDot_BME280.h"
      BlueDot_BME280 bme280 = BlueDot_BME280();
      #define LONG_WAIT 500
      #define SHORT_WAIT 150
      #define SECURE_WAIT 60000
      #define SKETCH_NAME "Gateway Esterno"
      #define SKETCH_VERSION "v4.0"
      #define TEMP_CHILD_ID 1
      #define HUM_CHILD_ID 2
      #define BARO_CHILD_ID 3
      uint32_t SLEEP_TIME = 15000; 
      bool metric = true;
      MyMessage temperatureMsg(TEMP_CHILD_ID, V_TEMP);
      MyMessage humidityMsg(HUM_CHILD_ID, V_HUM);
      MyMessage pressureMsg(BARO_CHILD_ID, V_PRESSURE);
      
      void preHwInit()
      {
      Wire.setClock(100000);
      bme280.parameter.communication = 0;
      bme280.parameter.I2CAddress = 0x77;
      bme280.parameter.sensorMode = 0b11;
      bme280.parameter.IIRfilter = 0b010;
      bme280.parameter.humidOversampling = 0b011;
      bme280.parameter.tempOversampling = 0b011;
      bme280.parameter.pressOversampling = 0b101;
      bme280.parameter.pressureSeaLevel = 1013.25; 
      bme280.parameter.tempOutsideCelsius = 15;
      bme280.init();
      }
      
      void setup()
      {
      }
      
      void presentation()
      {
      sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
      wait(LONG_WAIT);
      present(BARO_CHILD_ID, S_BARO);
      wait(SHORT_WAIT);
      present(TEMP_CHILD_ID, S_TEMP);
      wait(SHORT_WAIT);
      present(HUM_CHILD_ID, S_HUM);
      wait(SHORT_WAIT);
      }
      
      void loop()
      {
      send(temperatureMsg.set(bme280.readTempC(), 2));
      wait(SHORT_WAIT);
      send(humidityMsg.set(bme280.readHumidity(), 2));
      wait(SHORT_WAIT);
      send(pressureMsg.set(bme280.readPressure(), 2));
      wait(LONG_WAIT);
      wait(SLEEP_TIME);
      }
      

      This is the error I'm getting, it repeats endlessy as soon as I enable the radio:

      03:52:43.408 -> ⸮l⸮r⸮86 MCO:BGN:INIT GW,CP=RNNGE---,REL=255,VER=2.3.1
      03:52:43.558 -> 138 TSF:LRT:OK
      03:52:43.590 -> 154 TSM:INIT
      03:52:43.590 -> 167 TSF:WUR:MS=0
      03:52:43.625 -> 192 TSM:INIT:TSP OK
      03:52:43.667 -> scandone
      03:52:43.667 -> state: 0 -> 2 (b0)
      03:52:43.667 -> state: 2 -> 3 (0)
      03:52:43.696 -> state: 3 -> 5 (10)
      03:52:43.696 -> add 0
      03:52:43.731 -> aid 10
      03:52:43.731 -> cnt 
      03:52:43.731 -> 
      03:52:43.731 -> connected with iNeo, channel 11
      03:52:43.766 -> dhcp client start...
      03:52:43.800 -> ip:192.168.0.138,mask:255.255.255.0,gw:192.168.0.1
      03:52:43.836 -> 409 TSM:INIT:GW MODE
      03:52:43.872 -> 431 TSM:READY:ID=0,PAR=0,DIS=0
      03:52:43.906 -> 463 MCO:REG:NOT NEEDED
      03:52:43.906 -> 491 TSM:READY:NWD REQ
      
      03:52:46.692 -> Soft WDT reset
      03:52:46.730 -> 
      03:52:46.730 -> >>>stack>>>
      03:52:46.730 -> 
      03:52:46.730 -> ctx: cont
      03:52:46.730 -> sp: 3ffffc50 end: 3fffffd0 offset: 01b0
      03:52:46.798 -> 3ffffe00:  001e8480 3ffe0001 3ffee76c 40202f42  
      03:52:46.832 -> 3ffffe10:  00000000 0000000e 00000000 000000ff  
      03:52:46.899 -> 3ffffe20:  00000000 00000001 00000003 00000030  
      03:52:46.939 -> 3ffffe30:  00000000 0000d6f1 0000000e 40203025  
      03:52:47.007 -> 3ffffe40:  00000000 3ffee765 00000000 402030ec  
      03:52:47.044 -> 3ffffe50:  00000007 44414552 574e3a59 45522044  
      03:52:47.078 -> 3ffffe60:  ff000a51 3fffc6fc 00000032 000000ff  
      03:52:47.147 -> 3ffffe70:  3ffe84fe 3ffee8b8 3ffee765 40203d23  
      03:52:47.182 -> 3ffffe80:  3ffe84ff 3fffff00 40232fa6 3ffeee14  
      03:52:47.257 -> 3ffffe90:  666e6f63 7463696c 3f003132 3ffeee14  
      03:52:47.288 -> 3ffffea0:  00000000 4bc6a7f0 845a1cac 00000000  
      03:52:47.358 -> 3ffffeb0:  00000000 00000000 4bc6a7f0 00000000  
      03:52:47.393 -> 3ffffec0:  00000001 3ffef22c 3ffffef0 3ffffee0  
      03:52:47.464 -> 3ffffed0:  00000004 3f407596 0000049c 4021425c  
      03:52:47.497 -> 3ffffee0:  00023851 00418937 00000000 3ffee70c  
      03:52:47.565 -> 3ffffef0:  3ffe84fe 3ffee765 000000ff 40203e6c  
      03:52:47.605 -> 3fffff00:  3ffe84fe 000001eb 3ffee7a8 40204248  
      03:52:47.641 -> 3fffff10:  00000000 3fff017c 000001f4 402037a5  
      03:52:47.710 -> 3fffff20:  00023825 000001eb 000001f4 40205111  
      03:52:47.745 -> 3fffff30:  40233e67 000001eb 000001f4 4020512f  
      03:52:47.813 -> 3fffff40:  3ffe84fe 000001eb 000001f4 40205153  
      03:52:47.850 -> 3fffff50:  00000002 3ffeea83 3ffeea83 4020518f  
      03:52:47.921 -> 3fffff60:  00000006 00000000 3ffeea83 00000001  
      03:52:47.953 -> 3fffff70:  00000000 00a7fd40 00000000 3ffee70c  
      03:52:48.039 -> 3fffff80:  3ffe84fe 3ffeea83 00000000 4020573a  
      03:52:48.060 -> 3fffff90:  40204140 0300a8c0 40208658 40208640  
      03:52:48.133 -> 3fffffa0:  3fffdad0 3ffee763 3ffeebce 402057f4  
      03:52:48.165 -> 3fffffb0:  feefeffe 00000000 3ffee668 40205858  
      03:52:48.202 -> 3fffffc0:  feefeffe feefeffe 3ffe853c 4010010d  
      03:52:48.275 -> <<<stack<<<
      

      Stack trace debug didn't give any insight, at least to a profane like me:

      x40100ba0: delayMicroseconds at C:\Users\deimo\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266\core_esp8266_wiring.c line 205
      0x40100bc9: __digitalWrite at C:\Users\deimo\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266\core_esp8266_wiring_digital.c line 82
      0x40202edb: RF24_spiMultiByteTransfer(uint8_t, uint8_t*, uint8_t, bool) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/hal/transport/RF24/driver/RF24.cpp line 100
      0x40202f42: RF24_spiMultiByteTransfer(uint8_t, uint8_t*, uint8_t, bool) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/hal/transport/RF24/driver/RF24.cpp line 120
      0x40203025: RF24_spiByteTransfer(uint8_t) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/hal/transport/RF24/driver/RF24.cpp line 125
      0x402030ec: RF24_sendMessage(uint8_t, void const*, uint8_t, bool) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/hal/transport/RF24/driver/RF24.cpp line 154
      0x40203d23: transportSendWrite(unsigned char, MyMessage&) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyTransport.cpp line 1005
      0x40203e6c: transportRouteMessage(MyMessage&) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyTransport.cpp line 586
      0x40204248: stReadyUpdate() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyTransport.cpp line 313
      0x402037a5: transportUpdateSM() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyTransport.cpp line 387
      0x40205111: transportProcess() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyTransport.cpp line 466
      0x4020512f: _process() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MySensorsCore.cpp line 78
      0x40205153: wait(unsigned int) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MySensorsCore.cpp line 533
      0x4020518f: gatewayTransportConnect() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportMQTTClient.cpp line 157
      0x4020573a: gatewayTransportInit() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportMQTTClient.cpp line 269
      0x40204140: incomingMQTT(char*, unsigned char*, unsigned int) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportMQTTClient.cpp line 123
      0x40208658: std::_Function_base::_Base_manager ::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation) at c:\users\deimo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9\xtensa-lx106-elf\include\c++\4.8.2/functional line 1934
      0x40208640: std::_Function_handler ::_M_invoke(std::_Any_data const&, char*, unsigned char*, unsigned int) at c:\users\deimo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9\xtensa-lx106-elf\include\c++\4.8.2/functional line 2069
      0x402057f4: _begin() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MySensorsCore.cpp line 165
      0x40205858: loop_wrapper() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/hal/architecture/ESP8266/MyMainESP8266.cpp line 125
      

      As you can see, I also tried implementing the preHwInit() method from here but without luck apparently.

      If I disable the radio, the whole thing works perfectly: but since I changed so many radios (and also boards and sensors) I doubt, at this point, that the problem is faulty hardware.

      I also tried powering up the radio from a different power source, with the same result.

      UPDATE:

      The problem seems to be correlated with the use of the specific sensor BME280. The way the sensor library work is causing issues with MySensors, generating the whole soft reset issue.
      Tested with all the major libraries for BME280, the behaviour is always the same. As soon as the BME is initialized to start measuring the gateway crashes/reboots.
      Confirmed that this happens only when the gateway is configured to use NRF24: ther same hardware, with the same sketch, without radio features, works perfectly over mqtt.

      UPDATE 2: Problem Solved.

      posted in Troubleshooting
      Neo Mod
      Neo Mod
    • RE: [SOLVED] MySensors and DHT22 - difficoulties in getting started

      @r-nox Thank you R-Nox! I finally figured it out, and I wrote my conclusions here. I hope it may be useful for other users. 🙂

      posted in Development
      Neo Mod
      Neo Mod
    • RE: [SOLVED] ESP8266 MQTT Gateway - Non-Stable Operation, Interrupts after 2-4 hrs

      After a long troubleshooting (and thanks to the DEBUG activation) I think I have found at least one problem: the DHCP lease renewal was interfering with correct ESP8266 operation.
      Every time the router renewed the lease the board was unable to report/reconnect correctly to the MQTT Broker.

      I have also discovered that in some occasions even though the connection between Gateway and Broker was re-established correctly, the Controller was not acknowledging data received from Broker. In that case a simple “reboot” of the controller was sufficient to establish a new connection. (with Domoticz it was a simple matter of disabling and then enabling the MySensors Hardware).

      With a DHCP Lease Time set to “Infinity” this specific problem has disappeared, but I still feel the project is quite unstable: I will continue working on it with “debug mode” and hopefully I will write an update on my findings.
      Thank you once again for the precious support!

      posted in Development
      Neo Mod
      Neo Mod

    Latest posts made by Neo Mod

    • RE: Never been able to get MySensors to work

      @iamtheghost sorry for the late reply.

      I moved to ThingsBoard which acts both as a controller (via the Rule Chain engine, a very powerfull yet very simple method to instantiate all kind of operations. For example: I'm fetching my sensors data every 5 minutes and uploading to wunderground and windy) and as a web gateway to access data with a nice UI.

      Sensors are still based on the "same old" NodeMCU board, and guess what: each variation of those boards (AMICA, Lolin, Lolin v3, etc.) now is working perfectly. I removed the radio module, since it won't be used anymore, and some of them are powered via battery shield (18650 LiPo with recharge port to be connected to a solar panel, for example).

      Here an example of one of my dashboards: you can also notice a ReedSwitch sensor and an Alarm Module that displays and Alarm each time the sensor reports "door open" and sends me an e-mail alert.
      alt text

      As for those stating that NodeMCU is a "wrong" choice: probably it is if one would like to use MySensors Library. But "per se" NodeMCU boards are extremely versatile, more than Arduino or WeMo which requires "stacking up" various modules/shields to obtain the same functionality offered by a NodeMCU in almost half the space.

      @kimot the radio module selection should be based upon the user-case scenario, at least as long as MySensors Library officially supports both NRF24 and RFM69. One case where you might want to stick with 2.4Ghz network is when your area is "heavily populated" by radio signals and interference from an airport less than 50km away in line-of-sight.

      @Tmaster I can assure you, at least in my case and I think that this has been the same for iamtheghost, I tried EVERY possible hardware variation out there. I spent months buying original components, both from resellers and producer.

      @iamtheghost said in Never been able to get MySensors to work:

      @neo-mod said in Never been able to get MySensors to work:

      @iamtheghost I'm sorry I could not post any kind of solution, but just to say "Me too!".

      Two years and half of experimentations, different platform (ESP8266 / ESP-12) but same radio and same h/w for the controller, and in the end I had your exact same results.

      Same as you, I did everything I could to figure out the problem, including spending and "insane" amount of time (and money!) in sourcing the same hardware components from different sources.

      I did change the hardware (wires, components, microSD, cables, power sources, etc. etc. ) so many times that I can't even count; that poor raspberry of mine has been flashed over and over; same goes for the ESP-module, which I have also tried in every possible "flavour" (NodeMCU, Lolin, Amica, WeMos, etc. ). And in doing so I left quite a trail of "weird and unsolved" problems here in the forum.

      In the end, just like you have discovered, I could never make it work!
      I was captivated by the idea of having a "mesh sensors network" working around my building, especially because I have wide areas not covered by WiFi and I was intrigued (to say the least) by the possibilities promised by MySensors. But as you said, "It promises all the bells and whistles for cheap home automation, but despite my every effort, I cannot even read a simple DHT11". (*)

      (to be precise, in my case it was also a BME280; I switched to those AIO sensors after failing with DHT variants)

      I did never solve the issues, and I abandoned this platform when I reached the verge of my patience having exactly the same sketch with the same hardware (really, the same sensor, the same radio, the same wires, and two identical boards) working on one board and failing on another.

      After 2 years and a half I gave up on the idea of a "mesh network" and moved to another library (still free and still available to install on a raspberry to use as a controller, and with a beautiful UI)... wish I had done it sooner. In 4 days I fixed my whole network, having a plethora of sensors constantly reporting, never hanging up for any reason (I mean, I tried removing power in 60 seconds intervals for 5 minutes and in the end they all rebooted correctly with no errors) and with the bonus feature of outputting "eye friendly" data due to the different controller.

      Hence, I perfectly understand your situation and I know how it feels: the best suggestion I can give you is to "move on" and use a different library/architecture.

      I knew I wasn't alone. I totally accept and encourage platforms that are geared towards EEs and programmers, and MySensors is definitely that. Even as a programmer by trade, it's still difficult.

      What library are you using now? I'm piqued.

      posted in OpenHAB
      Neo Mod
      Neo Mod
    • RE: Never been able to get MySensors to work

      @iamtheghost I'm sorry I could not post any kind of solution, but just to say "Me too!".

      Two years and half of experimentations, different platform (ESP8266 / ESP-12) but same radio and same h/w for the controller, and in the end I had your exact same results.

      Same as you, I did everything I could to figure out the problem, including spending and "insane" amount of time (and money!) in sourcing the same hardware components from different sources.

      I did change the hardware (wires, components, microSD, cables, power sources, etc. etc. ) so many times that I can't even count; that poor raspberry of mine has been flashed over and over; same goes for the ESP-module, which I have also tried in every possible "flavour" (NodeMCU, Lolin, Amica, WeMos, etc. ). And in doing so I left quite a trail of "weird and unsolved" problems here in the forum.

      In the end, just like you have discovered, I could never make it work!
      I was captivated by the idea of having a "mesh sensors network" working around my building, especially because I have wide areas not covered by WiFi and I was intrigued (to say the least) by the possibilities promised by MySensors. But as you said, "It promises all the bells and whistles for cheap home automation, but despite my every effort, I cannot even read a simple DHT11". (*)

      (to be precise, in my case it was also a BME280; I switched to those AIO sensors after failing with DHT variants)

      I did never solve the issues, and I abandoned this platform when I reached the verge of my patience having exactly the same sketch with the same hardware (really, the same sensor, the same radio, the same wires, and two identical boards) working on one board and failing on another.

      After 2 years and a half I gave up on the idea of a "mesh network" and moved to another library (still free and still available to install on a raspberry to use as a controller, and with a beautiful UI)... wish I had done it sooner. In 4 days I fixed my whole network, having a plethora of sensors constantly reporting, never hanging up for any reason (I mean, I tried removing power in 60 seconds intervals for 5 minutes and in the end they all rebooted correctly with no errors) and with the bonus feature of outputting "eye friendly" data due to the different controller.

      Hence, I perfectly understand your situation and I know how it feels: the best suggestion I can give you is to "move on" and use a different library/architecture.

      posted in OpenHAB
      Neo Mod
      Neo Mod
    • Node not working with existing Gateway

      I have a very simple test scenario:

      • 1 Gateway
      • 2 Nodes

      Each of them running on the same HW (NodeMCU) with the same Radio (NRFL24+) and using the same sensor (BME280).

      Gateway is running correctly with the MySensors MQTT Gateway sketch, and it's receiving messages from the 1st Node running the MySensors Passive Node sketch.

      I'm trying to insert a 2nd Node into the system: using same HW and same Sketch as the first but I keep hitting this error:

      16:22:31.136 ->  
      16:22:31.136 ->  __  __       ____
      16:22:31.136 -> |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
      16:22:31.171 -> | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
      16:22:31.171 -> | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
      16:22:31.171 -> |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
      16:22:31.171 ->         |___/                      2.3.2-beta
      16:22:31.171 -> 
      16:22:31.171 -> 105 MCO:BGN:INIT NODE,CP=RNNNE---,FQ=80,REL=4,VER=2.3.2-beta
      16:22:31.171 -> 122 TSM:INIT
      16:22:31.171 -> 123 TSF:WUR:MS=0
      16:22:31.171 -> 130 TSM:INIT:TSP OK
      16:22:31.171 -> 132 TSM:INIT:STATID=125
      16:22:31.205 -> 134 TSF:SID:OK,ID=125
      16:22:31.205 -> 136 TSM:FPAR
      16:22:31.205 -> 137 TSM:FPAR:STATP=0
      16:22:31.205 -> 139 TSM:ID
      16:22:31.205 -> 140 TSM:ID:OK
      16:22:31.205 -> 142 TSM:UPL
      16:22:33.444 -> 2395 !TSF:MSG:SEND,125-125-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
      16:22:35.443 -> 4402 TSM:UPL
      

      Can't really understand why this second node isn't working, since the HW and the sketch are identical to the first one. (of course NodeID and ChildID are different).

      On Gateway I'm reading this:

      16:42:51.662 -> 37431 TSF:MSG:PINGED,ID=2,HP=1
      16:42:51.724 -> 37496 !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1
      

      The sketch I'm using for the Node is this one:

      // Enable debug prints
      #define MY_DEBUG
      #define MY_NODE_ID 2
      #define MY_PARENT_NODE_ID 0
      #define MY_PARENT_NODE_IS_STATIC
      #define MY_RADIO_RF24
      #define MY_RF24_DATARATE RF24_1MBPS
      #define MY_RF24_PA_LEVEL RF24_PA_LOW
      #define MY_RF24_CE_PIN D3
      #include <MySensors.h>
      #include <SPI.h> 
      #include <Wire.h>
      #include "BlueDot_BME280.h"
      BlueDot_BME280 bme280 = BlueDot_BME280();
      #define LONG_WAIT 500
      #define SHORT_WAIT 150
      #define SECURE_WAIT 60000
      #define SKETCH_NAME "FloHouse Garage"
      #define SKETCH_VERSION "v5.0"
      #define TEMP_CHILD_ID 7
      #define HUM_CHILD_ID 8
      #define BARO_CHILD_ID 9
      uint32_t SLEEP_TIME = 15000; 
      bool metric = true;
      MyMessage temperatureMsg(TEMP_CHILD_ID, V_TEMP);
      MyMessage humidityMsg(HUM_CHILD_ID, V_HUM);
      MyMessage pressureMsg(BARO_CHILD_ID, V_PRESSURE);
      
      void preHwInit()
      {
      Wire.setClock(100000);
      bme280.parameter.communication = 0;
      bme280.parameter.I2CAddress = 0x76;
      bme280.parameter.sensorMode = 0b11;
      bme280.parameter.IIRfilter = 0b010;
      bme280.parameter.humidOversampling = 0b011;
      bme280.parameter.tempOversampling = 0b011;
      bme280.parameter.pressOversampling = 0b101;
      bme280.parameter.pressureSeaLevel = 1013.25; 
      bme280.parameter.tempOutsideCelsius = 15;
      bme280.init();
      }
      
      void setup()
      {
      }
      
      void presentation()
      {
      sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
      wait(LONG_WAIT);
      present(BARO_CHILD_ID, S_BARO);
      wait(SHORT_WAIT);
      present(TEMP_CHILD_ID, S_TEMP);
      wait(SHORT_WAIT);
      present(HUM_CHILD_ID, S_HUM);
      wait(SHORT_WAIT);
      }
      
      void loop()
      {
      send(temperatureMsg.set(bme280.readTempC(), 2));
      wait(SHORT_WAIT);
      send(humidityMsg.set(bme280.readHumidity(), 2));
      wait(SHORT_WAIT);
      send(pressureMsg.set(bme280.readPressure(), 2));
      wait(LONG_WAIT);
      wait(SLEEP_TIME);
      }
      

      Any help is greatly appreciated. Thank you.

      EDIT: After downgrading from Development to Master branch, I'm having a slightly different error on the Node:

      16:57:34.336 ->  __  __       ____
      16:57:34.336 -> |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
      16:57:34.382 -> | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
      16:57:34.436 -> | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
      16:57:34.483 -> |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
      16:57:34.536 ->         |___/                      2.3.1
      16:57:34.583 -> 
      16:57:34.583 -> 237 MCO:BGN:INIT NODE,CP=RNNNE---,REL=255,VER=2.3.1
      16:57:34.636 -> 424 TSM:INIT
      16:57:34.636 -> 438 TSF:WUR:MS=0
      16:57:34.683 -> 462 TSM:INIT:TSP OK
      16:57:34.683 -> 483 TSM:INIT:STATID=2
      16:57:34.736 -> 506 TSF:SID:OK,ID=2
      16:57:34.736 -> 527 TSM:FPAR
      16:57:34.783 -> 541 TSM:FPAR:STATP=0
      16:57:34.783 -> 563 TSM:ID
      16:57:34.783 -> 574 TSM:ID:OK
      16:57:34.836 -> 589 TSM:UPL
      16:57:37.094 -> 2854 !TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
      16:57:39.158 -> 4929 TSM:UPL
      16:57:39.304 -> 5064 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=1,st=OK:1
      16:57:39.358 -> 5136 TSF:MSG:READ,100-100-0,s=4,c=1,t=0,pt=7,l=5,sg=0:22.27
      16:57:39.405 -> 5199 !TSF:MSG:REL MSG,NREP
      16:57:39.521 -> 5307 TSF:MSG:READ,0-0-2,s=255,c=3,t=25,pt=1,l=1,sg=0:1
      16:57:39.605 -> 5365 TSF:MSG:PONG RECV,HP=1
      16:57:39.605 -> 5394 TSM:UPL:OK
      16:57:39.659 -> 5411 TSM:READY:ID=2,PAR=0,DIS=1
      16:57:41.919 -> 7697 !TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=NACK:0100
      
      posted in Troubleshooting
      Neo Mod
      Neo Mod
    • [SOLVED] Soft WDT Reset on MQTT ESP8266 GW with NRF24L01+

      I'm trying to replicate a gateway with the same hardware of four others that are already running, but I can't figure out why I'm hitting my head against a "SOFT WDT RESET" cycle that appears to be related to the use of NRF24L01+ radio.

      I did all the "basic" troubleshooting before writing this:

      • changed ESP8266 board (ordered 8 different models, from different producers and sellers)
      • changed NRF24L01+ module (ordered 6 items from different producers and sellers)
      • changed dupoint wires multiple times
      • changed power source (USB, Bench, Wall Charger, Battery)
      • changed library versions, both for MySensors and for BME280

      Setup is as follows:

      • Gateway with MQTT on ESP8266 Nodemcu
      • NRF24L01+
      • BME280

      This is the sketch I'm trying to use:

      #define MY_DEBUG
      #define MY_DEBUG_VERBOSE_GATEWAY
      #define MY_BAUD_RATE 9600
      #define MY_RADIO_RF24
      #define MY_RF24_DATARATE RF24_2MBPS
      #define MY_RF24_PA_LEVEL RF24_PA_HIGH
      #define MY_RF24_CE_PIN 3
      #define MY_GATEWAY_MQTT_CLIENT
      #define MY_GATEWAY_ESP8266
      #define MY_MQTT_PUBLISH_TOPIC_PREFIX "domoticz/in/fh-gateway-esterno-new"
      #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "domoticz/out/fh-gateway-esterno-new"
      #define MY_MQTT_CLIENT_ID "fh-gateway-esterno-new"
      #define MY_WIFI_SSID "iNeo"
      #define MY_WIFI_PASSWORD "password"
      #define MY_HOSTNAME "fh-gateway-esterno-new"
      #define MY_CONTROLLER_IP_ADDRESS 192, 168, 0, 3
      #define MY_PORT 1883
      #define MY_SIGNAL_REPORT_ENABLED
      #define MY_TRANSPORT_SANITY_CHECK
      #include <ESP8266WiFi.h>
      #include <MySensors.h>
      #include <SPI.h> 
      #include <Wire.h>
      #include "BlueDot_BME280.h"
      BlueDot_BME280 bme280 = BlueDot_BME280();
      #define LONG_WAIT 500
      #define SHORT_WAIT 150
      #define SECURE_WAIT 60000
      #define SKETCH_NAME "Gateway Esterno"
      #define SKETCH_VERSION "v4.0"
      #define TEMP_CHILD_ID 1
      #define HUM_CHILD_ID 2
      #define BARO_CHILD_ID 3
      uint32_t SLEEP_TIME = 15000; 
      bool metric = true;
      MyMessage temperatureMsg(TEMP_CHILD_ID, V_TEMP);
      MyMessage humidityMsg(HUM_CHILD_ID, V_HUM);
      MyMessage pressureMsg(BARO_CHILD_ID, V_PRESSURE);
      
      void preHwInit()
      {
      Wire.setClock(100000);
      bme280.parameter.communication = 0;
      bme280.parameter.I2CAddress = 0x77;
      bme280.parameter.sensorMode = 0b11;
      bme280.parameter.IIRfilter = 0b010;
      bme280.parameter.humidOversampling = 0b011;
      bme280.parameter.tempOversampling = 0b011;
      bme280.parameter.pressOversampling = 0b101;
      bme280.parameter.pressureSeaLevel = 1013.25; 
      bme280.parameter.tempOutsideCelsius = 15;
      bme280.init();
      }
      
      void setup()
      {
      }
      
      void presentation()
      {
      sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
      wait(LONG_WAIT);
      present(BARO_CHILD_ID, S_BARO);
      wait(SHORT_WAIT);
      present(TEMP_CHILD_ID, S_TEMP);
      wait(SHORT_WAIT);
      present(HUM_CHILD_ID, S_HUM);
      wait(SHORT_WAIT);
      }
      
      void loop()
      {
      send(temperatureMsg.set(bme280.readTempC(), 2));
      wait(SHORT_WAIT);
      send(humidityMsg.set(bme280.readHumidity(), 2));
      wait(SHORT_WAIT);
      send(pressureMsg.set(bme280.readPressure(), 2));
      wait(LONG_WAIT);
      wait(SLEEP_TIME);
      }
      

      This is the error I'm getting, it repeats endlessy as soon as I enable the radio:

      03:52:43.408 -> ⸮l⸮r⸮86 MCO:BGN:INIT GW,CP=RNNGE---,REL=255,VER=2.3.1
      03:52:43.558 -> 138 TSF:LRT:OK
      03:52:43.590 -> 154 TSM:INIT
      03:52:43.590 -> 167 TSF:WUR:MS=0
      03:52:43.625 -> 192 TSM:INIT:TSP OK
      03:52:43.667 -> scandone
      03:52:43.667 -> state: 0 -> 2 (b0)
      03:52:43.667 -> state: 2 -> 3 (0)
      03:52:43.696 -> state: 3 -> 5 (10)
      03:52:43.696 -> add 0
      03:52:43.731 -> aid 10
      03:52:43.731 -> cnt 
      03:52:43.731 -> 
      03:52:43.731 -> connected with iNeo, channel 11
      03:52:43.766 -> dhcp client start...
      03:52:43.800 -> ip:192.168.0.138,mask:255.255.255.0,gw:192.168.0.1
      03:52:43.836 -> 409 TSM:INIT:GW MODE
      03:52:43.872 -> 431 TSM:READY:ID=0,PAR=0,DIS=0
      03:52:43.906 -> 463 MCO:REG:NOT NEEDED
      03:52:43.906 -> 491 TSM:READY:NWD REQ
      
      03:52:46.692 -> Soft WDT reset
      03:52:46.730 -> 
      03:52:46.730 -> >>>stack>>>
      03:52:46.730 -> 
      03:52:46.730 -> ctx: cont
      03:52:46.730 -> sp: 3ffffc50 end: 3fffffd0 offset: 01b0
      03:52:46.798 -> 3ffffe00:  001e8480 3ffe0001 3ffee76c 40202f42  
      03:52:46.832 -> 3ffffe10:  00000000 0000000e 00000000 000000ff  
      03:52:46.899 -> 3ffffe20:  00000000 00000001 00000003 00000030  
      03:52:46.939 -> 3ffffe30:  00000000 0000d6f1 0000000e 40203025  
      03:52:47.007 -> 3ffffe40:  00000000 3ffee765 00000000 402030ec  
      03:52:47.044 -> 3ffffe50:  00000007 44414552 574e3a59 45522044  
      03:52:47.078 -> 3ffffe60:  ff000a51 3fffc6fc 00000032 000000ff  
      03:52:47.147 -> 3ffffe70:  3ffe84fe 3ffee8b8 3ffee765 40203d23  
      03:52:47.182 -> 3ffffe80:  3ffe84ff 3fffff00 40232fa6 3ffeee14  
      03:52:47.257 -> 3ffffe90:  666e6f63 7463696c 3f003132 3ffeee14  
      03:52:47.288 -> 3ffffea0:  00000000 4bc6a7f0 845a1cac 00000000  
      03:52:47.358 -> 3ffffeb0:  00000000 00000000 4bc6a7f0 00000000  
      03:52:47.393 -> 3ffffec0:  00000001 3ffef22c 3ffffef0 3ffffee0  
      03:52:47.464 -> 3ffffed0:  00000004 3f407596 0000049c 4021425c  
      03:52:47.497 -> 3ffffee0:  00023851 00418937 00000000 3ffee70c  
      03:52:47.565 -> 3ffffef0:  3ffe84fe 3ffee765 000000ff 40203e6c  
      03:52:47.605 -> 3fffff00:  3ffe84fe 000001eb 3ffee7a8 40204248  
      03:52:47.641 -> 3fffff10:  00000000 3fff017c 000001f4 402037a5  
      03:52:47.710 -> 3fffff20:  00023825 000001eb 000001f4 40205111  
      03:52:47.745 -> 3fffff30:  40233e67 000001eb 000001f4 4020512f  
      03:52:47.813 -> 3fffff40:  3ffe84fe 000001eb 000001f4 40205153  
      03:52:47.850 -> 3fffff50:  00000002 3ffeea83 3ffeea83 4020518f  
      03:52:47.921 -> 3fffff60:  00000006 00000000 3ffeea83 00000001  
      03:52:47.953 -> 3fffff70:  00000000 00a7fd40 00000000 3ffee70c  
      03:52:48.039 -> 3fffff80:  3ffe84fe 3ffeea83 00000000 4020573a  
      03:52:48.060 -> 3fffff90:  40204140 0300a8c0 40208658 40208640  
      03:52:48.133 -> 3fffffa0:  3fffdad0 3ffee763 3ffeebce 402057f4  
      03:52:48.165 -> 3fffffb0:  feefeffe 00000000 3ffee668 40205858  
      03:52:48.202 -> 3fffffc0:  feefeffe feefeffe 3ffe853c 4010010d  
      03:52:48.275 -> <<<stack<<<
      

      Stack trace debug didn't give any insight, at least to a profane like me:

      x40100ba0: delayMicroseconds at C:\Users\deimo\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266\core_esp8266_wiring.c line 205
      0x40100bc9: __digitalWrite at C:\Users\deimo\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266\core_esp8266_wiring_digital.c line 82
      0x40202edb: RF24_spiMultiByteTransfer(uint8_t, uint8_t*, uint8_t, bool) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/hal/transport/RF24/driver/RF24.cpp line 100
      0x40202f42: RF24_spiMultiByteTransfer(uint8_t, uint8_t*, uint8_t, bool) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/hal/transport/RF24/driver/RF24.cpp line 120
      0x40203025: RF24_spiByteTransfer(uint8_t) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/hal/transport/RF24/driver/RF24.cpp line 125
      0x402030ec: RF24_sendMessage(uint8_t, void const*, uint8_t, bool) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/hal/transport/RF24/driver/RF24.cpp line 154
      0x40203d23: transportSendWrite(unsigned char, MyMessage&) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyTransport.cpp line 1005
      0x40203e6c: transportRouteMessage(MyMessage&) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyTransport.cpp line 586
      0x40204248: stReadyUpdate() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyTransport.cpp line 313
      0x402037a5: transportUpdateSM() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyTransport.cpp line 387
      0x40205111: transportProcess() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyTransport.cpp line 466
      0x4020512f: _process() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MySensorsCore.cpp line 78
      0x40205153: wait(unsigned int) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MySensorsCore.cpp line 533
      0x4020518f: gatewayTransportConnect() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportMQTTClient.cpp line 157
      0x4020573a: gatewayTransportInit() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportMQTTClient.cpp line 269
      0x40204140: incomingMQTT(char*, unsigned char*, unsigned int) at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportMQTTClient.cpp line 123
      0x40208658: std::_Function_base::_Base_manager ::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation) at c:\users\deimo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9\xtensa-lx106-elf\include\c++\4.8.2/functional line 1934
      0x40208640: std::_Function_handler ::_M_invoke(std::_Any_data const&, char*, unsigned char*, unsigned int) at c:\users\deimo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9\xtensa-lx106-elf\include\c++\4.8.2/functional line 2069
      0x402057f4: _begin() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/core/MySensorsCore.cpp line 165
      0x40205858: loop_wrapper() at C:\Users\deimo\Documents\Arduino\libraries\MySensors/hal/architecture/ESP8266/MyMainESP8266.cpp line 125
      

      As you can see, I also tried implementing the preHwInit() method from here but without luck apparently.

      If I disable the radio, the whole thing works perfectly: but since I changed so many radios (and also boards and sensors) I doubt, at this point, that the problem is faulty hardware.

      I also tried powering up the radio from a different power source, with the same result.

      UPDATE:

      The problem seems to be correlated with the use of the specific sensor BME280. The way the sensor library work is causing issues with MySensors, generating the whole soft reset issue.
      Tested with all the major libraries for BME280, the behaviour is always the same. As soon as the BME is initialized to start measuring the gateway crashes/reboots.
      Confirmed that this happens only when the gateway is configured to use NRF24: ther same hardware, with the same sketch, without radio features, works perfectly over mqtt.

      UPDATE 2: Problem Solved.

      posted in Troubleshooting
      Neo Mod
      Neo Mod
    • RE: [SOLVED] ESP8266 MQTT Gateway - Non-Stable Operation, Interrupts after 2-4 hrs

      After a long troubleshooting (and thanks to the DEBUG activation) I think I have found at least one problem: the DHCP lease renewal was interfering with correct ESP8266 operation.
      Every time the router renewed the lease the board was unable to report/reconnect correctly to the MQTT Broker.

      I have also discovered that in some occasions even though the connection between Gateway and Broker was re-established correctly, the Controller was not acknowledging data received from Broker. In that case a simple “reboot” of the controller was sufficient to establish a new connection. (with Domoticz it was a simple matter of disabling and then enabling the MySensors Hardware).

      With a DHCP Lease Time set to “Infinity” this specific problem has disappeared, but I still feel the project is quite unstable: I will continue working on it with “debug mode” and hopefully I will write an update on my findings.
      Thank you once again for the precious support!

      posted in Development
      Neo Mod
      Neo Mod
    • RE: [SOLVED] ESP8266 MQTT Gateway - Non-Stable Operation, Interrupts after 2-4 hrs

      Sorry for the delay, here I am with the "freeze" LOG.

      I have realized that before losing the sensor data there is a middle step: I can see an anomalous message in MQTT, as the two posted below.

      The message value seems to be random, but each time this happens even though the Broker is receiving updates, the controller will mark the sensor as “unresponsive”.

      I am using Domoticz as Controller, and I noticed that when this message appears I am losing the “aggregated data” from the sensor – which appears in My Devices as a “Temp+Humidity WTGR8000” – but I am still able to receive data from the same sensor under two different Devices – a “Temp La Crosse TX3” and a “Humidity LaCrosse TX3”.

      2018-08-11 17:03:26.468 (fh2-esterno) Humidity (Hum)
      2018-08-11 17:03:35.476 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/255/3/0/22, Message: 144446
      2018-08-11 17:03:35.576 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 30.00
      2018-08-11 17:03:35.578 (fh2-esterno) Temp (Temp)
      2018-08-11 17:03:35.676 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 56.70
      2018-08-11 17:03:35.678 (fh2-esterno) Humidity (Hum)
      2018-08-11 17:03:44.422 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 30.00
      2018-08-11 17:03:44.424 (fh2-esterno) Temp (Temp)
      2018-08-11 17:03:44.522 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 56.60
      2018-08-11 17:03:44.524 (fh2-esterno) Humidity (Hum)
      

      And after a RESET the "random value" changed:

      2018-08-11 17:04:47.574 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/255/3/0/22, Message: 216634
      2018-08-11 17:04:47.675 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 30.00
      2018-08-11 17:04:47.677 (fh2-esterno) Temp (Temp)
      2018-08-11 17:04:47.775 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 56.80
      2018-08-11 17:04:47.777 (fh2-esterno) Humidity (Hum)
      2018-08-11 17:04:56.610 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 30.00
      2018-08-11 17:04:56.612 (fh2-esterno) Temp (Temp)
      2018-08-11 17:04:56.711 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 56.50
      2018-08-11 17:04:56.713 (fh2-esterno) Humidity (Hum)
      2018-08-11 17:05:05.719 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 30.00
      2018-08-11 17:05:05.721 (fh2-esterno) Temp (Temp)
      2018-08-11 17:05:05.820 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 56.50
      2018-08-11 17:05:05.822 (fh2-esterno) Humidity (Hum)
      
      

      And this is the reference to better understand the "separated" devices issue I have noticed with my Controller.
      alt text

      posted in Development
      Neo Mod
      Neo Mod
    • RE: [SOLVED] ESP8266 MQTT Gateway - Non-Stable Operation, Interrupts after 2-4 hrs

      Hi,

      Thank you very much for your help.

      I have just resetted again the sensor, trying to figure out what is the problem (I've changed the MQTT Topic just for this test).

      This one is the MQTT Subscription:

      2018-08-10 15:04:37.862 Status: MQTT: Connecting to 192.168.1.39:1883
      2018-08-10 15:04:37.963 Status: MQTT: connected to: 192.168.1.39:1883
      2018-08-10 15:04:37.963 Status: MySensorsMQTT: connected to: 192.168.1.39:1883
      2018-08-10 15:04:38.063 Status: MQTT: Subscribed
      2018-08-10 15:04:44.821 Status: MQTT: Worker stopped.
      
      

      This is the MQTT actually working and receiving updates:

      2018-08-10 15:08:59.432 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 29.00
      2018-08-10 15:08:59.436 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:08:59.532 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 57.60
      2018-08-10 15:08:59.536 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:08.283 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 29.00
      2018-08-10 15:09:08.287 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:08.383 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 56.80
      2018-08-10 15:09:08.387 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:17.392 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 28.90
      2018-08-10 15:09:17.397 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:17.493 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 57.70
      2018-08-10 15:09:17.497 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:26.326 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 28.90
      2018-08-10 15:09:26.329 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:26.426 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 58.00
      2018-08-10 15:09:26.429 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:35.436 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 28.80
      2018-08-10 15:09:35.440 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:35.536 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 57.90
      2018-08-10 15:09:35.541 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:44.364 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 28.80
      2018-08-10 15:09:44.369 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:44.465 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 57.90
      2018-08-10 15:09:44.469 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:53.474 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 28.80
      2018-08-10 15:09:53.479 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:09:53.575 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 58.00
      2018-08-10 15:09:53.580 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:10:02.408 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/12/1/0/0, Message: 28.80
      2018-08-10 15:10:02.412 (fh2-esterno) Temp + Humidity (Esterno)
      2018-08-10 15:10:02.508 MySensorsMQTT: Topic: domoticz/in/fh2-esterno/0/11/1/0/1, Message: 58.00
      2018-08-10 15:10:02.513 (fh2-esterno) Temp + Humidity (Esterno)
      
      

      As soon as I got the "freeze" I'll post the LOG.

      posted in Development
      Neo Mod
      Neo Mod
    • [SOLVED] ESP8266 MQTT Gateway - Non-Stable Operation, Interrupts after 2-4 hrs

      I’m still struggling with my ESP8266 (NodeMCU), and I really hope someone could have a precious insight.

      After many attempts I managed to obtain a working MQTT Gateway: the configuration is really simple, I have one BME280 connected and I’m sending its reading over to the MQTT Broker installed on a Raspberry Pi 3.

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik Ekblad
       *
       * DESCRIPTION
       * The ESP8266 MQTT gateway sends radio network (or locally attached sensors) data to your MQTT broker.
       * The node also listens to MY_MQTT_TOPIC_PREFIX and sends out those messages to the radio network
       *
       * LED purposes:
       * - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs in your sketch
       * - RX (green) - blink fast on radio message received. In inclusion mode will blink fast only on presentation received
       * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
       * - ERR (red) - fast blink on error during transmission error or receive crc error
       *
       * See https://www.mysensors.org/build/connect_radio for wiring instructions.
       *
       * If you are using a "barebone" ESP8266, see
       * https://www.mysensors.org/build/esp8266_gateway#wiring-for-barebone-esp8266
       *
       * Inclusion mode button:
       * - Connect GPIO5 (=D1) via switch to GND ('inclusion switch')
       *
       * Hardware SHA204 signing is currently not supported!
       *
       * Make sure to fill in your ssid and WiFi password below for ssid & pass.
       */
      
      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
      #define MY_BAUD_RATE 115200
      
      #define MY_GATEWAY_MQTT_CLIENT
      #define MY_GATEWAY_ESP8266
      
      // Set this node's subscribe and publish topic prefix
      #define MY_MQTT_PUBLISH_TOPIC_PREFIX "domoticz/in/fh1-interno"
      #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "domoticz/out/fh1-interno"
      
      // Set MQTT client id
      #define MY_MQTT_CLIENT_ID "INTERNO-FH1"
      
      // Set WIFI SSID and password
      #define MY_WIFI_SSID "MYSSID"
      #define MY_WIFI_PASSWORD "MYPASS"
      
      // Set the hostname for the WiFi Client. This is the hostname
      // it will pass to the DHCP server if not static.
       #define MY_HOSTNAME "INTERNO-FH1"
      
      // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
      #define MY_IP_ADDRESS 192,168,1,55
      
      // If using static ip you can define Gateway and Subnet address as well
      #define MY_IP_GATEWAY_ADDRESS 192,168,1,1
      #define MY_IP_SUBNET_ADDRESS 255,255,255,0
      
      // MQTT broker ip address.
      #define MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 39
      
      //MQTT broker if using URL instead of ip address.
      // #define MY_CONTROLLER_URL_ADDRESS ".mosquitto.org"
      
      // The MQTT broker port to to open
      #define MY_PORT 1883
      
      #define MY_NODE_ID 11
      
      #include <ESP8266WiFi.h>
      #include <MySensors.h>
      #include <SPI.h>
      #include <Wire.h>
      #include <BME280_MOD-1022.h>
      
      #define BARO_CHILD 13
      #define TEMP_CHILD 14
      #define HUM_CHILD 15
      
      const float ALTITUDE = 124; // <-- adapt this value to your location's altitude (in m). Use your smartphone GPS to get an accurate value!
      
      //const unsigned long SLEEP_TIME = 6e+7; 
      
      const char *weather[] = { "stable", "sunny", "cloudy", "unstable", "thunderstorm", "unknown" };
      enum FORECAST
      {
        STABLE = 0,     // "Stable Weather Pattern"
        SUNNY = 1,      // "Slowly rising Good Weather", "Clear/Sunny "
        CLOUDY = 2,     // "Slowly falling L-Pressure ", "Cloudy/Rain "
        UNSTABLE = 3,   // "Quickly rising H-Press",     "Not Stable"
        THUNDERSTORM = 4, // "Quickly falling L-Press",    "Thunderstorm"
        UNKNOWN = 5     // "Unknown (More Time needed)
      };
      
      float lastPressure = -1;
      float lastTemp = -1;
      float lastHum = -1;
      int lastForecast = -1;
      
      const int LAST_SAMPLES_COUNT = 5;
      float lastPressureSamples[LAST_SAMPLES_COUNT];
      
      
      // this CONVERSION_FACTOR is used to convert from Pa to kPa in the forecast algorithm
      // get kPa/h by dividing hPa by 10 
      #define CONVERSION_FACTOR (1.0/10.0)
      
      int minuteCount = 0;
      bool firstRound = true;
      // average value is used in forecast algorithm.
      float pressureAvg;
      // average after 2 hours is used as reference value for the next iteration.
      float pressureAvg2;
      
      float dP_dt;
      boolean metric;
      MyMessage tempMsg(TEMP_CHILD, V_TEMP);
      MyMessage humMsg(HUM_CHILD, V_HUM);
      MyMessage pressureMsg(BARO_CHILD, V_PRESSURE);
      MyMessage forecastMsg(BARO_CHILD, V_FORECAST);
      
      
      float getLastPressureSamplesAverage()
      {
        float lastPressureSamplesAverage = 0;
        for (int i = 0; i < LAST_SAMPLES_COUNT; i++)
        {
          lastPressureSamplesAverage += lastPressureSamples[i];
        }
        lastPressureSamplesAverage /= LAST_SAMPLES_COUNT;
      
        return lastPressureSamplesAverage;
      }
      
      
      // Algorithm found here
      // http://www.freescale.com/files/sensors/doc/app_note/AN3914.pdf
      // Pressure in hPa -->  forecast done by calculating kPa/h
      int sample(float pressure)
      {
        // Calculate the average of the last n minutes.
        int index = minuteCount % LAST_SAMPLES_COUNT;
        lastPressureSamples[index] = pressure;
      
        minuteCount++;
        if (minuteCount > 185)
        {
          minuteCount = 6;
        }
      
        if (minuteCount == 5)
        {
          pressureAvg = getLastPressureSamplesAverage();
        }
        else if (minuteCount == 35)
        {
          float lastPressureAvg = getLastPressureSamplesAverage();
          float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
          if (firstRound) // first time initial 3 hour
          {
            dP_dt = change * 2; // note this is for t = 0.5hour
          }
          else
          {
            dP_dt = change / 1.5; // divide by 1.5 as this is the difference in time from 0 value.
          }
        }
        else if (minuteCount == 65)
        {
          float lastPressureAvg = getLastPressureSamplesAverage();
          float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
          if (firstRound) //first time initial 3 hour
          {
            dP_dt = change; //note this is for t = 1 hour
          }
          else
          {
            dP_dt = change / 2; //divide by 2 as this is the difference in time from 0 value
          }
        }
        else if (minuteCount == 95)
        {
          float lastPressureAvg = getLastPressureSamplesAverage();
          float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
          if (firstRound) // first time initial 3 hour
          {
            dP_dt = change / 1.5; // note this is for t = 1.5 hour
          }
          else
          {
            dP_dt = change / 2.5; // divide by 2.5 as this is the difference in time from 0 value
          }
        }
        else if (minuteCount == 125)
        {
          float lastPressureAvg = getLastPressureSamplesAverage();
          pressureAvg2 = lastPressureAvg; // store for later use.
          float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
          if (firstRound) // first time initial 3 hour
          {
            dP_dt = change / 2; // note this is for t = 2 hour
          }
          else
          {
            dP_dt = change / 3; // divide by 3 as this is the difference in time from 0 value
          }
        }
        else if (minuteCount == 155)
        {
          float lastPressureAvg = getLastPressureSamplesAverage();
          float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
          if (firstRound) // first time initial 3 hour
          {
            dP_dt = change / 2.5; // note this is for t = 2.5 hour
          }
          else
          {
            dP_dt = change / 3.5; // divide by 3.5 as this is the difference in time from 0 value
          }
        }
        else if (minuteCount == 185)
        {
          float lastPressureAvg = getLastPressureSamplesAverage();
          float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
          if (firstRound) // first time initial 3 hour
          {
            dP_dt = change / 3; // note this is for t = 3 hour
          }
          else
          {
            dP_dt = change / 4; // divide by 4 as this is the difference in time from 0 value
          }
          pressureAvg = pressureAvg2; // Equating the pressure at 0 to the pressure at 2 hour after 3 hours have past.
          firstRound = false; // flag to let you know that this is on the past 3 hour mark. Initialized to 0 outside main loop.
        }
      
        int forecast = UNKNOWN;
        if (minuteCount < 35 && firstRound) //if time is less than 35 min on the first 3 hour interval.
        {
          forecast = UNKNOWN;
        }
        else if (dP_dt < (-0.25))
        {
          forecast = THUNDERSTORM;
        }
        else if (dP_dt > 0.25)
        {
          forecast = UNSTABLE;
        }
        else if ((dP_dt > (-0.25)) && (dP_dt < (-0.05)))
        {
          forecast = CLOUDY;
        }
        else if ((dP_dt > 0.05) && (dP_dt < 0.25))
        {
          forecast = SUNNY;
        }
        else if ((dP_dt >(-0.05)) && (dP_dt < 0.05))
        {
          forecast = STABLE;
        }
        else
        {
          forecast = UNKNOWN;
        }
      
        return forecast;
      }
      
      
      void setup() {
        metric = getControllerConfig().isMetric;  // was getConfig().isMetric; before MySensors v2.1.1
        Wire.begin(0x76); // Wire.begin(sda, scl)
      }
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("BME280 Sensor", "1.6");
      
        // Register sensors to gw (they will be created as child devices)
        present(BARO_CHILD, S_BARO);
        present(TEMP_CHILD, S_TEMP);
        present(HUM_CHILD, S_HUM);
      }
      
      // Loop
      void loop() {
        
        // need to read the NVM compensation parameters
        BME280.readCompensationParams();
      
        /*
        // After taking the measurement the chip goes back to sleep, use when battery powered.
        // Oversampling settings (os1x, os2x, os4x, os8x or os16x).
        BME280.writeFilterCoefficient(fc_16);       // IIR Filter coefficient, higher numbers avoid sudden changes to be accounted for (such as slamming a door)
        BME280.writeOversamplingPressure(os16x);    // pressure x16
        BME280.writeOversamplingTemperature(os8x);  // temperature x8
        BME280.writeOversamplingHumidity(os8x);     // humidity x8
      
        BME280.writeMode(smForced);                 // Forced sample.  After taking the measurement the chip goes back to sleep
        
      */
        // Normal mode for regular automatic samples
        BME280.writeStandbyTime(tsb_0p5ms);         // tsb = 0.5ms
        BME280.writeFilterCoefficient(fc_16);       // IIR Filter coefficient 16
        BME280.writeOversamplingPressure(os16x);    // pressure x16
        BME280.writeOversamplingTemperature(os8x);  // temperature x8
        BME280.writeOversamplingHumidity(os8x);     // humidity x8
        BME280.writeMode(smNormal);
        
        while (1) {
          // Just to be sure, wait until sensor is done mesuring  
          while (BME280.isMeasuring()) {
        }
        
        // Read out the data - must do this before calling the getxxxxx routines
        BME280.readMeasurements();
      
        float temperature = BME280.getTemperatureMostAccurate();                    // must get temp first
        float humidity = BME280.getHumidityMostAccurate();
        float pressure_local = BME280.getPressureMostAccurate();                    // Get pressure at current location
        float pressure = pressure_local/pow((1.0 - ( ALTITUDE / 44330.0 )), 5.255); // Adjust to sea level pressure using user altitude
        int forecast = sample(pressure);
        
        if (!metric) 
        {
          // Convert to fahrenheit
          temperature = temperature * 9.0 / 5.0 + 32.0;
        }
        send(tempMsg.set(temperature, 2));
        send(pressureMsg.set(pressure, 3));
        send(humMsg.set(humidity, 2));
        send(forecastMsg.set(weather[forecast]));
        delay(5000);
        
      }
      }
      

      The whole thing works flawlessy for a couple of hours, then the MQTT Broker stops receiving messages: from the Serial Monitor I can see readings from the attached sensor but it seems that the Gateway is not reporting them to the MQQT Broker.

      Altough, according to serial, the message is being sent to the MQTT Broker.
      I’m using MOSQUITTO as a Broker, which in my experience has proven to be quite reliable, and I can’t imagine where could be the problem.

      I tried every combination of Sleep(), Delay(), and even ESP.DeepSleep in the sketch ( but nothing changed ).
      (I know, I know, DeepSleep is not supposed to be active on a GW. It was just a test)

      posted in Development
      Neo Mod
      Neo Mod
    • RE: [SOLVED] MySensors and DHT22 - difficoulties in getting started

      @mfalkvidd thank you so much for your insights.

      I'm using a NRF24L01+PA+LNA and with BME280 I had an overlapping pin ( I followed the "How to connect the radio" official page). I'll open a new thread asking for advice, quite clearly I'm missing something.

      I will try the PIN Definition you mentioned in the next node, thank you! That will be a huge benefit.

      posted in Development
      Neo Mod
      Neo Mod
    • RE: [SOLVED] MySensors and DHT22 - difficoulties in getting started

      @r-nox Thank you R-Nox! I finally figured it out, and I wrote my conclusions here. I hope it may be useful for other users. 🙂

      posted in Development
      Neo Mod
      Neo Mod