ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
e131.h
Go to the documentation of this file.
1#pragma once
3#ifdef USE_NETWORK
6
7#include <cinttypes>
8#include <memory>
9#include <vector>
10
11namespace esphome::e131 {
12
13class E131AddressableLightEffect;
14
16
18
23
25 uint16_t universe;
26 uint16_t consumers;
27};
28
29class E131Component final : public esphome::Component {
30 public:
33
34 void setup() override;
35 void loop() override;
36 float get_setup_priority() const override { return setup_priority::AFTER_WIFI; }
37
38 void add_effect(E131AddressableLightEffect *light_effect);
39 void remove_effect(E131AddressableLightEffect *light_effect);
40
41 void set_method(E131ListenMethod listen_method) { this->listen_method_ = listen_method; }
42
43 protected:
44 bool packet_(const uint8_t *data, size_t len, int &universe, E131Packet &packet);
45 bool process_(int universe, const E131Packet &packet);
46 void join_igmp_groups_();
47 void join_universe_(uint16_t universe);
49 void join_(int universe);
50 void leave_(int universe);
51
53 bool igmp_join_pending_{false};
54 std::unique_ptr<socket::UDPSocket> socket_;
55 std::vector<E131AddressableLightEffect *> light_effects_;
56 std::vector<UniverseConsumer> universe_consumers_;
57};
58
59} // namespace esphome::e131
60
61#endif
std::vector< E131AddressableLightEffect * > light_effects_
Definition e131.h:55
void loop() override
Definition e131.cpp:62
void join_universe_(uint16_t universe)
void add_effect(E131AddressableLightEffect *light_effect)
Definition e131.cpp:85
E131ListenMethod listen_method_
Definition e131.h:52
void remove_effect(E131AddressableLightEffect *light_effect)
Definition e131.cpp:101
bool packet_(const uint8_t *data, size_t len, int &universe, E131Packet &packet)
std::unique_ptr< socket::UDPSocket > socket_
Definition e131.h:54
bool process_(int universe, const E131Packet &packet)
Definition e131.cpp:120
void setup() override
Definition e131.cpp:22
UniverseConsumer * find_universe_(int universe)
std::vector< UniverseConsumer > universe_consumers_
Definition e131.h:56
void set_method(E131ListenMethod listen_method)
Definition e131.h:41
float get_setup_priority() const override
Definition e131.h:36
uint16_t universe
const int E131_MAX_PROPERTY_VALUES_COUNT
Definition e131.h:17
E131ListenMethod
Definition e131.h:15
@ E131_UNICAST
Definition e131.h:15
@ E131_MULTICAST
Definition e131.h:15
constexpr float AFTER_WIFI
For components that should be initialized after WiFi is connected.
Definition component.h:55
const void size_t len
Definition hal.h:68
uint8_t values[E131_MAX_PROPERTY_VALUES_COUNT]
Definition e131.h:21