1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-23 04:03:52 +01:00

make types sensors_t and sensor_type_t internal to StatsdComponent. (#11345)

This commit is contained in:
Juan Antonio Aldea
2025-10-19 19:47:31 +02:00
committed by GitHub
parent 5e1019a6fa
commit 40823df7bc

View File

@@ -28,21 +28,6 @@
namespace esphome { namespace esphome {
namespace statsd { namespace statsd {
using sensor_type_t = enum { TYPE_SENSOR, TYPE_BINARY_SENSOR };
using sensors_t = struct {
const char *name;
sensor_type_t type;
union {
#ifdef USE_SENSOR
esphome::sensor::Sensor *sensor;
#endif
#ifdef USE_BINARY_SENSOR
esphome::binary_sensor::BinarySensor *binary_sensor;
#endif
};
};
class StatsdComponent : public PollingComponent { class StatsdComponent : public PollingComponent {
public: public:
~StatsdComponent(); ~StatsdComponent();
@@ -71,6 +56,20 @@ class StatsdComponent : public PollingComponent {
const char *prefix_; const char *prefix_;
uint16_t port_; uint16_t port_;
using sensor_type_t = enum { TYPE_SENSOR, TYPE_BINARY_SENSOR };
using sensors_t = struct {
const char *name;
sensor_type_t type;
union {
#ifdef USE_SENSOR
esphome::sensor::Sensor *sensor;
#endif
#ifdef USE_BINARY_SENSOR
esphome::binary_sensor::BinarySensor *binary_sensor;
#endif
};
};
std::vector<sensors_t> sensors_; std::vector<sensors_t> sensors_;
#ifdef USE_ESP8266 #ifdef USE_ESP8266