[Workaround] Bridge + local server + self signed Cert ?= javax.net.ssl.SSLException

Hi Everybody,

I have two ESP8266 chips that control household equipments. One Air cleaner and one humidifier.
Basic stuff, remote on-off, measuring humidify, work with some relays, your everyday examples.
They are working fine - or at least I don’t experience errors (besides the frequent ADC reading causing reboots, but that’s another story.)

Blynk library version is 0.4.3 and 0.4.6.

I have a NAS, that hosts a local blynk server (server-0.23.0.jar). I have self signed certs, they seem to be working.
server.properties
hardware.mqtt.port=8440
hardware.ssl.port=8441
hardware.default.port=8442
http.port=8180
ssl.websocket.port=8181
tcp.websocket.port=8182
https.port=9443
app.ssl.port=8443
server.ssl.cert=/PATH_to_BLYNK/blynk-server/ssl/server.crt
server.ssl.key=/PATH_to_BLYNK/blynk-server/ssl/server.pem
server.ssl.key.pass=pwd_used_during_creation

After overwriting the default fingerprint in my sketch I am able to connect to my local blynk server.

I tried the Bridge example provided in the docs, without luck. My device (device A, the control device)) keeps disconnecting from the network. Always reatenticates to Blynk local server.

I tried step-by-step adding the example code.

Seems that creating the bridge instance only does not cause any problems. e.g.:
WidgetBridge bridge1(V1);

Reconnects start to appear if I add this code:
const char blynkAuth_B[] = “3c71e13701e74cd09b6326xxxxxxxxxx”; //device B auth token

BLYNK_CONNECTED() {
bridge1.setAuthToken(blynkAuth_B); // Token of TherapyAir iOn PWC-570
}

I find these entries in blynk.log
2017-03-08 21:47:41.312 WARN - Hardware not logged. /192.168.5.54:25735. Closing.
2017-03-08 21:47:46.999 INFO - mailaddress+blynk@gmail.com hardware joined.
2017-03-08 21:47:57.004 WARN - Hardware not logged. /192.168.5.54:1729. Closing.
2017-03-08 21:48:02.659 INFO - mailaddress+blynk@gmail.com hardware joined.
2017-03-08 21:48:12.671 WARN - Hardware not logged. /192.168.5.54:6358. Closing.
2017-03-08 21:48:23.002 WARN - Unsecured connection attempt. Channel : /192.168.5.54:7199. Reason : javax.net.ssl.SSLException: Received close_notify during handshake
2017-03-08 21:48:28.023 WARN - Unsecured connection attempt. Channel : /192.168.5.54:27076. Reason : javax.net.ssl.SSLException: Received close_notify during handshake

192.168.5.54 is the IP of my router connecting to the Modem.
I am using a DynDNS address for connection. Even for local devices, so I assume that during connection they try to go ‘outside’ and connect to my local server through WAN. This address was used during the creation of the certs as well. So far my devices were working with it.

Anyhow, I think SSLExceptions as a not expected. Could you please suggest how to continue the investigation? Did I misconfigure the SSL connection?

Sorry, too many info in one topic :slight_smile:.

Means your hardware tries to send commands without being logged.

Hard to say what this. Look like it is related to browser but not to your hardware.

Please start from something simple. In complex system hard to detect exactly cause without knowing this system (your code and your setup in this particular case)

Hi!

Thank you for your time! I am out of ESPs right now. All I have are built in, so cannot start playing around.
I try to come back later if I am able to solve the problem.

For anybody who is looking for a solution I can recommend using webhooks.

In my case Device A wants to control Device B.

Device B has auth key: 1234bbbb
Device B has a button in the app sending ON/OFF requests to esp8266 on V6.

In the Android application of Device A create a Webhook on (e.g.) V20, with following content:

http://IP_of_local_Blynk_server:8180/1234bbbb/pin/V6
Method: PUT
Content: application/json
Body: ["/pin/"]

8180 is the http.port where the local Blynk server listens.

In code of Device A:
Blynk.virtualWrite(V20, 1); --> sends “1” to Device B
Blynk.virtualWrite(V20, 0); --> sends “0” to Device B