Rf Bridge: add bucket sniffing and beep functionality (#1819)

Co-authored-by: Otto winter <otto@otto-winter.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Adrián Panella
2021-05-31 14:24:22 -05:00
committed by GitHub
parent 25af5ab7c6
commit 5c3268b8d4
3 changed files with 80 additions and 0 deletions
@@ -201,6 +201,14 @@ void RFBridgeComponent::stop_advanced_sniffing() {
this->flush();
}
void RFBridgeComponent::start_bucket_sniffing() {
ESP_LOGD(TAG, "Raw Bucket Sniffing on");
this->write(RF_CODE_START);
this->write(RF_CODE_RFIN_BUCKET);
this->write(RF_CODE_STOP);
this->flush();
}
void RFBridgeComponent::send_raw(std::string raw_code) {
ESP_LOGD(TAG, "Sending Raw Code: %s", raw_code.c_str());
@@ -208,5 +216,16 @@ void RFBridgeComponent::send_raw(std::string raw_code) {
this->flush();
}
void RFBridgeComponent::beep(uint16_t ms) {
ESP_LOGD(TAG, "Beeping for %hu ms", ms);
this->write(RF_CODE_START);
this->write(RF_CODE_BEEP);
this->write((ms >> 8) & 0xFF);
this->write(ms & 0xFF);
this->write(RF_CODE_STOP);
this->flush();
}
} // namespace rf_bridge
} // namespace esphome