No forward link or gateway feature activated, but I did.



  • I made some code for a Sonoff relay, which has an esp8266 chipset. I defined MY_GATEWAY_ESP8266, but when I compile it gives me this error: No forward link or gateway feature activated.
    How can I solve it? I did define my gateway.



  • @nicomedia said:

    No forward link or gateway feature activated.

    did you define the radio ?


  • Admin

    Did you define that before or after including MySensors.h?



  • @hek Tried both, doesn't make a difference. I'll include my sketch below.

    #include <MySensors.h>
    #include <MyConfig.h>
    
    // Modalità debug
    //#define MY_DEBUG
    
    // Baud rate seriale mod. debug
    #define MY_BAUD_RATE 9600
    
    //#define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    #define MY_GATEWAY_ESP8266
    
    #define MY_ESP8266_SSID "SSID"
    #define MY_ESP8266_PASSWORD "Password"
    
    //#define MY_USE_UDP
    
    #define MY_ESP8266_HOSTNAME "Sonoff1"
    
    //#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
    
    //Porta in ascolto
    #define MY_PORT 5003
    
    // Numero massimo di client
    #define MY_GATEWAY_MAX_CLIENTS 2
    
    // 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
    
    #define MY_REPEATER_FEATURE
    
    
    #define RELAY_1  12  // Pin del relè
    #define NUMBER_OF_RELAYS 1 // Numero di relè
    #define RELAY_ON 1  // Stato del pin per relè attivo
    #define RELAY_OFF 0 // Stato del pin per relè inattivo
    
    #if defined(MY_USE_UDP)
    #include <WiFiUdp.h>
    #endif
    
    #include <ESP8266WiFi.h>
    
    
    void before()
    {
      for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
        // Imposta il quale pin è quello del relè
        pinMode(pin, OUTPUT);
        // Imposta il relè allo stato precedente (in caso salti la luce)
        digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
      }
    }
    
    void setup()
    {
    }
    
    void presentation()
    {
    	  // Invia informazioni versione al gateway
      sendSketchInfo("Relay", "1.0");
    
      for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
        // Presenta i sensori locali al gateway
        present(sensor, S_BINARY);
      }
    }
    
    void receive(const MyMessage &message)
    {
      // Controllo il messaggio inviato
      if (message.type==V_STATUS) {
        // Cambia stato relè
        digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
        // Memorizza stato relè
        saveState(message.sensor, message.getBool());
        // Informazioni debug
        Serial.print("Cambiamento relè:");
        Serial.print(message.sensor);
        Serial.print(", Nuovo Stato:");
        Serial.println(message.getBool());
      }
    }
    
    
    void loop()
    {
    
    }


  • @Fabien I did but I got the same error


  • Admin

    Always put the include after the defines. The sketch posted above is wrong and will fail at compile time. And remove the MyConfig.h include.



  • @hek That did it! I included the library with the Arduino IDE and it put it on the top. Didn't know that, thanks!


Log in to reply
 

Suggested Topics

164
Online

9.5k
Users

10.1k
Topics

105.2k
Posts