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:43:58 +00:00
|
|
|
#include "../ratgdo_child.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-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:
|
|
|
|
void dump_config() override;
|
2023-06-07 19:49:22 +00:00
|
|
|
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 19:11:03 +00:00
|
|
|
void on_motion_state(MotionState state) override;
|
|
|
|
void on_obstruction_state(ObstructionState state) override;
|
|
|
|
void on_door_state(DoorState state) override;
|
|
|
|
void on_light_state(LightState state) override;
|
|
|
|
void on_lock_state(LockState state) override;
|
2023-06-07 15:37:51 +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
|