Disable/Enable remote_receiver component to save energy

Hi Team!

I’m close to giving up, so I decided to ask for your help as a last resort…

I’m trying to set up a ESP32-C6 battery operated device.
Part of it’s functionality is to act as remote_receiver for IR signals.

I’m setting it up as OpenThread device and trying the Light Sleep SED configuration.

To allow SED configuration to work and put the device to light sleep, I configured a switch which cuts the physical IR receiver pin out… hoping this would prevent remote_receiver compontn from utilizing the CPU.

It turns out this doesn’t work and the device is not going to sleep at all… seems like remote_receiver’s loop is still going, preventing the device from going to sleep.

q: Is there a way to disable remote_receiver component conditionally?

(My yaml config below, if you’re interested)

esphome:
  name: thread-c6-sensor-v01
  friendly_name: "Thread IR Remote"
  on_boot:
    priority: -100
    then:
      - text_sensor.template.publish:
          id: ir_code_sensor
          state: "Gotowy / Czekam..."

esp32:
  board: esp32-c6-devkitc-1
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_PM_ENABLE: "y"
      CONFIG_PM_DFS_INIT_SETTINGS_USE_RTC_TICK: "y"
      CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP: "y"
      CONFIG_OPENTHREAD_CSL_RECEIVER: "y"
      CONFIG_FREERTOS_USE_TICKLESS_IDLE: "y"

globals:
  - id: last_pronto_code
    type: std::string
    restore_value: no
    initial_value: '""'

# 1. ODBIORNIK IR
remote_receiver:
  pin: 0
  dump: pronto
  # ESPHome automatycznie przypisuje tekst Pronto do zmiennej 'x' w on_pronto, 
  # ale czasem ma problem z typami w IDF. 
  # Spróbujemy wymusić zrzut bezpośrednio do sensora:
  on_pronto:
    then:
      - text_sensor.template.publish:
          id: ir_code_sensor
          state: !lambda 'return x.data;' # .data to surowy string w obiekcie Pronto
      - homeassistant.event:
          event: esphome.ir_code_received
          data:
            code: !lambda 'return x.data;'


# 2. NADAJNIK IR
remote_transmitter:
  pin: 1
  carrier_duty_percent: 50%

# 3. USŁUGA DLA HOME ASSISTANT (Wysyłanie kodu z palca)
api:
  services:
    - service: transmit_raw_code
      variables:
        raw_code: int[]
      then:
        - remote_transmitter.transmit_raw:
            code: !lambda "return raw_code;"
            carrier_frequency: 38kHz
    - service: transmit_pronto_code
      variables:
        pronto_data: string
      then:
        - remote_transmitter.transmit_pronto:
            data: !lambda 'return pronto_data;'

# 4. SENSORY (Bateria)
sensor:
  - platform: adc
    pin: 4
    id: battery_voltage
    name: "Battery Voltage"
    update_interval: 15min
    attenuation: 12db
    filters:
      - multiply: 2.0

  - platform: template
    name: "Battery Percentage"
    unit_of_measurement: "%"
    device_class: battery
    update_interval: 15min
    lambda: |-
      float v = id(battery_voltage).state;
      if (v >= 4.15) return 100.0;
      if (v <= 3.4) return 0.0;
      return (v - 3.4) / (4.15 - 3.4) * 100.0;

# 5. PRZEŁĄCZNIK TRYBU (Odcięcie pinu)
switch:
  - platform: template
    name: "Tryb uczenia kodów IR"
    id: learning_mode
    optimistic: true
    icon: "mdi:ear-hearing"
    on_turn_on:
      - lambda: |-
          auto pin = gpio_num_t(0);
          gpio_reset_pin(pin);
          gpio_set_direction(pin, GPIO_MODE_INPUT);
          gpio_set_pull_mode(pin, GPIO_PULLUP_ONLY);
    on_turn_off:
      - lambda: |-
          auto pin = gpio_num_t(0);
          gpio_reset_pin(pin);
          gpio_set_direction(pin, GPIO_MODE_DISABLE);


# 7. THREAD / KOMUNIKACJA
network:
  enable_ipv6: true
openthread:
  device_type: MTD
  tlv: "numbersnumbersnumbersnumbers"
  poll_period: 2s

ota:
  - platform: esphome
logger:
  level: NONE

And if you remove the remote_recever completely, your battery life is like desired?