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.
-
-
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
-
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!
1 out of 7
Suggested Topics
-
💬 Sonoff relay using MySensors ESP8266 wifi or mqtt gateway
OpenHardware.io • 20 Jan 2017, 16:20 • openhardware.io 29 Oct 2018, 08:03 -
[SOLVED] NodeMCU ESP8266 and SPI with NRF24L01 + SD card module - sanity errors?
Troubleshooting • 26 Apr 2017, 20:53 • Kokosnoot 28 Apr 2017, 17:33 -
💬 MySWeMosIRShield - IR blaster shield for WeMos D1
OpenHardware.io • 8 May 2017, 05:14 • openhardware.io 3 Feb 2019, 18:22 -
💬 vESPrino - The IOT Dongle
OpenHardware.io • 11 Jul 2016, 10:44 • openhardware.io 1 Aug 2016, 07:07 -
ESP8266MQTTClientGateway
Bug Reports • 30 Jan 2016, 10:26 • mbj 30 Jan 2016, 14:16 -
Vera plugin not creating devices
Vera • 4 Jan 2017, 17:05 • nicomedia 9 Jan 2017, 18:19