Comments (4)
This value needs to be considered.
The original value in esp-homekit library based on esp-open-rtos is 16. But in Arduino, there is an internal limitation of max TCP connection, which is 5 default. Refer to MEMP_NUM_TCP_PCB(5) and espconn_tcp_set_max_con. So setting HOMEKIT_MAX_CLIENTS to 8 maybe useless here, and I don't have so many iOS devices to test.
Anther thing is that one tcp connection requests aroud 2k heap memory in my test and free heap of esp8266 is around 40k.
from arduino-homekit-esp8266.
It looks like MEMP_NUM_TCP_PCB is set to 5 in lwip2, but in lwip, which seems to be what is being used, it's doing this to read it from a register (which I don't understand):
/**
* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
* (requires the LWIP_TCP option)
*/
#ifndef MEMP_NUM_TCP_PCB
#define MEMP_NUM_TCP_PCB (*(volatile uint32*)0x600011FC)
#endif
Also, if I simply increase HOMEKIT_MAX_CLIENTS in arduino_homekit_server.cpp to, say, 15, I'm able to get more clients connected (I've managed up to 12). So we seem to be able to get more connections than lwip is set to allow (which I don't understand). If lwip is zeroing out and re-using the older connections, then HomeKit clients handle that rather gracefully… client devices don't seem to care.
It occurs to me that using espconn_tcp_get_max_con to retrieve the maximum value from the sdk, rather than setting it manually, might be an approach to consider. All it appears to do is just return MEMP_NUM_TCP_PCB after all.
On the other hand, if it works just to set a higher number of max clients and let HomeKit recover from dropped connections on the client side, maybe that's just fine.
Increasing connections does reduce available heap.
In any case, there is a lot here I don't understand!
from arduino-homekit-esp8266.
I wrote this number 8 at random when I wrote this library. Anyway it depends on your real project and what you really need, and there is no best value to be written in a library. You can increase it or reduce it by modifying the source code. Also I do think ESP8266 is not so powerful to hold so many clients (not only HomeKit clients if you use http, webserver, websockets together).
from arduino-homekit-esp8266.
Indeed. Lower numbers seem to be more stable but do seem to lead to more "Updating…" and "Not responding" delays in the Home app. Higher numbers seem to improve the experience in the Home app but seem to lead to resets on the ESP.
For now I guess the best value is for the implementer to determine. Thank you!
from arduino-homekit-esp8266.
Related Issues (20)
- Is there a relay wiring diagram for the ESP-01? HOT 1
- Issue with EEPROM definitions? HOT 2
- EEPROM on ESP8266 will be restore after arduino_homekit_setup HOT 3
- LDR Light Sensor HOT 4
- Sensors looses Connection HOT 9
- HAPStatus call anyone
- New architecture HOT 3
- Compatibility issue with ios 16.6 HOT 5
- Use Homekit-ESP8266 to control a stepper driver. HOT 3
- Loosing accessories with iOS 16.7 and powerloss HOT 12
- Accesorry not showing up in the home app HOT 2
- Lock Management Auto Security Timeout
- hiding accessories HOT 6
- Disconnect on pair setup step 3/3 HOT 6
- Can't find device in HomeApp
- Gives code -2 HOT 1
- esp8266 [ Error compiling for board NodeMCU 1.0 (ESP-12E Module).] issue
- Implement temperature, humidity and 2 switches and oled 0.96 to monitor the sensors. HOT 5
- Accessories not respond
- Sensor Pin
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-homekit-esp8266.