Closed Neu59 closed 4 months ago
... esp8266 I cannot get it to connect
Please describe this in more detail.
I don't know how to explain it in more detail. I load this code on an esp32 and it works ok, I load it on an esp8266 and it doesn't work. My question is why it doesn't work on ESP 8266?
Not clear whether can't connect to WiFi or SinricPro. Please enable detailed logs and post them here.
Add #define ENABLE_DEBUG to top of the logs
To enable ESP8266 SDK logs, in Arduino IDE: 2.1 Tools -> Debug Serial Port -> Serial 2.2 Tools -> Debug Level -> SSL + HTTP_CLIENT
ESP8266
...........scandone state: 0 -> 2 (b0) .state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 2 cnt
connected with TECNI-2G, channel 9 dhcp client start... ip:192.168.100.68,mask:255.255.255.0,gw:192.168.100.1 connected! [WiFi]: IP-Address is 192.168.100.68 [SinricPro]: Device "65c15942ccc93XXXXXXXXXXXX" does not exist. Creating new device [SinricPro:add()]: Adding device with id "65c15942ccc93539a133dfb5". SinricPro:Websocket: Connecting to WebSocket Server using SSL (ws.sinric.pro) [String] 'appkey:05d ... A:9F:A4:B6': Reallocating large String(148 -> 166 bytes) [String] 'appkey:05d ... rm:ESP8266': Reallocating large String(166 -> 184 bytes)
appkey:05dcfae4-816f-XXXXXXXXXXXXXXXXXXXXX deviceids:65c15942ccc9XXXXXXXXXXXXXXXXXXX restoredevicestates:false ip:192.168.100.68 mac:68:C6:3A:9F:A4:B6 platform:ESP8266 SDKVersion:3.0.1 [WS-Client] Websocket Version: 2.4.0 [WS-Client] connect wss... BSSL:_connectSSL: start connection BSSL:_wait_for_handshake: failed BSSL:Couldn't connect. Error = 'SSL received fatal alert - Decoding error: extraneous element.' [WS-Client] connection to ws.sinric.pro:443 Failed [WS-Client] client disconnected.
[WS-Client] connect wss...
ESP32
WiFi: IP-Address is 192.168.100.66 Connected to SinricPro
Loaded same code on both wifi devices.
Please share the info about
About the error you get:
BSSL:Couldn't connect. Error = 'SSL received fatal alert - Decoding error: extraneous element.'
Looks like your ESP8266 is running out of memory and does not have enough for handling the SSL connection.
Try disabling SSL by adding the line #define SINRICPRO_NOSSL
before the line #include <SinricPro.h>
and let us know the result.
Variables and constants in RAM (global, static), used 36372 / 80192 bytes (45%)
Variables and constants in RAM (global, static), used 36372 / 80192 bytes (45%)
Unfortunately, this information says nothing, as SSL requires dynamic memory which is allocated at runtime.
Ok, Arduino-Core is 3.1.2. Still missing info about the libraries versions and the result of #define SINRICPRO_NOSSL...
.............connected! [WiFi]: IP-Address is 192.168.100.31 Connected to SinricPro
That was the problem now if it connects
Problem is the lack of memory on ESP8266.
Since the ESP8266 is outdated i highly recommend to switch to the newer ESP32 or even better ESP32-S3.
yes of course esp32 is very good. Friend, I have another problem with the garage door. Maybe it has nothing to do with sinric pro but I'm stuck and I don't know what to do. When I give the voice command to open the garage, Google asks me for my PIN. I have changed the pin in my Google but it still says it is incorrect, can you help me with that?
You have to set the PIN for Google Home in SinricPro Dashboard:
OH how stupid I am, I'm sorry
Hello, I am trying to activate a relay with the example, with esp32 it works ok but with esp8266 I cannot get it to connect.
include
if defined(ESP8266)
include
elif defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
include
endif
include "SinricPro.h"
include "SinricProSwitch.h"
define ENABLE_DEBUG
define WIFI_SSID "xxxxxxxxx" // Change WIFI_SSID to your WiFi Name.
define WIFI_PASS "xxxxxxxxxxxxx" // Change WIFI_PASS to your WiFi password.
define APP_KEY "05dcfae4-816f-4b6b-a49b-xxxxxxxxxxxxxx" // Paste App Key from above
define APP_SECRET "17db51bd-5240-43a4-960a-d2e9b4dd9bba-1c678008-f5fd-4264-xxxxxxxxxxxxxxxxx" // Paste App Secret from above
define SWITCH_ID_1 "65c15942cccxxxxxxxxxxxxxxxxxxxxxx" // Paste Device Id from above
if defined(ESP8266)
define RELAYPIN_1 12
elif defined(ESP32)
define RELAYPIN_1 16
elif (ARDUINO_ARCH_RP2040)
define RELAYPIN_1 6
endif
define BAUD_RATE 115200 // Change baudrate to your need
bool onPowerState1(const String &deviceId, bool &state) { Serial.printf("Device 1 turned %s", state?"on":"off"); digitalWrite(RELAYPIN_1, state ? HIGH:LOW);
/ If your relay is activated with low signal, change the above to below code digitalWrite(RELAYPIN_1, state ? LOW : HIGH); /
return true; // request handled properly }
// setup function for WiFi connection void setupWiFi() { Serial.printf("\r\n[Wifi]: Connecting");
if defined(ESP8266)
elif defined(ESP32)
endif
WiFi.begin(WIFI_SSID, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED) { Serial.printf("."); delay(250); }
Serial.printf("connected!\r\n[WiFi]: IP-Address is %s\r\n", WiFi.localIP().toString().c_str()); }
// setup function for SinricPro void setupSinricPro() { // add devices and callbacks to SinricPro pinMode(RELAYPIN_1, OUTPUT);
SinricProSwitch& mySwitch1 = SinricPro[SWITCH_ID_1]; mySwitch1.onPowerState(onPowerState1);
// setup SinricPro SinricPro.onConnected([](){ Serial.printf("Connected to SinricPro\r\n"); }); SinricPro.onDisconnected([](){ Serial.printf("Disconnected from SinricPro\r\n"); });
SinricPro.begin(APP_KEY, APP_SECRET); }
// main setup function void setup() { Serial.begin(BAUD_RATE); Serial.printf("\r\n\r\n"); setupWiFi(); setupSinricPro(); }
void loop() { SinricPro.handle(); }