@hek Thanks for the help, but I think I explained it wrong. I wanted my sonoff relay to send the updated state of the relay when I use the physical switch, because it updates the status on the Vera only when I turn it off and on from there. From what I read I can only use the send function to control the relay, but not to send its state back to my Vera.
Posts made by nicomedia
-
RE: Send RelayActuator state back to gateway
-
Send RelayActuator state back to gateway
I have modded a sonoff with the mysensors firmware and added a feature that switches the light on and off by using a gpio pin. The problem is that I can't find a way to tell my gateway the updated state of the relay. If I turn in on from my Vera gateway but then turn it off with the physical switch it still shows as "on" on the vera, which makes it confusing. Is there a way to update it?
-
RE: Vera plugin not creating devices
I figured it out: there is a bug in UI7 where when I press the start button for inclusion mode it never stops and the manual stop button doesn't do anything. It took a lot of luup restarts at the right moment to get it to work. I don't know if this is a bug but I tried this on 2 Veras and it did the same so it's not just for me I think....
-
Vera plugin not creating devices
I have a sonoff relay and I reprogrammed it using the mysensors API. The device works under Vera and it connects, but the Vera doesn't create the relay device even though in the advanced menu of the Vera it says that it found 2 devices. What could be wrong?
-
Report relay state back to the controller
I can't find on google or on the forum how to make an esp8266 based gateway with a local relay connected report the state of the relay back to my controller(which is a vera, but that should't matter). Thanks for the help.
-
RE: No forward link or gateway feature activated, but I did.
@hek That did it! I included the library with the Arduino IDE and it put it on the top. Didn't know that, thanks!
-
RE: No forward link or gateway feature activated, but I did.
@Fabien I did but I got the same error
-
RE: No forward link or gateway feature activated, but I did.
@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() { }
-
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. -
RE: Sonoff and Vera
@hek Thank you so much! I've been able to write my code for the relay. The problem is that it doesn't compile because it finds errors in the mysensor.h library. How can I fix this? Did I do something wrong?
Arduino: 1.8.0 (Mac OS X), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None" Build options changed, rebuilding all In file included from /Users/Federico/Documents/Arduino/libraries/MySensors/MySensors.h:204:0, from /Users/Federico/Desktop/GatewayESP8266/GatewayESP8266.ino:44: /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:45:24: error: 'WiFiServer' does not name a type #define EthernetServer WiFiServer ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:62:1: note: in expansion of macro 'EthernetServer' EthernetServer _ethernetServer(_ethernetGatewayPort); ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:46:24: error: 'WiFiClient' does not name a type #define EthernetClient WiFiClient ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:69:8: note: in expansion of macro 'EthernetClient' static EthernetClient clients[MY_GATEWAY_MAX_CLIENTS]; ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp: In function 'bool gatewayTransportInit()': /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:106:2: error: 'WiFi' was not declared in this scope WiFi.mode (WIFI_STA); ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:106:13: error: 'WIFI_STA' was not declared in this scope WiFi.mode (WIFI_STA); ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:114:26: error: 'WL_CONNECTED' was not declared in this scope while (WiFi.status() != WL_CONNECTED) { ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:162:2: error: '_ethernetServer' was not declared in this scope _ethernetServer.begin(); ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp: In function 'bool gatewayTransportSend(MyMessage&)': /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:212:37: error: 'clients' was not declared in this scope for (uint8_t i = 0; i < ARRAY_SIZE(clients); i++) { ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:36:32: note: in definition of macro 'ARRAY_SIZE' #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp: In function 'bool _readFromClient(uint8_t)': /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:228:9: error: 'clients' was not declared in this scope while (clients[i].connected() && clients[i].available()) { ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp: In function 'bool gatewayTransportAvailable()': /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:347:37: error: 'clients' was not declared in this scope for (uint8_t i = 0; i < ARRAY_SIZE(clients); i++) { ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:36:32: note: in definition of macro 'ARRAY_SIZE' #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:354:8: error: '_ethernetServer' was not declared in this scope if (_ethernetServer.hasClient()) { ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:367:26: error: '_ethernetServer' was not declared in this scope if (allSlotsOccupied && _ethernetServer.hasClient()) { ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:46:24: error: 'WiFiClient' was not declared in this scope #define EthernetClient WiFiClient ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:370:3: note: in expansion of macro 'EthernetClient' EthernetClient c = _ethernetServer.available(); ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:370:18: error: expected ';' before 'c' EthernetClient c = _ethernetServer.available(); ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:371:3: error: 'c' was not declared in this scope c.stop(); ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:374:37: error: 'clients' was not declared in this scope for (uint8_t i = 0; i < ARRAY_SIZE(clients); i++) { ^ /Users/Federico/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportEthernet.cpp:36:32: note: in definition of macro 'ARRAY_SIZE' #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) ^ exit status 1 Error compiling for board Generic ESP8266 Module. This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.
-
RE: Sonoff and Vera
@hek Sorry for being annoying, but I don't know anything about MySensors. I know that the relay is controlled by GPIO 12 and is active high. Do I flash the esp8266, the RelayActuator.ino or do I merge the two together? Thanks so much for your help.
-
RE: Sonoff and Vera
Which one? The only firmware for the esp8266 that I can find is for gateway only, but the sonoff also has an onboard relay... Do I have to modify the code or something to make it work?
-
Sonoff and Vera
I'm completely new to MySensors, and I don't understand how it works 100%. I wanted to connect sonoff relays to my Vera, but I don't know how the connection works: it says on the website that the vera needs a serial or ethernet gateway, but why would I need that when the relay already has WiFi? Do I need to create multiple devices and configure them as a separate gateway for every relay? Thanks for your help.