maximkulkin / esp-homekit

Apple HomeKit accessory server library for ESP-OPEN-RTOS
MIT License
1.11k stars 170 forks source link

Error reading data from socket when 2 characteristics are being sent by a controller #19

Closed renssies closed 6 years ago

renssies commented 6 years ago

I'm building a fan controller for a 3-speed fan, this controller will use custom values for format, unit, min_value, max_value and min_step on the rotation speed characteristic.

However, I often get Error reading data from socket (code 104) when using the Apple Home app to control the fan. It closes the client connection and as soon as the client reconnects it sends the characteristics again which works fine, but after changing the slider again there is a chance the error is thrown again.

I think this has something to do with the home app writing both the Active and Rotation Speed characteristic for every change of the slider. If I use Elgato eve or Matthias his Home app and change just one characteristic it works without throwing the error.

My code for the fan controller can be found here: https://github.com/renssies/esp-homekit-demo/tree/3_speed_fan

I've tested this on 2 Wemos D1 Mini boards with 4MB of flash and an ESP12E. Both give the same issue. I've also tested this with and without the socket timeout change, the published code is without the removal of the socket timeout.

maximkulkin commented 6 years ago

Should be fixed in latest master