esphome-ratgdo/components/ratgdo/binary_sensor/ratgdo_binary_sensor.h

33 lines
891 B
C
Raw Normal View History

2023-06-07 15:37:51 +00:00
#pragma once
2023-06-07 16:41:02 +00:00
#include "../ratgdo.h"
2023-06-07 15:37:51 +00:00
#include "../ratgdo_state.h"
#include "esphome/components/binary_sensor/binary_sensor.h"
2023-06-07 16:41:02 +00:00
#include "esphome/core/component.h"
2023-06-07 15:37:51 +00:00
namespace esphome {
namespace ratgdo {
2023-06-07 16:41:02 +00:00
enum SensorType {
RATGDO_SENSOR_MOTION,
RATGDO_SENSOR_OBSTRUCTION,
2023-06-09 23:07:26 +00:00
RATGDO_SENSOR_MOTOR,
2024-10-28 17:56:16 +00:00
RATGDO_SENSOR_BUTTON,
RATGDO_SENSOR_VEHICLE_DETECTED,
RATGDO_SENSOR_VEHICLE_ARRIVING,
RATGDO_SENSOR_VEHICLE_LEAVING,
2023-06-07 16:41:02 +00:00
};
2023-06-07 15:37:51 +00:00
2023-06-07 16:41:02 +00:00
class RATGDOBinarySensor : public binary_sensor::BinarySensor, public RATGDOClient, public Component {
public:
2023-06-07 22:25:14 +00:00
void setup() override;
2023-06-07 16:41:02 +00:00
void dump_config() override;
void set_binary_sensor_type(SensorType binary_sensor_type) { this->binary_sensor_type_ = binary_sensor_type; }
2023-06-07 16:31:02 +00:00
2023-06-07 16:41:02 +00:00
protected:
2023-06-07 19:48:20 +00:00
SensorType binary_sensor_type_;
2023-06-07 16:41:02 +00:00
};
2023-06-07 15:37:51 +00:00
2023-06-07 16:41:02 +00:00
} // namespace ratgdo
} // namespace esphome