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:
committed by
GitHub
parent
5e1019a6fa
commit
40823df7bc
@@ -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
|
||||||
|
Reference in New Issue
Block a user