Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major update #25

Merged
merged 14 commits into from
Feb 7, 2023
Merged

Major update #25

merged 14 commits into from
Feb 7, 2023

Conversation

oxan
Copy link
Owner

@oxan oxan commented Feb 3, 2023

  • Port to ESPHome's (once) new socket abstraction. This adds support for ESP-IDF, reduces code complexity and probably also increases reliability given the quality of the Arduino libraries.
  • Add IPv6 support.
  • Buffer incoming data from the serial port, and send it out separately to each client. Functionally this is more or less equivalent to Buffer send_buf for high throughput #4, but with proper handling for multiple clients.
  • Add binary sensor that indicates whether a client is connected; based on Add binary_sensor #15 but refactored to not publish a state on every loop().
  • Add sensor that indicates the number of connected clients.

Still needs some more testing (especially w.r.t. reliability), but should be complete code-wise.

// Only warn on the first iteration, the finite buffer size is also used as a throttling mechanism to avoid
// blocking here for too long when a large amount of data comes in.
if (first_iteration)
ESP_LOGW(TAG, "Incoming bytes available in stream, but outgoing buffer is full!");
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably overwrite data instead of dropping data: if there are multiple clients, that means only the straggler will have problems, instead of all clients. It also prevents the possibility of lockups.

@oxan
Copy link
Owner Author

oxan commented Feb 3, 2023

Also needs a documentation update, and a declaration of the minimum required ESPHome version.

@oxan oxan marked this pull request as ready for review February 7, 2023 21:08
@oxan oxan merged commit 487d02f into master Feb 7, 2023
@oxan oxan deleted the socket-abstraction branch February 7, 2023 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant