44 lines
1.0 KiB
C
Raw Permalink Normal View History

2023-06-09 17:36:56 -05:00
#pragma once
#include "../ratgdo.h"
#include "../ratgdo_state.h"
#include "esphome/components/sensor/sensor.h"
#include "esphome/core/component.h"
2024-10-28 13:56:16 -04:00
#ifdef USE_DISTANCE
#include "Wire.h"
#include "vl53l4cx_class.h"
#define I2C Wire
2024-10-28 13:56:16 -04:00
#endif
2023-06-09 17:36:56 -05:00
namespace esphome {
namespace ratgdo {
2023-06-09 17:38:30 -05:00
enum RATGDOSensorType {
RATGDO_OPENINGS,
RATGDO_PAIRED_DEVICES_TOTAL,
RATGDO_PAIRED_REMOTES,
RATGDO_PAIRED_KEYPADS,
RATGDO_PAIRED_WALL_CONTROLS,
2024-10-28 13:56:16 -04:00
RATGDO_PAIRED_ACCESSORIES,
RATGDO_DISTANCE
2023-06-09 17:36:56 -05:00
};
class RATGDOSensor : public sensor::Sensor, public RATGDOClient, public Component {
public:
void dump_config() override;
void setup() override;
2024-10-28 13:56:16 -04:00
void loop() override;
2023-06-09 17:44:16 -05:00
void set_ratgdo_sensor_type(RATGDOSensorType ratgdo_sensor_type_) { this->ratgdo_sensor_type_ = ratgdo_sensor_type_; }
2023-06-09 17:36:56 -05:00
protected:
2023-06-09 17:40:08 -05:00
RATGDOSensorType ratgdo_sensor_type_;
2024-10-28 13:56:16 -04:00
#ifdef USE_DISTANCE
VL53L4CX distance_sensor_;
#endif
2023-06-09 17:36:56 -05:00
};
} // namespace ratgdo
} // namespace esphome