Ability to remove listeners in UDP #3487
-
Component nameudp Link to component documentation on our websitehttps://esphome.io/components/udp/ Describe the enhancementReverse method for any of the below would do this trick. void set_should_listen() { this->should_listen_ = true; }
void add_listener(std::function<void(std::vector<uint8_t> &)> &&listener) {
this->packet_listeners_.add(std::move(listener));
}Use casesI am using udp compoenent to listen for DDP packet in an effect but when i stop the effect there should be an option to unlisten to save extra function calls when effect is not active but ddp packets are being sent from the ddp server. Anything else?Minimal Code: esphome/esphome@dev...tanishqmanuja:esphome:poc/ddp |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
|
🏷️ I've automatically added the |
Beta Was this translation helpful? Give feedback.
-
|
Sure thing, wanna raise a PR? |
Beta Was this translation helpful? Give feedback.
-
|
I made the changes in a related PR so set_should_listen() takes a bool. It should do what you want. |
Beta Was this translation helpful? Give feedback.
-
|
It will move to a different PR at some point, and then eventually get merged, but you can keep using it with the referenced PR as an external component for now. |
Beta Was this translation helpful? Give feedback.
I made the changes in a related PR so set_should_listen() takes a bool. It should do what you want.
esphome/esphome#13537