diff --git a/components/ratgdo/binary_sensor/__init__.py b/components/ratgdo/binary_sensor/__init__.py index 154f61e..a42c673 100644 --- a/components/ratgdo/binary_sensor/__init__.py +++ b/components/ratgdo/binary_sensor/__init__.py @@ -33,5 +33,5 @@ async def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) await binary_sensor.register_binary_sensor(var, config) await cg.register_component(var, config) - cg.add(var.set_type(config[CONF_TYPE])) + cg.add(var.set_binary_sensor_type(config[CONF_TYPE])) await register_ratgdo_child(var, config) diff --git a/components/ratgdo/binary_sensor/ratgdo_binary_sensor.cpp b/components/ratgdo/binary_sensor/ratgdo_binary_sensor.cpp index 6578c25..a04486e 100644 --- a/components/ratgdo/binary_sensor/ratgdo_binary_sensor.cpp +++ b/components/ratgdo/binary_sensor/ratgdo_binary_sensor.cpp @@ -14,14 +14,14 @@ namespace ratgdo { } void RATGDOBinarySensor::on_motion_state(MotionState state) { - ESP_LOGD(TAG, "name: %s this->type_:%d on_motion_state: %d", this->get_name(), this->type_, state); - if (this->type_ == SensorType::RATGDO_SENSOR_MOTION) + 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); } void RATGDOBinarySensor::on_obstruction_state(ObstructionState state) { - ESP_LOGD(TAG, "name: %s this->type_:%d on_obstruction_state: %d", this->get_name(), this->type_, state); - if (this->type_ == SensorType::RATGDO_SENSOR_OBSTRUCTION) + 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); } void RATGDOBinarySensor::on_door_state(DoorState state) { } diff --git a/components/ratgdo/binary_sensor/ratgdo_binary_sensor.h b/components/ratgdo/binary_sensor/ratgdo_binary_sensor.h index 957199d..c298467 100644 --- a/components/ratgdo/binary_sensor/ratgdo_binary_sensor.h +++ b/components/ratgdo/binary_sensor/ratgdo_binary_sensor.h @@ -17,7 +17,7 @@ namespace ratgdo { class RATGDOBinarySensor : public binary_sensor::BinarySensor, public RATGDOClient, public Component { public: void dump_config() override; - void set_type(SensorType type) { this->type_ = type_; } + void set_type(SensorType type) { this->binary_sensor_type_ = type_; } void on_motion_state(MotionState state) override; void on_obstruction_state(ObstructionState state) override; @@ -26,7 +26,7 @@ namespace ratgdo { void on_lock_state(LockState state) override; protected: - SensorType type_; + SensorType binary_sensor_type_; }; } // namespace ratgdo