ESPHome automation based on if raw received?

I’m trying to activate an automation based on if my IR receiver receives a raw code, but when I try to validate the code, it fails. Can anyone help me rewrite the code?

substitutions: 
  name: living-room-pres-sensor
  friendly_name: Living Room Pres Sensor
  device_id: living_room_pres_sensor
  api_key: XXX
  ota_pass: XXX

packages:
  common: !include common/common.yaml
  bt_proxy: !include common/bluetooth-proxy.yaml
  ld2410c: !include common/ld2410c.yaml

logger:
  level: INFO
  logs:
    sensor.ld2410: NONE
  baud_rate: 0


#Setting Up Receiver to Catch Remote Actions from LG and HDMI Port Switch
remote_receiver:
  pin:
    number: GPIO15 
    inverted: true
  dump: 
    - lg
    - raw


#Received Button 1
remote_receiver.on_raw:
  raw:
    - 9032 
    - -2235
    -  617
  then:
    - logger.log: "Received Raw Code: HDMI Switch Port 1"

error shown is this:

INFO Reading configuration /config/esphome/living-room-pres-sensor.yaml...
ERROR Unexpected exception while reading configuration:
Traceback (most recent call last):
  File "/usr/local/bin/esphome", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/esphome/esphome/__main__.py", line 1018, in main
    return run_esphome(sys.argv)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/__main__.py", line 996, in run_esphome
    config = read_config(dict(args.substitution) if args.substitution else {})
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/config.py", line 1091, in read_config
    res = load_config(command_line_substitutions)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/config.py", line 945, in load_config
    return _load_config(command_line_substitutions)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/config.py", line 935, in _load_config
    return validate_config(config, command_line_substitutions)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/config.py", line 859, in validate_config
    result.run_validation_steps()
  File "/esphome/esphome/config.py", line 142, in run_validation_steps
    task.step.run(self)
  File "/esphome/esphome/config.py", line 317, in run
    component = get_component(self.domain)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/esphome/esphome/loader.py", line 196, in get_component
    assert "." not in domain
           ^^^^^^^^^^^^^^^^^
AssertionError

If I comment out remote_receiver.on_raw it compiles properly.

Esphome doesn’t have component like that.

Maybe you are looking for remote receiver binary sensor:

2 Likes

It may not run so well if you use Bluetooth proxy at the same time. Might be better to remove bt proxy for now.

I’ve noticed a drop in performance. I do have another proxy in the room so I might as well use that as primary.