ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
ir_rf_proxy.cpp
Go to the documentation of this file.
1#include "ir_rf_proxy.h"
2
3#include <cinttypes>
4
5#include "esphome/core/log.h"
6
8
9ESPHOME_LOG_TAG(TAG, "ir_rf_proxy");
10
11// ========== IrRfProxy (Infrared platform) ==========
12
13#ifdef USE_INFRARED
14
16 ESP_LOGCONFIG(TAG,
17 "IR Proxy '%s'\n"
18 " Supports Transmitter: %s\n"
19 " Supports Receiver: %s",
20 LOG_STR_ARG(this->get_log_name()), YESNO(this->get_supports_transmitter()),
21 YESNO(this->get_supports_receiver()));
22
23 if (this->is_rf()) {
24 ESP_LOGCONFIG(TAG, " Hardware Type: RF (%.3f MHz)", this->frequency_khz_ / 1e3f);
25 } else {
26 ESP_LOGCONFIG(TAG, " Hardware Type: Infrared");
27 }
28}
29
30#endif // USE_INFRARED
31
32// ========== RfProxy (Radio Frequency platform) ==========
33
34#ifdef USE_RADIO_FREQUENCY
35
38 // remote_transmitter/receiver always uses OOK (on-off keying)
40}
41
43 ESP_LOGCONFIG(TAG,
44 "RF Proxy '%s'\n"
45 " Supports Transmitter: %s\n"
46 " Supports Receiver: %s",
47 LOG_STR_ARG(this->get_log_name()), YESNO(this->get_supports_transmitter()),
48 YESNO(this->get_supports_receiver()));
49
50 const auto &traits = this->traits_;
51 if (traits.get_frequency_min_hz() > 0) {
52 if (traits.get_frequency_min_hz() == traits.get_frequency_max_hz()) {
53 ESP_LOGCONFIG(TAG, " Frequency: %.3f MHz (fixed)", traits.get_frequency_min_hz() / 1e6f);
54 } else {
55 ESP_LOGCONFIG(TAG, " Frequency Range: %.3f - %.3f MHz", traits.get_frequency_min_hz() / 1e6f,
56 traits.get_frequency_max_hz() / 1e6f);
57 }
58 }
59}
60
62 // RF: no IR carrier modulation. Any RF front-end coordination (state turnaround, retuning)
63 // happens via the radio_frequency entity's on_control trigger and remote_transmitter's
64 // on_transmit/on_complete triggers — wired up in user YAML.
65 return this->transmit_raw_(call, 0);
66}
67
68#endif // USE_RADIO_FREQUENCY
69
70} // namespace esphome::ir_rf_proxy
const LogString * get_log_name() const
Get the name for a "%s" log argument (LOG_STR_ARG).
void setup() override
Reports the configured transports, listens on the receiver and hooks the transmitter's completion; a ...
bool get_supports_transmitter() const
What the entity can do; platforms with their own hardware set these from their own setup(),...
Definition ir_rf_base.h:93
bool transmit_raw_(const IrRfCallData &call, uint32_t carrier_frequency_hz)
Hands the call's timings to the transmitter; the default transmit path of both entity types.
bool is_rf() const
Check if this is RF mode (non-zero frequency)
Definition ir_rf_proxy.h:32
bool control(const radio_frequency::RadioFrequencyCall &call) override
RadioFrequencyCall - Builder pattern for transmitting radio frequency signals.
void add_supported_modulation(RadioFrequencyModulation mod)
ESPHOME_LOG_TAG(TAG, "ir_rf_proxy")