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. Soft WDT reset on ESP8266 RFM69 gateway after find parent

Soft WDT reset on ESP8266 RFM69 gateway after find parent

Scheduled Pinned Locked Moved Troubleshooting
21 Posts 3 Posters 2.4k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • gohanG Offline
    gohanG Offline
    gohan
    Mod
    wrote on last edited by
    #2

    Try changing the board definition for esp8266 and see if you see any change

    1 Reply Last reply
    0
    • mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #3

      I think I found the problem.

      On the gateway, I had this receive function:

      void receive(const MyMessage &message)
      {
        rssi = _radio.RSSI;
        if (message.sender == 1) {
          send(msgRssi1.set(rssi, 0));
        }
      }
      

      I think this caused the received message to be corrupted. I changed the code to do the send() from loop instead. Testing now, and it seems to work so far.

      1 Reply Last reply
      1
      • mfalkviddM Offline
        mfalkviddM Offline
        mfalkvidd
        Mod
        wrote on last edited by
        #4

        btw, this is the graph I have gotten from RSSI for the last 8 months.
        0_1526635657702_rssi.png

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

          Isn't it better to log the rssi from the nodes? I mean that the gw is sending its rssi every time it receives something, right? So you could have different rssi values for each node.

          mfalkviddM 1 Reply Last reply
          0
          • mfalkviddM mfalkvidd

            btw, this is the graph I have gotten from RSSI for the last 8 months.
            0_1526635657702_rssi.png

            YveauxY Offline
            YveauxY Offline
            Yveaux
            Mod
            wrote on last edited by
            #6

            @mfalkvidd said in Soft WDT reset on ESP8266 RFM69 gateway after find parent:

            the graph I have gotten from RSSI

            It looks like a 'Sound Level' chart, judging from the title...

            http://yveaux.blogspot.nl

            mfalkviddM 1 Reply Last reply
            0
            • gohanG gohan

              Isn't it better to log the rssi from the nodes? I mean that the gw is sending its rssi every time it receives something, right? So you could have different rssi values for each node.

              mfalkviddM Offline
              mfalkviddM Offline
              mfalkvidd
              Mod
              wrote on last edited by
              #7

              @gohan logging the rssi value on the node would mean additional radio traffic, and I am more interested in how well the node reaches the gateway than how well the gateway reaches the node anyway.

              gohanG 1 Reply Last reply
              0
              • YveauxY Yveaux

                @mfalkvidd said in Soft WDT reset on ESP8266 RFM69 gateway after find parent:

                the graph I have gotten from RSSI

                It looks like a 'Sound Level' chart, judging from the title...

                mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote on last edited by
                #8

                @yveaux yes. Sound is the most appropriate message type I could find that Domoticz supports.

                1 Reply Last reply
                1
                • mfalkviddM mfalkvidd

                  @gohan logging the rssi value on the node would mean additional radio traffic, and I am more interested in how well the node reaches the gateway than how well the gateway reaches the node anyway.

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

                  @mfalkvidd but how do you know which node rssi is which? You are getting an average of mixed values since domoticz is recording one value every 5 minutes

                  mfalkviddM 1 Reply Last reply
                  0
                  • gohanG gohan

                    @mfalkvidd but how do you know which node rssi is which? You are getting an average of mixed values since domoticz is recording one value every 5 minutes

                    mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by
                    #10

                    @gohan

                    if (message.sender == 1)
                    
                    1 Reply Last reply
                    0
                    • gohanG Offline
                      gohanG Offline
                      gohan
                      Mod
                      wrote on last edited by
                      #11

                      so you are measuring just one node?

                      mfalkviddM 1 Reply Last reply
                      0
                      • gohanG gohan

                        so you are measuring just one node?

                        mfalkviddM Offline
                        mfalkviddM Offline
                        mfalkvidd
                        Mod
                        wrote on last edited by
                        #12

                        @gohan yes. If I create one more node I'll probably let the gateway present two rssi children.

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

                          I just report node TX power every now and then to get an idea of the signal strength and background rssi noise to figure out if there are interference around the node

                          1 Reply Last reply
                          0
                          • mfalkviddM Offline
                            mfalkviddM Offline
                            mfalkvidd
                            Mod
                            wrote on last edited by mfalkvidd
                            #14

                            Since my node had been reporting without problems for several days, I disconnected the gateway from my computer and plugged it in to a phone charger instead. The gateway came up as it should and Domoticz reconnected but I am no longer getting any messages from the node. Reset the node but that didn't help. Back to troubleshooting.

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

                              Chinese phone charger? :D

                              mfalkviddM 1 Reply Last reply
                              0
                              • gohanG gohan

                                Chinese phone charger? :D

                                mfalkviddM Offline
                                mfalkviddM Offline
                                mfalkvidd
                                Mod
                                wrote on last edited by
                                #16

                                @gohan no. I don't want to die.

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

                                  Have you tried adding a ceramic cap on the Vin or 3.3v pins ?

                                  mfalkviddM 1 Reply Last reply
                                  0
                                  • gohanG gohan

                                    Have you tried adding a ceramic cap on the Vin or 3.3v pins ?

                                    mfalkviddM Offline
                                    mfalkviddM Offline
                                    mfalkvidd
                                    Mod
                                    wrote on last edited by mfalkvidd
                                    #18

                                    @gohan no. I haven't needed one on my nrf24 nodes and I thought the rfm was less sensitive to noise. Isn't it?

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

                                      Well... kind of. Noise on power rail could also cause other problems too. I suggested the ceramic as it helps filtering the high frequencies in case your phone charger voltage is not very clean

                                      1 Reply Last reply
                                      0
                                      • mfalkviddM Offline
                                        mfalkviddM Offline
                                        mfalkvidd
                                        Mod
                                        wrote on last edited by
                                        #20

                                        Alright. I'll add a ceramic capacitor.

                                        For compleeness, here is my complete sketch for the node:

                                        // Enable debug prints
                                        #define MY_DEBUG
                                        #define MY_NODE_ID 1
                                        
                                        // Enable and select radio type attached
                                        #define MY_RADIO_RFM69
                                        #define MY_IS_RFM69HW
                                        #define MY_RFM69_FREQUENCY RFM69_433MHZ // RFM69_433MHZ for development branch, RF69_433MHZ for master
                                        #define MY_RF69_IRQ_PIN 2
                                        #define MY_RF69_SPI_CS 10
                                        
                                        #include <MySensors.h> // From Library Manager
                                        
                                        #include <BME280I2C.h> // From Library Manager
                                        BME280I2C bme;
                                        
                                        static const uint64_t UPDATE_INTERVAL = 300000;
                                        
                                        #define CHILD_ID_HUM 0
                                        #define CHILD_ID_TEMP 1
                                        #define CHILD_ID_VCC_BEFORE 2
                                        #define CHILD_ID_VCC_AFTER 3
                                        
                                        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);
                                        //TODO: Add pressure from BME280?
                                        //TODO: Add light detection (irq-based, LDR)
                                        //TODO: Add flooding detection
                                        
                                        void presentation()
                                        {
                                          // Send the sketch version information to the gateway
                                          sendSketchInfo("StorageRoom", "1.1");
                                        
                                          present(CHILD_ID_HUM, S_HUM);
                                          wait(100);
                                          present(CHILD_ID_TEMP, S_TEMP);
                                          wait(100);
                                          present(CHILD_ID_VCC_BEFORE, S_CUSTOM);
                                          wait(100);
                                          present(CHILD_ID_VCC_AFTER, S_CUSTOM);
                                        }
                                        
                                        void setup()
                                        {
                                          if (! bme.begin()) {
                                            Serial.println("Could not find a valid BME280 sensor, check wiring! Continuing without sensor...");
                                          }
                                        }
                                        
                                        
                                        void loop()
                                        {
                                          static float lastTemp;
                                          static float lastHum;
                                          send(msgVccBefore.set(readVcc() / 1000.0, 3));
                                          float temperature = bme.temp();
                                          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.hum();
                                          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
                                        
                                          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
                                        }
                                        

                                        and for the gateway:

                                        // Based on https://github.com/mysensors/MySensors/tree/master/examples/GatewayESP8266OTA
                                        
                                        #include <ArduinoOTA.h>
                                        
                                        // Enable debug prints to serial monitor
                                        #define MY_DEBUG
                                        #define MY_BAUD_RATE 74880 // To be able to see reset messages
                                        
                                        #define WIFI_REPORT_INTERVAL 300000
                                        
                                        // Enables and select radio type (if attached)
                                        #define MY_RADIO_RFM69
                                        #define MY_IS_RFM69HW
                                        #define MY_RF69_IRQ_PIN D2
                                        #define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
                                        #define MY_RF69_SPI_CS D8
                                        #define MY_RFM69_FREQUENCY RFM69_433MHZ // RFM69_433MHZ for development branch, RF69_433MHZ for master
                                        
                                        #define MY_GATEWAY_ESP8266
                                        
                                        #define MY_WIFI_SSID "Mr-IoT.com"
                                        #include "settings.h"
                                        
                                        // Set the hostname for the WiFi Client. This is the hostname
                                        // it will pass to the DHCP server if not static.
                                        #define MY_HOSTNAME "RFM69-Gateway"
                                        
                                        // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
                                        //#define MY_IP_ADDRESS 192,168,178,87
                                        
                                        // If using static ip you can define Gateway and Subnet address as well
                                        //#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
                                        //#define MY_IP_SUBNET_ADDRESS 255,255,255,0
                                        
                                        // The port to keep open on node server mode
                                        #define MY_PORT 5003
                                        
                                        // How many clients should be able to connect to this gateway (default 1)
                                        #define MY_GATEWAY_MAX_CLIENTS 2
                                        
                                        // Controller ip address. Enables client mode (default is "server" mode).
                                        // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
                                        //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68
                                        
                                        #if defined(MY_USE_UDP)
                                        #include <WiFiUDP.h>
                                        #else
                                        #include <ESP8266WiFi.h>
                                        #endif
                                        
                                        #include <MySensors.h>
                                        #define CHILD_ID_WIFI_RSSI 0
                                        MyMessage msgWifiRssi(CHILD_ID_WIFI_RSSI, V_LEVEL);
                                        #define CHILD_ID_RSSI1 1
                                        MyMessage msgRssi1(CHILD_ID_RSSI1, V_LEVEL);
                                        bool sendRssi = false;
                                        int16_t rssi;
                                        
                                        void setup()
                                        {
                                          // Setup locally attached sensors
                                          ArduinoOTA.onStart([]() {
                                            DEBUG_OUTPUT("ArduinoOTA start\n");
                                          });
                                          ArduinoOTA.onEnd([]() {
                                            DEBUG_OUTPUT("\nArduinoOTA end\n");
                                          });
                                          ArduinoOTA.setPassword((const char *)OTA_PASSWORD);
                                          ArduinoOTA.setHostname(MY_HOSTNAME);
                                          ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
                                            DEBUG_OUTPUT("OTA Progress: %u%%\r", (progress / (total / 100)));
                                          });
                                          ArduinoOTA.onError([](ota_error_t error) {
                                            DEBUG_OUTPUT("Error[%u]: ", error);
                                            if (error == OTA_AUTH_ERROR) {
                                              DEBUG_OUTPUT("Auth Failed\n");
                                            } else if (error == OTA_BEGIN_ERROR) {
                                              DEBUG_OUTPUT("Begin Failed\n");
                                            } else if (error == OTA_CONNECT_ERROR) {
                                              DEBUG_OUTPUT("Connect Failed\n");
                                            } else if (error == OTA_RECEIVE_ERROR) {
                                              DEBUG_OUTPUT("Receive Failed\n");
                                            } else if (error == OTA_END_ERROR) {
                                              DEBUG_OUTPUT("End Failed\n");
                                            }
                                          });
                                          ArduinoOTA.begin();
                                        }
                                        
                                        void presentation()
                                        {
                                          // Present locally attached sensors here
                                          present(CHILD_ID_WIFI_RSSI, S_SOUND);
                                          wait(100);
                                          present(CHILD_ID_RSSI1, S_SOUND);
                                        }
                                        
                                        long lastSend = 0;
                                        void loop()
                                        {
                                          // Send locally attech sensors data here
                                          ArduinoOTA.handle();
                                          if (millis() - lastSend > WIFI_REPORT_INTERVAL) {
                                            send(msgWifiRssi.set(WiFi.RSSI(), 1));
                                            lastSend = millis();
                                          }
                                          if (sendRssi) {
                                            sendRssi = false;
                                            send(msgRssi1.set(rssi, 0));
                                          }
                                        }
                                        
                                        void receive(const MyMessage &message)
                                        {
                                          rssi = _radio.RSSI;
                                          if (message.sender == 1) {
                                            sendRssi = true;
                                          }
                                        }
                                        
                                        
                                        mfalkviddM 1 Reply Last reply
                                        0
                                        • mfalkviddM mfalkvidd

                                          Alright. I'll add a ceramic capacitor.

                                          For compleeness, here is my complete sketch for the node:

                                          // Enable debug prints
                                          #define MY_DEBUG
                                          #define MY_NODE_ID 1
                                          
                                          // Enable and select radio type attached
                                          #define MY_RADIO_RFM69
                                          #define MY_IS_RFM69HW
                                          #define MY_RFM69_FREQUENCY RFM69_433MHZ // RFM69_433MHZ for development branch, RF69_433MHZ for master
                                          #define MY_RF69_IRQ_PIN 2
                                          #define MY_RF69_SPI_CS 10
                                          
                                          #include <MySensors.h> // From Library Manager
                                          
                                          #include <BME280I2C.h> // From Library Manager
                                          BME280I2C bme;
                                          
                                          static const uint64_t UPDATE_INTERVAL = 300000;
                                          
                                          #define CHILD_ID_HUM 0
                                          #define CHILD_ID_TEMP 1
                                          #define CHILD_ID_VCC_BEFORE 2
                                          #define CHILD_ID_VCC_AFTER 3
                                          
                                          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);
                                          //TODO: Add pressure from BME280?
                                          //TODO: Add light detection (irq-based, LDR)
                                          //TODO: Add flooding detection
                                          
                                          void presentation()
                                          {
                                            // Send the sketch version information to the gateway
                                            sendSketchInfo("StorageRoom", "1.1");
                                          
                                            present(CHILD_ID_HUM, S_HUM);
                                            wait(100);
                                            present(CHILD_ID_TEMP, S_TEMP);
                                            wait(100);
                                            present(CHILD_ID_VCC_BEFORE, S_CUSTOM);
                                            wait(100);
                                            present(CHILD_ID_VCC_AFTER, S_CUSTOM);
                                          }
                                          
                                          void setup()
                                          {
                                            if (! bme.begin()) {
                                              Serial.println("Could not find a valid BME280 sensor, check wiring! Continuing without sensor...");
                                            }
                                          }
                                          
                                          
                                          void loop()
                                          {
                                            static float lastTemp;
                                            static float lastHum;
                                            send(msgVccBefore.set(readVcc() / 1000.0, 3));
                                            float temperature = bme.temp();
                                            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.hum();
                                            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
                                          
                                            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
                                          }
                                          

                                          and for the gateway:

                                          // Based on https://github.com/mysensors/MySensors/tree/master/examples/GatewayESP8266OTA
                                          
                                          #include <ArduinoOTA.h>
                                          
                                          // Enable debug prints to serial monitor
                                          #define MY_DEBUG
                                          #define MY_BAUD_RATE 74880 // To be able to see reset messages
                                          
                                          #define WIFI_REPORT_INTERVAL 300000
                                          
                                          // Enables and select radio type (if attached)
                                          #define MY_RADIO_RFM69
                                          #define MY_IS_RFM69HW
                                          #define MY_RF69_IRQ_PIN D2
                                          #define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
                                          #define MY_RF69_SPI_CS D8
                                          #define MY_RFM69_FREQUENCY RFM69_433MHZ // RFM69_433MHZ for development branch, RF69_433MHZ for master
                                          
                                          #define MY_GATEWAY_ESP8266
                                          
                                          #define MY_WIFI_SSID "Mr-IoT.com"
                                          #include "settings.h"
                                          
                                          // Set the hostname for the WiFi Client. This is the hostname
                                          // it will pass to the DHCP server if not static.
                                          #define MY_HOSTNAME "RFM69-Gateway"
                                          
                                          // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
                                          //#define MY_IP_ADDRESS 192,168,178,87
                                          
                                          // If using static ip you can define Gateway and Subnet address as well
                                          //#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
                                          //#define MY_IP_SUBNET_ADDRESS 255,255,255,0
                                          
                                          // The port to keep open on node server mode
                                          #define MY_PORT 5003
                                          
                                          // How many clients should be able to connect to this gateway (default 1)
                                          #define MY_GATEWAY_MAX_CLIENTS 2
                                          
                                          // Controller ip address. Enables client mode (default is "server" mode).
                                          // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
                                          //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68
                                          
                                          #if defined(MY_USE_UDP)
                                          #include <WiFiUDP.h>
                                          #else
                                          #include <ESP8266WiFi.h>
                                          #endif
                                          
                                          #include <MySensors.h>
                                          #define CHILD_ID_WIFI_RSSI 0
                                          MyMessage msgWifiRssi(CHILD_ID_WIFI_RSSI, V_LEVEL);
                                          #define CHILD_ID_RSSI1 1
                                          MyMessage msgRssi1(CHILD_ID_RSSI1, V_LEVEL);
                                          bool sendRssi = false;
                                          int16_t rssi;
                                          
                                          void setup()
                                          {
                                            // Setup locally attached sensors
                                            ArduinoOTA.onStart([]() {
                                              DEBUG_OUTPUT("ArduinoOTA start\n");
                                            });
                                            ArduinoOTA.onEnd([]() {
                                              DEBUG_OUTPUT("\nArduinoOTA end\n");
                                            });
                                            ArduinoOTA.setPassword((const char *)OTA_PASSWORD);
                                            ArduinoOTA.setHostname(MY_HOSTNAME);
                                            ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
                                              DEBUG_OUTPUT("OTA Progress: %u%%\r", (progress / (total / 100)));
                                            });
                                            ArduinoOTA.onError([](ota_error_t error) {
                                              DEBUG_OUTPUT("Error[%u]: ", error);
                                              if (error == OTA_AUTH_ERROR) {
                                                DEBUG_OUTPUT("Auth Failed\n");
                                              } else if (error == OTA_BEGIN_ERROR) {
                                                DEBUG_OUTPUT("Begin Failed\n");
                                              } else if (error == OTA_CONNECT_ERROR) {
                                                DEBUG_OUTPUT("Connect Failed\n");
                                              } else if (error == OTA_RECEIVE_ERROR) {
                                                DEBUG_OUTPUT("Receive Failed\n");
                                              } else if (error == OTA_END_ERROR) {
                                                DEBUG_OUTPUT("End Failed\n");
                                              }
                                            });
                                            ArduinoOTA.begin();
                                          }
                                          
                                          void presentation()
                                          {
                                            // Present locally attached sensors here
                                            present(CHILD_ID_WIFI_RSSI, S_SOUND);
                                            wait(100);
                                            present(CHILD_ID_RSSI1, S_SOUND);
                                          }
                                          
                                          long lastSend = 0;
                                          void loop()
                                          {
                                            // Send locally attech sensors data here
                                            ArduinoOTA.handle();
                                            if (millis() - lastSend > WIFI_REPORT_INTERVAL) {
                                              send(msgWifiRssi.set(WiFi.RSSI(), 1));
                                              lastSend = millis();
                                            }
                                            if (sendRssi) {
                                              sendRssi = false;
                                              send(msgRssi1.set(rssi, 0));
                                            }
                                          }
                                          
                                          void receive(const MyMessage &message)
                                          {
                                            rssi = _radio.RSSI;
                                            if (message.sender == 1) {
                                              sendRssi = true;
                                            }
                                          }
                                          
                                          
                                          mfalkviddM Offline
                                          mfalkviddM Offline
                                          mfalkvidd
                                          Mod
                                          wrote on last edited by mfalkvidd
                                          #21

                                          About 35 minutes after I reset the node, it started reporting again (without any other changes). I have no idea what caused it to start working.

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


                                          31

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


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

                                          • Don't have an account? Register

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