10static const char *
const TAG =
"infrared";
60 " Supports Transmitter: %s\n"
61 " Supports Receiver: %s",
70 ESP_LOGW(TAG,
"No transmitter configured");
74 if (!
call.has_raw_timings()) {
75 ESP_LOGE(TAG,
"No raw timings provided");
81 auto *transmit_data = transmit_call.
get_data();
84 if (
call.get_carrier_frequency().has_value()) {
85 transmit_data->set_carrier_frequency(
call.get_carrier_frequency().value());
89 if (
call.is_packed()) {
91 transmit_data->set_data_from_packed_sint32(
call.get_packed_data(),
call.get_packed_length(),
92 call.get_packed_count());
93 ESP_LOGD(TAG,
"Transmitting packed raw timings: count=%u, repeat=%u",
call.get_packed_count(),
94 call.get_repeat_count());
97 transmit_data->set_data(
call.get_raw_timings());
98 ESP_LOGD(TAG,
"Transmitting raw timings: count=%zu, repeat=%u",
call.get_raw_timings().size(),
99 call.get_repeat_count());
103 if (
call.get_repeat_count() > 0) {
104 transmit_call.set_send_times(
call.get_repeat_count());
108 transmit_call.perform();
125#if defined(USE_API) && defined(USE_IR_RF)
130 uint32_t device_id = 0;
ESPDEPRECATED("object_id mangles names and all object_id methods are planned for removal " "(see https://github.com/esphome/backlog/issues/76). " "Now is the time to stop using object_id. If still needed, use get_object_id_to() " "which will remain available longer. get_object_id() will be removed in 2026.7.0", "2025.12.0") std uint32_t get_object_id_hash()
const StringRef & get_name() const
uint32_t get_device_id() const
void send_infrared_rf_receive_event(uint32_t device_id, uint32_t key, const std::vector< int32_t > *timings)
InfraredCall - Builder pattern for transmitting infrared signals.
InfraredCall & set_raw_timings(const std::vector< int32_t > &timings)
Set the raw timings (positive = mark, negative = space) Note: The timings vector must outlive the Inf...
InfraredCall & set_carrier_frequency(uint32_t frequency)
Set the carrier frequency in Hz.
InfraredCall & set_repeat_count(uint32_t count)
Set the number of times to repeat transmission (1 = transmit once, 2 = transmit twice,...
void perform()
Perform the transmission.
InfraredCall & set_raw_timings_packed(const uint8_t *data, uint16_t length, uint16_t count)
Set the raw timings from packed protobuf sint32 data (zero-copy from wire) Note: The data must outliv...
optional< uint32_t > carrier_frequency_
const uint8_t * packed_data_
const std::vector< int32_t > * raw_timings_
void dump_config() override
remote_base::RemoteReceiverBase * receiver_
bool on_receive(remote_base::RemoteReceiveData data) override
Called when IR data is received (from RemoteReceiverListener)
InfraredCall make_call()
Create a call object for transmitting.
virtual void control(const InfraredCall &call)
Perform the actual transmission (called by InfraredCall)
remote_base::RemoteTransmitterBase * transmitter_
friend class InfraredCall
bool has_transmitter() const
Check if this infrared has a transmitter configured.
bool has_receiver() const
Check if this infrared has a receiver configured.
uint32_t get_capability_flags() const
Get capability flags for this infrared instance.
bool get_supports_transmitter() const
bool get_supports_receiver() const
void set_supports_transmitter(bool supports)
void set_supports_receiver(bool supports)
const RawTimings & get_raw_data() const
void register_listener(RemoteReceiverListener *listener)
RemoteTransmitData * get_data()
APIServer * global_api_server