So I have the device-discovery etc. part working, and ESPlorer shows Konnected trying to send updates when my sensors change - but the updates aren't "received" by HomeAssistant. My HA setup is TLS-enabled (using the DuckDNS addon) Doing a packet capture in the docker-container running HA, and filtering for the IP of the first Konnected device - I can see the TCP connection establish, and the SSL connection proceeds as expected:
=> Client Hello <= Server Hello <= Certificate, Server Key Exchange, Server Hello Done
And then, Konnected/NodeMCU's TLS implementation returns the following 'Decrypt Error' on the wire
Secure Sockets Layer TLSv1.2 Record Layer: Alert (Level: Fatal, Description: Decrypt Error) Content Type: Alert (21) Version: TLS 1.2 (0x0303) Length: 2 Alert Message Level: Fatal (2) Description: Decrypt Error (51)
I can obviously connect to HA using TLS from multiple browsers, and from the Linux 'openssl' command-line client. The relevant logs from the NodeMCU device are:
HTTP client: Disconnected with error: 46 HTTP client: Connection timeout Heap:33472 HTTP Call: -1 state 1 pin 2 E:M 528 HTTP client: Disconnected with error: 46 HTTP client: Connection timeout Heap:33288 HTTP Call: -1 state 0 pin 2 E:M 528 HTTP client: Disconnected with error: 46 HTTP client: Connection timeout Heap:33288HTTP Call:-1state1pin2
Any hints as to where to go next - I do know some lua, but I couldn't see if the Konnected scripts had any way to interrupt the boot process.
So I did some more poking at this - I couldn't get consistent behaviour from Konnected when it tried to talk HTTPS to HA. Sometimes it worked, sometimes not, often toggling withing the same boot/NodeMCU build-variation etc.
I've switched HA to HTTP, and put an NGINX reverse proxy in front of it to serve SSL to the outside world for now, until Nate or someone can figure out the stability here.
Here's a sample of my SDK-2.2.1 based build (nodeMCU dev branch), sometimes working - sometimes not...
Build with 5120 SSL BUF and 2.2.1(NodeMCU-dev)
I *think* it has to do with the available heap - the failures all /seem/ to happen when it drops below 35K - but I don't have enough data to be 100% sure on that - just a hunch. I also need to get a switch for my test-rig - pulling a jumper lead off/on is getting tiresome ;-)
Is there any update on a fix for this? Essentially my konnected alarm doesn't work!
@HassCr - Yes, you can use the GPIO on RPi to achieve the same end result - See the HA documentation here regarding GPIO Binary Sensor and GPIO Switch.
I also am using HA behind a reverse proxy as I eventually found the same problem with using SSL.
I think the underlying issue is how NodeMCU handles SSL so I don't think there will be a fix for Konnected until it gets addressed by the NodeMCU main branch....
@HassCr - I don't think that thread is related to the SSL problem.