light
This commit is contained in:
parent
8fd2b3e443
commit
dcc30bac72
|
@ -19,11 +19,11 @@ namespace ratgdo {
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
void set_type(SensorType type) { type_ = type_; }
|
void set_type(SensorType type) { type_ = type_; }
|
||||||
|
|
||||||
void on_motion_state(esphome::ratgdo::MotionState state) override;
|
void on_motion_state(MotionState state) override;
|
||||||
void on_obstruction_state(esphome::ratgdo::ObstructionState state) override;
|
void on_obstruction_state(ObstructionState state) override;
|
||||||
void on_door_state(esphome::ratgdo::DoorState state) override;
|
void on_door_state(DoorState state) override;
|
||||||
void on_light_state(esphome::ratgdo::LightState state) override;
|
void on_light_state(LightState state) override;
|
||||||
void on_lock_state(esphome::ratgdo::LockState state) override;
|
void on_lock_state(LockState state) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SensorType type_;
|
SensorType type_;
|
||||||
|
|
|
@ -13,26 +13,26 @@ namespace ratgdo {
|
||||||
{
|
{
|
||||||
LOG_COVER("", "RATGDO Cover", this);
|
LOG_COVER("", "RATGDO Cover", this);
|
||||||
}
|
}
|
||||||
void RATGDOCover::on_motion_state(esphome::ratgdo::MotionState state) { }
|
void RATGDOCover::on_motion_state(MotionState state) { }
|
||||||
void RATGDOCover::on_obstruction_state(esphome::ratgdo::ObstructionState state) { }
|
void RATGDOCover::on_obstruction_state(ObstructionState state) { }
|
||||||
void RATGDOCover::on_door_state(esphome::ratgdo::DoorState state)
|
void RATGDOCover::on_door_state(DoorState state)
|
||||||
{
|
{
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case esphome::ratgdo::DoorState::DOOR_STATE_OPEN:
|
case DoorState::DOOR_STATE_OPEN:
|
||||||
this->position = COVER_OPEN;
|
this->position = COVER_OPEN;
|
||||||
this->current_operation = COVER_OPERATION_IDLE;
|
this->current_operation = COVER_OPERATION_IDLE;
|
||||||
break;
|
break;
|
||||||
case esphome::ratgdo::DoorState::DOOR_STATE_CLOSED:
|
case DoorState::DOOR_STATE_CLOSED:
|
||||||
this->position = COVER_CLOSED;
|
this->position = COVER_CLOSED;
|
||||||
this->current_operation = COVER_OPERATION_IDLE;
|
this->current_operation = COVER_OPERATION_IDLE;
|
||||||
break;
|
break;
|
||||||
case esphome::ratgdo::DoorState::DOOR_STATE_OPENING:
|
case DoorState::DOOR_STATE_OPENING:
|
||||||
this->current_operation = COVER_OPERATION_OPENING;
|
this->current_operation = COVER_OPERATION_OPENING;
|
||||||
break;
|
break;
|
||||||
case esphome::ratgdo::DoorState::DOOR_STATE_CLOSING:
|
case DoorState::DOOR_STATE_CLOSING:
|
||||||
this->current_operation = COVER_OPERATION_CLOSING;
|
this->current_operation = COVER_OPERATION_CLOSING;
|
||||||
break;
|
break;
|
||||||
case esphome::ratgdo::DoorState::DOOR_STATE_STOPPED:
|
case DoorState::DOOR_STATE_STOPPED:
|
||||||
default:
|
default:
|
||||||
this->current_operation = COVER_OPERATION_IDLE;
|
this->current_operation = COVER_OPERATION_IDLE;
|
||||||
|
|
||||||
|
@ -41,8 +41,8 @@ namespace ratgdo {
|
||||||
|
|
||||||
this->publish_state();
|
this->publish_state();
|
||||||
}
|
}
|
||||||
void RATGDOCover::on_light_state(esphome::ratgdo::LightState state) { }
|
void RATGDOCover::on_light_state(LightState state) { }
|
||||||
void RATGDOCover::on_lock_state(esphome::ratgdo::LockState state) { }
|
void RATGDOCover::on_lock_state(LockState state) { }
|
||||||
|
|
||||||
CoverTraits RATGDOCover::get_traits()
|
CoverTraits RATGDOCover::get_traits()
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,11 +14,11 @@ namespace ratgdo {
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
cover::CoverTraits get_traits() override;
|
cover::CoverTraits get_traits() override;
|
||||||
|
|
||||||
void on_motion_state(esphome::ratgdo::MotionState state) override;
|
void on_motion_state(MotionState state) override;
|
||||||
void on_obstruction_state(esphome::ratgdo::ObstructionState state) override;
|
void on_obstruction_state(ObstructionState state) override;
|
||||||
void on_door_state(esphome::ratgdo::DoorState state) override;
|
void on_door_state(DoorState state) override;
|
||||||
void on_light_state(esphome::ratgdo::LightState state) override;
|
void on_light_state(LightState state) override;
|
||||||
void on_lock_state(esphome::ratgdo::LockState state) override;
|
void on_lock_state(LockState state) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void control(const cover::CoverCall& call) override;
|
void control(const cover::CoverCall& call) override;
|
||||||
|
|
|
@ -13,11 +13,11 @@ namespace ratgdo {
|
||||||
{
|
{
|
||||||
ESP_LOGCONFIG("", "RATGDO Light");
|
ESP_LOGCONFIG("", "RATGDO Light");
|
||||||
}
|
}
|
||||||
void RATGDOLightOutput::on_motion_state(esphome::ratgdo::MotionState state) { }
|
void RATGDOLightOutput::on_motion_state(MotionState state) { }
|
||||||
void RATGDOLightOutput::on_obstruction_state(esphome::ratgdo::ObstructionState state) { }
|
void RATGDOLightOutput::on_obstruction_state(ObstructionState state) { }
|
||||||
void RATGDOLightOutput::on_door_state(esphome::ratgdo::DoorState state) { }
|
void RATGDOLightOutput::on_door_state(DoorState state) { }
|
||||||
void RATGDOLightOutput::on_light_state(esphome::ratgdo::LightState state) { }
|
void RATGDOLightOutput::on_light_state(LightState state) { }
|
||||||
void RATGDOLightOutput::on_lock_state(esphome::ratgdo::LockState state) { }
|
void RATGDOLightOutput::on_lock_state(LockState state) { }
|
||||||
|
|
||||||
LightTraits RATGDOLightOutput::get_traits()
|
LightTraits RATGDOLightOutput::get_traits()
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,11 +17,11 @@ namespace ratgdo {
|
||||||
void setup_state(light::LightState* state) override { this->state_ = state; }
|
void setup_state(light::LightState* state) override { this->state_ = state; }
|
||||||
light::LightState* get_state() { return this->state_; }
|
light::LightState* get_state() { return this->state_; }
|
||||||
|
|
||||||
void on_motion_state(esphome::ratgdo::MotionState state) override;
|
void on_motion_state(MotionState state) override;
|
||||||
void on_obstruction_state(esphome::ratgdo::ObstructionState state) override;
|
void on_obstruction_state(ObstructionState state) override;
|
||||||
void on_door_state(esphome::ratgdo::DoorState state) override;
|
void on_door_state(DoorState state) override;
|
||||||
void on_light_state(esphome::ratgdo::LightState state) override;
|
void on_light_state(LightState state) override;
|
||||||
void on_lock_state(esphome::ratgdo::LockState state) override;
|
void on_lock_state(LockState state) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool _is_on;
|
bool _is_on;
|
||||||
|
|
Loading…
Reference in New Issue