Comments (6)
@Mixiaoxiao thanks for looking into this! After rebooting my router 700 times, I managed to solve the issue by assigning a static IP address to my ESP32. I've removed the static assignment to test this fix and it seems to be working. I'll report if I notice a crash!
Off topic but I just wanted to add that I'm also working on an Arduino version of this SDK and it's currently available via PlatformIO. 😄
from esp-homekit-sdk.
Thanks for your quick replay.
It is ok to modify by yourself, following the sdk's code style.
I consider it will be nice to make a comment in your modification with a link of this issuse analysis, if it is possible.
Also, I sugest the function names:
- change
hap_close_ctrl_sessions (ctrl)
tohap_close_sessions_of_ctrl (ctrl)
- create a new
hap_close_session (session)
to close a certain session (irrelevant withctrl
) - the name of
hap_decrypt_error
may be not suitable here, since it is caused by a connection lost in most cases
from esp-homekit-sdk.
Hopefully this helps someone in the future, but I was receiving this error after assigning a value that was out of range for a characteristic that can only accept values of 0-100. I was using the provided hap_char_hue_create
fxn to set the lightbulb hue but didn't see that within that fxn there's a hap_char_float_set_constraints
fxn that shows that this specific characteristic has a lower bound of 0 and an upper of 360. It would be nice to be warned when passing a value that falls outside of characteristic ranges but it was pretty obvious after a minute of following the function calls.
from esp-homekit-sdk.
@Mixiaoxiao thanks for the detailed analysis. Rightly said, the below snippet indeed seems wrong and a root cause for the issues reported.
for (i = 0; i < HAP_MAX_SESSIONS; i++) {
if (!hap_priv.sessions[i])
continue;
if (hap_priv.sessions[i]->ctrl == ctrl) {
httpd_sess_trigger_close(hap_priv.server, hap_priv.sessions[i]->conn_identifier);
}
}
I have verified with your fix and it works as intended.
The changes in the check for return value of read_fn() may not be required though, since the code is normally supposed to reach here, only when the select call in http_server returns and the particular socket descriptor is ready to be read. Even if we return 0 from here, the http server code will close the session assuming that the peer has closed the connection.
Do you plan to raise a PR for these fixes, or should I add them myself? In my code, I have renamed hap_close_ctrl_sessions
to hap_ctrl_close_all_sessions
and added a new hap_ctrl_close_single_session
as per the code you shared. I will also add a config option for keepalive, which will be enabled automatically for non MFi HomeKit applications.
Meanwhile, thanks for your efforts for the Arduino support :)
from esp-homekit-sdk.
@Mixiaoxiao , the specific fix and the keep alive config option have now been added. Thanks for debugging and the finding root cause of the issue.
from esp-homekit-sdk.
Off topic but I just wanted to add that I'm also working on an Arduino version of this SDK and it's currently available via PlatformIO. 😄
@Brawrdon that's good to know. Thanks for your efforts :)
from esp-homekit-sdk.
Related Issues (20)
- How to cleanly add or remove accessories ? (bridge) HOT 2
- HTTPD init error HOT 2
- ESP8266无法使用
- Accessory Not Found HOT 6
- Update examples CMakeLists.txt
- hap_platform_httpd_start failing HOT 1
- Is it possible to remove nvs? HOT 2
- More than 1 accessory support without using bridge HOT 6
- How to change Homekit TCP port? HOT 2
- esp-homekit-sdk network allocation HOT 2
- Lightbulb: save status on flash HOT 3
- Change serial number without re-build source code HOT 2
- Is it possible to return the device status outside the hap_serv_set_write_cb callback function? HOT 3
- idf.py menuconfig fails for aws-iot example
- Mfi license HOT 5
- homekit bridge Decryption error/Connection lost HOT 2
- Problem with some services and features HOT 5
- httpd_start() don't start, has problem with create stack ESP32-S3 SPIRAM 8MB (IDFGH-13325) HOT 3
- Accessories stuck in 'opening' or 'closing' states
- Service button ?
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 esp-homekit-sdk.