binary sensor
This commit is contained in:
parent
44919dadcc
commit
522e90f430
|
@ -1,6 +1,6 @@
|
||||||
|
#include "ratgdo_cover.h"
|
||||||
#include "../ratgdo_state.h"
|
#include "../ratgdo_state.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "ratgdo_cover.h"
|
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace ratgdo {
|
namespace ratgdo {
|
||||||
|
@ -17,16 +17,23 @@ namespace ratgdo {
|
||||||
void RATGDOCover::on_obstruction_state(esphome::ratgdo::ObstructionState state) { }
|
void RATGDOCover::on_obstruction_state(esphome::ratgdo::ObstructionState state) { }
|
||||||
void RATGDOCover::on_door_state(esphome::ratgdo::DoorState state)
|
void RATGDOCover::on_door_state(esphome::ratgdo::DoorState state)
|
||||||
{
|
{
|
||||||
|
switch (state) {
|
||||||
if (state == esphome::ratgdo::DoorState::DOOR_STATE_OPEN)
|
case esphome::ratgdo::DoorState::DOOR_STATE_OPEN:
|
||||||
this->position = COVER_OPEN;
|
this->position = COVER_OPEN;
|
||||||
this->current_operation = COVER_OPERATION_IDLE;
|
this->current_operation = COVER_OPERATION_IDLE;
|
||||||
else if (state == esphome::ratgdo::DoorState::DOOR_STATE_CLOSED) this->position = COVER_CLOSED;
|
case esphome::ratgdo::DoorState::DOOR_STATE_CLOSED:
|
||||||
this->current_operation = COVER_OPERATION_IDLE;
|
this->position = COVER_CLOSED;
|
||||||
else if (state == esphome::ratgdo::DoorState::DOOR_STATE_OPENING) this->current_operation = COVER_OPERATION_OPENING;
|
this->current_operation = COVER_OPERATION_IDLE;
|
||||||
else if (state == esphome::ratgdo::DoorState::DOOR_STATE_CLOSING) this->current_operation = COVER_OPERATION_CLOSING;
|
case esphome::ratgdo::DoorState::DOOR_STATE_OPENING:
|
||||||
else if (state == esphome::ratgdo::DoorState::DOOR_STATE_STOPPED) this->current_operation = COVER_OPERATION_IDLE;
|
this->current_operation = COVER_OPERATION_OPENING;
|
||||||
else this->current_operation = COVER_OPERATION_IDLE;
|
case esphome::ratgdo::DoorState::DOOR_STATE_CLOSING:
|
||||||
|
this->current_operation = COVER_OPERATION_CLOSING;
|
||||||
|
case esphome::ratgdo::DoorState::DOOR_STATE_STOPPED:
|
||||||
|
default:
|
||||||
|
this->current_operation = COVER_OPERATION_IDLE;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
this->publish_state();
|
this->publish_state();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue