And done!

This commit is contained in:
Daniël Koek 2024-03-26 17:51:53 +00:00
parent 76b276516a
commit ca950d68e4
2 changed files with 6 additions and 11 deletions

View file

@ -162,17 +162,8 @@ void Lora::loop() {
ESP_LOGD(TAG, "VALUE: %u ", data[2]); ESP_LOGD(TAG, "VALUE: %u ", data[2]);
ESP_LOGD(TAG, "RSSI: %u ", data[3]); ESP_LOGD(TAG, "RSSI: %u ", data[3]);
} else { } else {
ESP_LOGD(TAG, "WEIRD "); ESP_LOGD(TAG, "WEIRD");
} }
// char *ptr;
// // set the rssi
// rssi_ = strtol(buffer.substr(buffer.length() - 1, 1).c_str(), &ptr, 2);
// ESP_LOGD(TAG, "RSSI: %u ", rssi_);
// // set the raw message
// if (!pin_data_found) {
// raw_message_ = buffer.substr(0, buffer.length() - 1);
// }
} }
} // namespace lora } // namespace lora
} // namespace esphome } // namespace esphome

View file

@ -4,7 +4,11 @@ namespace esphome {
namespace lora { namespace lora {
static const char *const TAG_SWITCH = "lora.switch"; static const char *const TAG_SWITCH = "lora.switch";
void LoraSwitch::write_state(bool state) { this->parent_->digital_write(this->pin_, state != this->inverted_); } void LoraSwitch::write_state(bool state) {
this->parent_->digital_write(this->pin_, state != this->inverted_);
// finally set it
this->publish_state(state);
}
void LoraSwitch::dump_config() { LOG_SWITCH(TAG_SWITCH, "Lora Switch", this); } void LoraSwitch::dump_config() { LOG_SWITCH(TAG_SWITCH, "Lora Switch", this); }
} // namespace lora } // namespace lora
} // namespace esphome } // namespace esphome