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.
-
You would have to run the MySensors firmware on your Sonoff (acting as gateway) presenting and controlling the relays in the device.
I haven't tried this myself (haven't got any sonoffs) but in theory it should work.
-
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?
-
You have to find out which ESP-pins that controls the relays and modify the gateway sketch using the Relay example as a hint.
https://github.com/mysensors/MySensors/blob/development/examples/RelayActuator/RelayActuator.ino
-
@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.
-
You will have to merge them.
-
@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.
-
@nicomedia I stumbled on this doing a google search. Just wondering if you are still trying to get your Sonoff's working with your Vera controller? If so, I have written a blog post on the subject. It uses a different firmware called ESP Easy and an HTTP Switch plugin on the Vera rather than MySensors. but it works rather well for me. Here is the link to the blog post:
https://dan.bemowski.info/2017/07/04/using-a-sonoff-with-espeasy-and-vera/
I use this in conjunction with some MySensors wall switches that I built.
https://dan.bemowski.info/2017/06/11/my-start-into-open-source-hardware/
Suggested Topics
-
all the gear, no idea
General Discussion • 5 Mar 2015, 17:51 • baldsi 2 Apr 2015, 07:28 -
3 Way Switch with Relay Sensor
Vera • 28 Sept 2014, 16:22 • rafael.brasilia 24 Oct 2019, 13:18 -
Smart Light Switch 220v
OpenHardware.io • 23 Apr 2016, 01:02 • openhardware.io 3 Mar 2017, 11:20 -
Report relay state back to the controller
Development • 3 Jan 2017, 13:18 • nicomedia 3 Jan 2017, 13:18 -
cant get setSafeguard to work with NodeManager 1.8dev
NodeManager • 19 Oct 2018, 18:55 • tomlund 17 Nov 2018, 16:37 -
Ultrasonic Sensor+1 Relay node does not work
Domoticz • 26 May 2015, 01:59 • Suresh Mali 18 Oct 2015, 09:02 -
First sensor ... so close but no temp reading
Vera • 15 Mar 2015, 14:04 • phate1 28 Apr 2015, 01:32 -
SONOFF Issues?
Hardware • 12 Apr 2017, 06:40 • Samuel235 20 Apr 2017, 19:07