Hi - many thanks in advance to anyone that can help!
I am trying to control devices (switches / lights) connected to Arduino Uno / Mega boards with an Ethernet shield, with Alexa.
I can see lots of tutorials / example code on the internet showing how to do with ESP8266 / ESP32 devices, but I want to modify the code so that I can use with a physical Ethernet connection rather than WiFi. WiFi can be a bit patchy at the installation location and I have tended to find that my projects using an Arduino Uno or Mega board with an Ethernet shield tend to be a lot more reliable.
The most flexible / suitable method of interfacing with Alexa for my needs appears to be through Sinric. The tutorial in the following YouTube video seemed to achieve what I needed, but again with ESP8266 (and not the Ethernet shield):
HOW TO MAKE HOME AUTOMATION- with SINRIC , IOT esp8266: alexa compatible/ IOT
So I downloaded the code and have been trying to modify it to omit the libraries used by the ESP8266 and #include libraries and modules needed by the Ethernet Shield / W5100 instead.
Attached is my code so far (I wanted to post into here, but it's too long).
However, I am getting the following error messages on compile:
Alexa_relays_with_Ethernet_Shield:252:3: error: 'webSocket' does not name a type
webSocket.begin("iot.sinric.com", 80, "/");
^~~~~~~~~
Alexa_relays_with_Ethernet_Shield:255:3: error: 'webSocket' does not name a type
webSocket.onEvent(webSocketEvent);
^~~~~~~~~
Alexa_relays_with_Ethernet_Shield:256:3: error: 'webSocket' does not name a type
webSocket.setAuthorization("apikey", MyApiKey);
^~~~~~~~~
Alexa_relays_with_Ethernet_Shield:259:3: error: 'webSocket' does not name a type
webSocket.setReconnectInterval(5000);
^~~~~~~~~
Alexa_relays_with_Ethernet_Shield:260:1: error: expected declaration before '}' token
}
^
exit status 1
'webSocket' does not name a type
Note I have commented out the //#include <WebSocketsClient_Generic.h> line because if I #include this I get the following error message also:
In file included from C:\Users\[USERNAME]\Documents\Arduino\libraries\WebSockets_Generic\src/WebSocketsClient_Generic.h:49:0,
from G:\My Documents\[USERNAME]\Arduino\2020\Alexa Project\Alexa_relays_with_Ethernet_Shield\Alexa_relays_with_Ethernet_Shield.ino:51:
C:\Users\[USERNAME]\Documents\Arduino\libraries\WebSockets_Generic\src/WebSockets_Generic.h:62:4: error: #error Version 2.x.x currently does not support Arduino with AVR since there is no support for std namespace of c++.
#error Version 2.x.x currently does not support Arduino with AVR since there is no support for std namespace of c++.
^~~~~
C:\Users\[USERNAME]\Documents\Arduino\libraries\WebSockets_Generic\src/WebSockets_Generic.h:63:4: error: #error Use Version 1.x.x. (ATmega branch)
#error Use Version 1.x.x. (ATmega branch)
^~~~~
exit status 1
Error compiling for board Arduino Uno.
Qualifier: I know I have #include of quite a few different WebSocket libraries, but this problem arose before I had included all of these. I resorted to including as many WebSocket libraries as possible to see if I could fix the problem, but to no avail.
Can somebody help me modify this code to achieve what I need....use the Ethernet shield rather than the ESP8266/ESP12 Wifi solution?
Thanks!!!!
Alexa_Sinric_with_Ethernet_Shield.ino (8.14 KB)