From 2d9e862f237aa2ee8eef8bbc7884bdf4bd510a1f Mon Sep 17 00:00:00 2001 From: Marius Muja Date: Thu, 18 Jan 2024 14:45:50 -0800 Subject: [PATCH] Update some logging --- components/ratgdo/ratgdo.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/components/ratgdo/ratgdo.cpp b/components/ratgdo/ratgdo.cpp index 764b5f0..8991652 100644 --- a/components/ratgdo/ratgdo.cpp +++ b/components/ratgdo/ratgdo.cpp @@ -95,13 +95,10 @@ namespace ratgdo { void RATGDOComponent::received(const DoorState door_state) { - ESP_LOGD(TAG, "Door state=%s", DoorState_to_string(door_state)); auto prev_door_state = *this->door_state; - ESP_LOGD(TAG, "Door state=%s", DoorState_to_string(door_state)); - if (prev_door_state == door_state) { return; } @@ -192,48 +189,50 @@ namespace ratgdo { void RATGDOComponent::received(const LearnState learn_state) { - this->learn_state = learn_state; ESP_LOGD(TAG, "Learn state=%s", LearnState_to_string(learn_state)); + this->learn_state = learn_state; } void RATGDOComponent::received(const LightState light_state) { - this->light_state = light_state; ESP_LOGD(TAG, "Light state=%s", LightState_to_string(light_state)); + this->light_state = light_state; } void RATGDOComponent::received(const LockState lock_state) { - this->lock_state = lock_state; ESP_LOGD(TAG, "Lock state=%s", LockState_to_string(lock_state)); + this->lock_state = lock_state; } void RATGDOComponent::received(const ObstructionState obstruction_state) { if (this->obstruction_from_status_) { + ESP_LOGD(TAG, "Obstruction: state=%s", ObstructionState_to_string(*this->obstruction_state)); + this->obstruction_state = obstruction_state; // This isn't very fast to update, but its still better // than nothing in the case the obstruction sensor is not // wired up. - ESP_LOGD(TAG, "Obstruction: state=%s", ObstructionState_to_string(*this->obstruction_state)); } } void RATGDOComponent::received(const MotorState motor_state) { - this->motor_state = motor_state; ESP_LOGD(TAG, "Motor: state=%s", MotorState_to_string(*this->motor_state)); + this->motor_state = motor_state; } void RATGDOComponent::received(const ButtonState button_state) { - this->button_state = button_state; ESP_LOGD(TAG, "Button state=%s", ButtonState_to_string(*this->button_state)); + this->button_state = button_state; } void RATGDOComponent::received(const MotionState motion_state) { + ESP_LOGD(TAG, "Motion: %s", MotionState_to_string(*this->motion_state)); this->motion_state = motion_state; if (motion_state == MotionState::DETECTED) { this->set_timeout("clear_motion", 3000, [=] { @@ -243,11 +242,14 @@ namespace ratgdo { this->query_status(); } } - ESP_LOGD(TAG, "Motion: %s", MotionState_to_string(*this->motion_state)); } void RATGDOComponent::received(const LightAction light_action) { + ESP_LOGD(TAG, "Light cmd=%s state=%s", + LightAction_to_string(light_action), + LightState_to_string(*this->light_state) + ); if (light_action == LightAction::OFF) { this->light_state = LightState::OFF; } else if (light_action == LightAction::ON) { @@ -255,10 +257,6 @@ namespace ratgdo { } else if (light_action == LightAction::TOGGLE) { this->light_state = light_state_toggle(*this->light_state); } - ESP_LOGD(TAG, "Light cmd=%s state=%s", - LightAction_to_string(light_action), - LightState_to_string(*this->light_state) - ); } void RATGDOComponent::received(const Openings openings) @@ -273,6 +271,8 @@ namespace ratgdo { void RATGDOComponent::received(const PairedDeviceCount pdc) { + ESP_LOGD(TAG, "Paired device count, kind=%s count=%d", PairedDevice_to_string(pdc.kind), pdc.count); + if (pdc.kind == PairedDevice::ALL) { this->paired_total = pdc.count; } else if (pdc.kind == PairedDevice::REMOTE) {