This commit is contained in:
J. Nick Koston 2023-06-09 16:48:48 -05:00
parent 8996888705
commit 32f76632c7
No known key found for this signature in database
1 changed files with 9 additions and 6 deletions

View File

@ -26,21 +26,24 @@ namespace ratgdo {
}
void RATGDOBinarySensor::on_motion_state(MotionState state)
{
if (this->binary_sensor_type_ != SensorType::RATGDO_SENSOR_MOTION)
return;
ESP_LOGD(TAG, "name: %s this->type_:%d on_motion_state: %d", this->get_name(), this->binary_sensor_type_, state);
if (this->binary_sensor_type_ == SensorType::RATGDO_SENSOR_MOTION)
this->publish_state(state == MotionState::MOTION_STATE_DETECTED);
this->publish_state(state == MotionState::MOTION_STATE_DETECTED);
}
void RATGDOBinarySensor::on_obstruction_state(ObstructionState state)
{
if (this->binary_sensor_type_ != SensorType::RATGDO_SENSOR_OBSTRUCTION)
return;
ESP_LOGD(TAG, "name: %s this->type_:%d on_obstruction_state: %d", this->get_name(), this->binary_sensor_type_, state);
if (this->binary_sensor_type_ == SensorType::RATGDO_SENSOR_OBSTRUCTION)
this->publish_state(state == ObstructionState::OBSTRUCTION_STATE_OBSTRUCTED);
this->publish_state(state == ObstructionState::OBSTRUCTION_STATE_OBSTRUCTED);
}
void RATGDOBinarySensor::on_motor_state(MotorState state)
{
if (this->binary_sensor_type_ != SensorType::RATGDO_SENSOR_MOTOR)
return;
ESP_LOGD(TAG, "name: %s this->type_:%d on_motor_state: %d", this->get_name(), this->binary_sensor_type_, state);
if (this->binary_sensor_type_ == SensorType::RATGDO_SENSOR_MOTOR)
this->publish_state(state == MotorState::MOTOR_STATE_ON);
this->publish_state(state == MotorState::MOTOR_STATE_ON);
}
} // namespace ratgdo