SOLVED: MQTT ESP8266 Gateway issue



  • getting weird errors with my gateway. Right after it starts it spams "mygateway1-out/0/255/0/0/18"

    Log:

    0;255;3;0;9;MCO:BGN:INIT GW,CP=RRNGE--,VER=2.1.1
    0;255;3;0;9;TSF:LRT:OK
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    scandone
    state: 0 -> 2 (b0)
    state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 8
    cnt
    
    connected with XXXXXX, channel 1
    dhcp client start...
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    f r0, scandone
    ....ip:192.168.1.208,mask:255.255.255.0,gw:192.168.1.1
    .IP: 192.168.1.208
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    IP: 192.168.1.208
    
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    

    After a while it crashes and reboots the ESP8266.

    Im using this hardware:

    Wemos d1 mini
    RFM69HW
    DHT-11

    and this sketch:

    /**
     * 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 recieved. In inclusion mode will blink fast only on presentation recieved
     * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
     * - ERR (red) - fast blink on error during transmission error or recieve crc error
     *
     * See http://www.mysensors.org/build/esp8266_gateway for wiring instructions.
     * nRF24L01+  ESP8266
     * VCC        VCC
     * CE         GPIO4
     * CSN/CS     GPIO15
     * SCK        GPIO14
     * MISO       GPIO12
     * MOSI       GPIO13
     *
     * Not all ESP8266 modules have all pins available on their external interface.
     * This code has been tested on an ESP-12 module.
     * The ESP8266 requires a certain pin configuration to download code, and another one to run code:
     * - Connect REST (reset) via 10K pullup resistor to VCC, and via switch to GND ('reset switch')
     * - Connect GPIO15 via 10K pulldown resistor to GND
     * - Connect CH_PD via 10K resistor to VCC
     * - Connect GPIO2 via 10K resistor to VCC
     * - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch')
     *
      * Inclusion mode button:
     * - Connect GPIO5 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 9600
    
    // Enables and select radio type (if attached)
    //#define MY_RADIO_NRF24
    #define MY_RADIO_RFM69
    #define MY_RFM69_FREQUENCY   RF69_868MHZ
    #define MY_IS_RFM69HW
    #define MY_RF69_IRQ_PIN 4
    #define MY_RF69_SPI_CS 15
    #define MY_GATEWAY_MAX_CLIENTS 30
    #define MY_NODE_ID 0
    
    #define MY_GATEWAY_MQTT_CLIENT
    #define MY_GATEWAY_ESP8266
    
    // Set this node's subscribe and publish topic prefix
    #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
    #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
    
    // Set MQTT client id
    #define MY_MQTT_CLIENT_ID "mysensors-1"
    
    // Enable these if your MQTT broker requires usenrame/password
    #define MY_MQTT_USER "XXXXXXX"
    #define MY_MQTT_PASSWORD "********"
    
    // Set WIFI SSID and password
    #define MY_ESP8266_SSID "XXXXXXX"
    #define MY_ESP8266_PASSWORD "**************"
    
    // Set the hostname for the WiFi Client. This is the hostname
    // it will pass to the DHCP server if not static.
    #define MY_ESP8266_HOSTNAME "mqtt-sensor-868mhz-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 need to 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
    
    
    // MQTT broker ip address.
    #define MY_CONTROLLER_IP_ADDRESS 192, 168, 1 , 87
    
    // The MQTT broker port to to open
    #define MY_PORT 1883
    
    //DHT11 stuff, This node on MQTT mygateway1-out/X/1/1/0/0 for temperature and mygateway1-out/X/0/1/0/1 for humidity
    #define DHTPIN  5
    #define SENSOR_TEMP_OFFSET 0
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define DHTTYPE DHT11
    bool initialValueSent = false;
    
    // Generally, you should use "unsigned long" for variables that hold time
    unsigned long previousMillis = 0;        // will store last temp was read
    const long interval = 900000;              // interval at which to read sensor
    
    float temp_c;
    float humidity;
    
    #include <SPI.h>
    #include <ESP8266WiFi.h>
    #include <MySensors.h>
    #include <DHT.h>
    
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    DHT dht(DHTPIN, DHTTYPE, 11);
    
    /*
    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    #define MY_INCLUSION_BUTTON_FEATURE
    // Set inclusion mode duration (in seconds)
    #define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    #define MY_INCLUSION_MODE_BUTTON_PIN  1
    
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Flash leds on rx/tx/err
    #define MY_DEFAULT_ERR_LED_PIN 16  // Error led pin
    #define MY_DEFAULT_RX_LED_PIN  16  // Receive led pin
    #define MY_DEFAULT_TX_LED_PIN  16  // the PCB, on board LED
    */
    
    
    void setup()
    {
      // You can open the Arduino IDE Serial Monitor window to see what the code is doing
      dht.begin();           // initialize temperature sensor
    }
    
    void presentation()
    {
      presentNode();
      // Send the sketch version information to the gateway
      sendSketchInfo("TempandHumid", "0.2");
    
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID_HUM, S_HUM);
      present(CHILD_ID_TEMP, S_TEMP);
    
      //metric = getConfig().isMetric;
    }
    
    void loop()
    {
      // Wait at least 2 seconds seconds between measurements.
      // if the difference between the current time and last time you read
      // the sensor is bigger than the interval you set, read the sensor
      // Works better than delay for things happening elsewhere also
      if (!initialValueSent) {
        humidity = dht.readHumidity();
        temp_c = dht.readTemperature();
        wait(3000);
        if (isnan(humidity) || isnan(temp_c)) {
          Serial.println("Failed to read from DHT sensor!");
          return;
        }
        Serial.println("Sending initial value");
        send(msgTemp.set(temp_c, 1));
        send(msgHum.set(humidity, 1));
        initialValueSent = true;
      }
    
      unsigned long currentMillis = millis();
      if(currentMillis - previousMillis >= interval) {
        // save the last time you read the sensor
        previousMillis = currentMillis;
    
        // Reading temperature for humidity takes about 250 milliseconds!
        // Sensor readings may also be up to 2 seconds 'old' (it's a very slow sensor)
        humidity = dht.readHumidity();          // Read humidity (percent)
        temp_c = dht.readTemperature();     // Read temperature as Fahrenheit
        // Check if any reads failed and exit early (to try again).
        if (isnan(humidity) || isnan(temp_c)) {
          Serial.println("Failed to read from DHT sensor!");
          return;
        }
        send(msgTemp.set(temp_c, 1));
        send(msgHum.set(humidity, 1));
    //    #ifdef MY_DEBUG
    //    Serial.print("H: ");
    //    Serial.println(humidity);
    //    Serial.print("T: ");
    //    Serial.println(temp_c);
    //    #endif
      }
    }
    

    Any help why? I just updated this sketch with added mqtt username and password and added the node id and added the RFM69HW line.
    Also my lib is newly updated to 2.1.1

    The sketch was running fine on the device before this reupload with the mentioned changes.



  • presentNode();
    

    This was the culprit. 🙂



  • Now I got a different issue. while updating to a new sketch and using a the newest lib I cannot get the damn radios to work. I have built a entire new setup with new hardware both node and esp8266 mqtt gateway (using a binary sensor node) but I'm only getting fails when the node tries to locate the gateway in the presentation. And no reaction on the gateway either.

    I tried using a Uno with the example serial gateway with a level adjuster in-between my rfm69hw and the uno and the only thing I changed in the sketch was to use rfm69 as a radio. and still nothing. gone thru 6 different radio pcbs and none of them work

    I got a 470uF cap (I know its a little big but it was the smallest one I had) on each radio between 3.3V and GND and a 8.2cm wire from the antenna.

    I see now thou that you say not to use a multi braided wire for antenna so this might be the issue I guess. But the node and the gateway was working fine with this antenna before the update.

    also I have cleaned the eprom before the update just in case.



  • Right so I'm getting nowhere with this. The Gateway is running this sketch:

    /**
     * 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 recieved. In inclusion mode will blink fast only on presentation recieved
     * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
     * - ERR (red) - fast blink on error during transmission error or recieve crc error
     *
     * See http://www.mysensors.org/build/esp8266_gateway for wiring instructions.
     * nRF24L01+  ESP8266
     * VCC        VCC
     * CE         GPIO4
     * CSN/CS     GPIO15
     * SCK        GPIO14
     * MISO       GPIO12
     * MOSI       GPIO13
     *
     * Not all ESP8266 modules have all pins available on their external interface.
     * This code has been tested on an ESP-12 module.
     * The ESP8266 requires a certain pin configuration to download code, and another one to run code:
     * - Connect REST (reset) via 10K pullup resistor to VCC, and via switch to GND ('reset switch')
     * - Connect GPIO15 via 10K pulldown resistor to GND
     * - Connect CH_PD via 10K resistor to VCC
     * - Connect GPIO2 via 10K resistor to VCC
     * - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch')
     *
      * Inclusion mode button:
     * - Connect GPIO5 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 9600
    
    // Enables and select radio type (if attached)
    //define MY_RADIO_NRF24
    #define MY_RADIO_RFM69
    #define MY_RFM69_FREQUENCY   RF69_868MHZ
    #define MY_IS_RFM69HW
    #define MY_RF69_IRQ_PIN 4
    #define MY_RF69_SPI_CS 15
    #define MY_GATEWAY_MAX_CLIENTS 20
    
    #define MY_GATEWAY_MQTT_CLIENT
    #define MY_GATEWAY_ESP8266
    
    // Set this node's subscribe and publish topic prefix
    #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
    #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
    
    // Set MQTT client id
    #define MY_MQTT_CLIENT_ID "mysensors-1"
    
    // Enable these if your MQTT broker requires usenrame/password
    #define MY_MQTT_USER "**********"
    #define MY_MQTT_PASSWORD "**********"
    
    // Set WIFI SSID and password
    #define MY_ESP8266_SSID "*********"
    #define MY_ESP8266_PASSWORD "************"
    
    // Set the hostname for the WiFi Client. This is the hostname
    // it will pass to the DHCP server if not static.
     #define MY_ESP8266_HOSTNAME "mqtt-sensor-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 need to 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
    
    
    // MQTT broker ip address.
    #define MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 87
    
    // The MQTT broker port to to open
    #define MY_PORT 1883
    
    /*
    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    #define MY_INCLUSION_BUTTON_FEATURE
    // Set inclusion mode duration (in seconds)
    #define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    #define MY_INCLUSION_MODE_BUTTON_PIN  3
    
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Flash leds on rx/tx/err
    #define MY_DEFAULT_ERR_LED_PIN 16  // Error led pin
    #define MY_DEFAULT_RX_LED_PIN  16  // Receive led pin
    #define MY_DEFAULT_TX_LED_PIN  16  // the PCB, on board LED
    */
    
    #define DHTPIN  5
    #define SENSOR_TEMP_OFFSET 0
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define DHTTYPE DHT11
    bool initialValueSent = false;
    
    // Generally, you should use "unsigned long" for variables that hold time
    unsigned long previousMillis = 0;        // will store last temp was read
    const long interval = 900000;              // interval at which to read sensor
    
    float temp_c;
    float humidity;
    
    #include <ESP8266WiFi.h>
    #include <MySensors.h>
    #include <DHT.h>
    
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    DHT dht(DHTPIN, DHTTYPE, 11);
    
    void setup()
    {
        dht.begin();
    }
    
    void presentation()
    {
      // Send the sketch version information to the gateway
      sendSketchInfo("Gateway-temphumid", "1.1");
    
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID_HUM, S_HUM);
      present(CHILD_ID_TEMP, S_TEMP);
    }
    
    
    void loop()
    {
      // Wait at least 2 seconds seconds between measurements.
      // if the difference between the current time and last time you read
      // the sensor is bigger than the interval you set, read the sensor
      // Works better than delay for things happening elsewhere also
      if (!initialValueSent) {
        humidity = dht.readHumidity();
        temp_c = dht.readTemperature();
        wait(3000);
        if (isnan(humidity) || isnan(temp_c)) {
          Serial.println("Failed to read from DHT sensor!");
          return;
        }
        Serial.println("Sending initial value");
        send(msgTemp.set(temp_c, 1));
        send(msgHum.set(humidity, 1));
        initialValueSent = true;
      }
    
      unsigned long currentMillis = millis();
      if(currentMillis - previousMillis >= interval) {
        // save the last time you read the sensor
        previousMillis = currentMillis;
    
        // Reading temperature for humidity takes about 250 milliseconds!
        // Sensor readings may also be up to 2 seconds 'old' (it's a very slow sensor)
        humidity = dht.readHumidity();          // Read humidity (percent)
        temp_c = dht.readTemperature();     // Read temperature as Fahrenheit
        // Check if any reads failed and exit early (to try again).
        if (isnan(humidity) || isnan(temp_c)) {
          Serial.println("Failed to read from DHT sensor!");
          return;
        }
        send(msgTemp.set(temp_c, 1));
        send(msgHum.set(humidity, 1));
      }
    }
    

    And when starting the gateway I get this:

    0;255;3;0;9;MCO:BGN:INIT GW,CP=RRNGE--,VER=2.1.1
    0;255;3;0;9;TSF:LRT:OK
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    scandone
    state: 0 -> 2 (b0)
    state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 14
    cnt
    
    connected with Johrid, channel 1
    dhcp client start...
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    f r0, scandone
    ....ip:192.168.1.208,mask:255.255.255.0,gw:192.168.1.1
    .IP: 192.168.1.208
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    IP: 192.168.1.208
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/3/0/11
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/3/0/12
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/0/0/0/7
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/1/0/0/6
    Sending initial value
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/1/1/0/0
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/0/1/0/1
    pm open,type:2 0
    

    On a node starting for the first time I get this:

    2148 !TSM:FPAR:NO REPLY
    2150 TSM:FPAR
    2281 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4290 !TSM:FPAR:NO REPLY
    4292 TSM:FPAR
    4423 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6432 !TSM:FPAR:NO REPLY
    6434 TSM:FPAR
    6565 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8577 !TSM:FPAR:FAIL
    8579 TSM:FAIL:CNT=1
    8581 TSM:FAIL:PDT
    18585 TSM:FAIL:RE-INIT
    18587 TSM:INIT
    18591 TSM:INIT:TSP OK
    18593 TSM:FPAR
    18724 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    20736 !TSM:FPAR:NO REPLY
    20738 TSM:FPAR
    20869 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    22878 !TSM:FPAR:NO REPLY
    22880 TSM:FPAR
    23011 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    25020 !TSM:FPAR:NO REPLY
    25022 TSM:FPAR
    25153 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    27162 !TSM:FPAR:FAIL
    27164 TSM:FAIL:CNT=2
    27166 TSM:FAIL:PDT
    37169 TSM:FAIL:RE-INIT
    37171 TSM:INIT
    37175 TSM:INIT:TSP OK
    37177 TSM:FPAR
    37308 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    39317 !TSM:FPAR:NO REPLY
    39319 TSM:FPAR
    39450 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    41459 !TSM:FPAR:NO REPLY
    41461 TSM:FPAR
    41592 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    43603 !TSM:FPAR:NO REPLY
    43606 TSM:FPAR
    43737 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    45746 !TSM:FPAR:FAIL
    45748 TSM:FAIL:CNT=3
    45750 TSM:FAIL:PDT
    

    Running this sketch

    /**
     * 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
     * Motion Sensor example using HC-SR501
     * http://www.mysensors.org/build/motion
     *
     */
    
    // Enable debug prints
     #define MY_DEBUG
    
    // Enable and select radio type attached
    //#define MY_RADIO_NRF24
    #define MY_RADIO_RFM69
    #define MY_RFM69_FREQUENCY RF69_868MHZ
    #define MY_IS_RFM69HW
    #define RF69_IRQ_PIN 2
    
    #include <MySensors.h>
    
    unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
    #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
    #define CHILD_ID 1   // Id of the sensor child
    
    // Initialize motion message
    MyMessage msg(CHILD_ID, V_TRIPPED);
    
    void setup()
    {
        pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
    }
    
    void presentation()
    {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Motion v-rum", "1.0");
    
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID, S_MOTION);
    }
    
    void loop()
    {
        // Read digital motion value
        bool tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;
    
        Serial.println(tripped);
        send(msg.set(tripped?"1":"0"));  // Send tripped value to gw
    
        // Sleep until interrupt comes in on motion sensor. Send update every two minute.
        sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
    }
    

    All hardware is new and I have triple checked the connections on the radios on both devices.
    Both sketches where running fine but I needed to update the gateway to add a mqtt password and when doing so I wen from using a early version (2.0.1 I think) to the newest lib (2.1.1) and after this I'm not getting this to work at all. My first problem was listed in the first post here. for some reason I had presentNode in the presentation (no idea why) but that didn't work. after removing that it worked as usual. except it was note receiving any data.

    And I thought, hmm might need to update my sensor. So I did. And at the same time I erased the EEPROM-Config on both the ESP8266 and on the Arduino running the node.

    But avail not working. Now I have two single core threads that are exactly 82.2mm long and a 10uF cap mounted on the radio with a ESR of 0.6Ohms.

    Can anyone please help me? What am I doing wrong. I cannot find whats wrong from these logs.


  • Mod

    Install mysensors library 2.1.0, I had probably the same problem that broke nrf24 after updating to 2.1.1



  • Na thats not it either It seems. Still getting the same errors.

    Ran EEPROM clear on both gateway and node.

    Change lib from 2.1.1 to 2.1.0 and reluploaded the sketches (with the addition of #define MY_NODE_ID 1 to the node sketch)

    0 MCO:BGN:INIT NODE,CP=RRNNA--,VER=2.1.0
    4 TSM:INIT
    4 TSF:WUR:MS=0
    8 TSM:INIT:TSP OK
    10 TSM:INIT:STATID=1
    12 TSF:SID:OK,ID=1
    14 TSM:FPAR
    145 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2152 !TSM:FPAR:NO REPLY
    2154 TSM:FPAR
    2285 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4292 !TSM:FPAR:NO REPLY
    4294 TSM:FPAR
    4425 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6432 !TSM:FPAR:NO REPLY
    6434 TSM:FPAR
    6565 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8574 !TSM:FPAR:FAIL
    8577 TSM:FAIL:CNT=1
    8579 TSM:FAIL:PDT
    
    0;255;3;0;9;MCO:BGN:INIT GW,CP=RRNGE--,VER=2.1.0
    0;255;3;0;9;TSF:LRT:OK
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    scandone
    state: 0 -> 2 (b0)
    state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 14
    cnt
    
    connected with Johrid, channel 1
    dhcp client start...
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    f r0, scandone
    ....ip:192.168.1.208,mask:255.255.255.0,gw:192.168.1.1
    .IP: 192.168.1.208
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    IP: 192.168.1.208
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/3/0/11
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/3/0/12
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/0/0/0/7
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/1/0/0/6
    Sending initial value
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/1/1/0/0
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/0/1/0/1
    pm open,type:2 0
    


  • Riiight so when inspecting the radios I have I notice that the H on the back is not ticked. There might be an issue that the seller have sent me the wrong radios.

    But removing the define #define MY_IS_RFM69HW did not help.

    If one where to run the RFM69W as a HW would that damage the chip?



  • After using lowpowerlabs example sketches "Gateway.ino" and "Node.ino" I now know that the radios work. and at a nice range as well. But they are not HW.

    That being said even if I remove #define MY_IS_RFM69HW I'm still getting this issue.


  • Mod

    You can't remove that define, otherwise the library doesn't know what radio has to set up. If I remember well the H stands for high power so it should be the same.



  • That define is to turn on high power mode if you have a rfm69hw

    I sill have

    #define MY_RADIO_RFM69

    So radio is define but not in high power mode.



  • I changed back to 2.0.0 lib. Then everything start working again:-)



  • Thank you, so did I and it works.

    Will open a ticket on github with this find and hopefully the devs will be able to recreate and fix the issue.



  • anyone got the gatway working with the 2.1.1 lib?



  • Alas, I'm also struggling with ESP crashes and weird messages:

    TSM:INIT
    TSF:WUR:MS=0
    TSM:INIT:TSP OK
    TSM:INIT:STATID=22
    TSF:SID:OK,ID=22
    TSM:FPAR
    TSF:MSG:SEND,22-22-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    scandone
    state: 0 -> 2 (b0)
    state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 5
    cnt 
    chg_B1:-40
    
    connected with Airport, channel 6
    dhcp client start...
    chg_B1:-80
    !TSM:FPAR:NO REPLY
    TSM:FPAR
    TSF:MSG:SEND,22-22-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    chg_B1:-120
    !TSM:FPAR:NO REPLY
    TSM:FPAR
    TSF:MSG:SEND,22-22-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    !TSM:FPAR:NO REPLY
    

  • Mod

    Is it the same problem as your other post?



  • @gohan there are different things going wrong, the parent id can't be found (eventhough it is set manually to 0), but there's also a lot of debug specific to the esp module.


Log in to reply
 

Suggested Topics

60
Online

11.4k
Users

11.1k
Topics

112.7k
Posts