This commit is contained in:
J. Nick Koston 2023-06-09 15:58:55 -05:00
parent 025ab70a3b
commit f8262a0cfa
No known key found for this signature in database
2 changed files with 8 additions and 11 deletions

View File

@ -17,16 +17,14 @@ namespace ratgdo {
{
this->state(state == LockState::LOCK_STATE_LOCKED) this->publish_state();
}
void RATGDOSwitch::turn_on()
void RATGDOSwitch::write_state(bool state)
{
ESP_LOGD(TAG, "name: %s this->type_:%d ON", this->get_name(), this->switch_type_);
this->parent_->lock(value);
this->publish_state(value);
}
void RATGDOSwitch::turn_off()
{
ESP_LOGD(TAG, "name: %s this->type_:%d OFF", this->get_name(), this->switch_type_);
this->parent_->unlock(value);
ESP_LOGD(TAG, "name: %s this->type_:%d state: %d", this->get_name(), this->switch_type_, state);
if (state) {
this->parent_->lock(value);
} else {
this->parent_->unlock(value);
}
this->publish_state(value);
}

View File

@ -19,8 +19,7 @@ namespace ratgdo {
void set_switch_type(SwitchType switch_type_) { this->switch_type_ = switch_type_; }
void on_lock_state(LockState state) override;
void turn_off() override;
void turn_on() override;
void write_state(bool state) override;
protected:
SwitchType switch_type_;