34 lines
1012 B
C
Raw Normal View History

2023-06-07 10:37:51 -05:00
#pragma once
2023-06-07 11:41:02 -05:00
#include "../ratgdo.h"
2023-06-07 10:43:58 -05:00
#include "../ratgdo_child.h"
2023-06-07 10:37:51 -05:00
#include "../ratgdo_state.h"
#include "esphome/components/binary_sensor/binary_sensor.h"
2023-06-07 11:41:02 -05:00
#include "esphome/core/component.h"
2023-06-07 10:37:51 -05:00
namespace esphome {
namespace ratgdo {
2023-06-07 11:41:02 -05:00
enum SensorType {
RATGDO_SENSOR_MOTION,
RATGDO_SENSOR_OBSTRUCTION,
};
2023-06-07 10:37:51 -05:00
2023-06-07 11:41:02 -05:00
class RATGDOBinarySensor : public binary_sensor::BinarySensor, public RATGDOClient, public Component {
public:
void dump_config() override;
void set_type(SensorType type) { type_ = type_; }
2023-06-07 11:31:02 -05:00
2023-06-07 11:41:02 -05:00
void on_motion_state(esphome::ratgdo::MotionState state) override;
void on_obstruction_state(esphome::ratgdo::ObstructionState state) override;
2023-06-07 11:41:25 -05:00
void on_door_state(esphome::ratgdo::DoorState state) override;
void on_light_state(esphome::ratgdo::LightState state) override;
void on_lock_state(esphome::ratgdo::LockState state) override;
2023-06-07 10:37:51 -05:00
2023-06-07 11:41:02 -05:00
protected:
SensorType type_;
};
2023-06-07 10:37:51 -05:00
2023-06-07 11:41:02 -05:00
} // namespace ratgdo
} // namespace esphome