| 83 | } |
| 84 | |
| 85 | void SwitchEntity::turn_on(bool send_update) { |
| 86 | SPDLOG_TRACE("Requested switch {}::{} be turned on.", this->_id, this->_name); |
| 87 | this->_requested_state = true; |
| 88 | if (send_update) { |
| 89 | this->send_state_update_to_controller(); |
| 90 | |
| 91 | if (MqttManagerConfig::get_settings().optimistic_mode) { |
| 92 | this->_current_state = true; |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | void SwitchEntity::turn_off(bool send_update) { |
| 98 | SPDLOG_TRACE("Requested switch {}::{} be turned off.", this->_id, this->_name); |
no test coverage detected