mirror of
https://github.com/esphome/esphome.git
synced 2025-11-17 07:15:48 +00:00
* Cleanup dashboard JS * Add vscode * Save start_mark/end_mark * Updates * Updates * Remove need for cv.nameable It's a bit hacky but removes so much bloat from integrations * Add enum helper * Document APIs, and Improvements * Fixes * Fixes * Update PULL_REQUEST_TEMPLATE.md * Updates * Updates * Updates
24 lines
551 B
C++
24 lines
551 B
C++
#include "uart_switch.h"
|
|
#include "esphome/core/log.h"
|
|
|
|
namespace esphome {
|
|
namespace uart {
|
|
|
|
static const char *TAG = "uart.switch";
|
|
|
|
void UARTSwitch::write_state(bool state) {
|
|
if (!state) {
|
|
this->publish_state(false);
|
|
return;
|
|
}
|
|
|
|
this->publish_state(true);
|
|
ESP_LOGD(TAG, "'%s': Sending data...", this->get_name().c_str());
|
|
this->write_array(this->data_.data(), this->data_.size());
|
|
this->publish_state(false);
|
|
}
|
|
void UARTSwitch::dump_config() { LOG_SWITCH("", "UART Switch", this); }
|
|
|
|
} // namespace uart
|
|
} // namespace esphome
|