Help with Final script: Error on Custom Board (Oakter Remote)

Hello everyone,

I’m trying to set up an Oakter Smart Remote (V3.4) which uses an ESP-12E. I’ve been doing a lot of troubleshooting and have successfully identified most of the hardware pins, but I am completely stuck on a final compiler error when I add a script to my configuration.

Hardware Pins We’ve Found:

  • Status LED: GPIO4
  • IR Receiver: GPIO5 (Inverted)
  • IR Transmitter: GPIO12
  • Button: GPIO0

The Goal: I’m trying to create a simple script that can be called from Home Assistant to send an IR code.

The Problem: As soon as I add the script: block to my YAML, the ESPHome compiler fails with a strange error. It says 'id' is a required option, but then immediately says Unable to find action with the name 'id'. This happens no matter how the action inside the script is formatted.

Here is my complete YAML file:

esphome:
  name: wifi-remote
  friendly_name: "WiFi Remote"

esp8266:
  board: esp12e

logger:

api:
  encryption:
    key: "YOUR_API_KEY"

ota:
  password: "YOUR_OTA_PASSWORD"

wifi:
  ssid: "YOUR_WIFI_SSID"
  password: "YOUR_WIFI_PASSWORD"
  
  ap:
    ssid: "Wifi-Remote Fallback Hotspot"
    password: "fallbackpassword"

captive_portal:

output:
  - platform: gpio
    pin: GPIO4
    id: status_led_pin

light:
  - platform: binary
    name: "Oakremote Status LED"
    id: status_led
    output: status_led_pin
    restore_mode: RESTORE_DEFAULT_ON

remote_receiver:
  pin:
    number: GPIO5
    inverted: true
  dump: all
  id: ir_receiver

remote_transmitter:
  pin: GPIO12
  carrier_duty_percent: 50%
  id: ir_transmitter

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: true
    name: "Oakremote Button"
    on_press:
      then:
        - logger.log: "Physical button was pressed!"

script:
  - id: send_nec_code
    alias: "Send NEC IR Code"
    fields:
      - name: address
        type: integer
      - name: command
        type: integer
    mode: single
    then:
      - lambda: 'id(ir_transmitter).transmit_nec(address, command);'

========================================================
And here is the exact error message from the logs:

INFO ESPHome 2025.2.2
INFO Reading configuration /config/wifi-remote.yaml...
Failed config

script: [source /config/wifi-remote.yaml:75]
  
  'id' is a required option for [script].
  - 
    Unable to find action with the name 'id'.
    id: send_nec_code
    alias: Send NEC IR Code
    fields: 
      - name: address
        type: integer
      - name: command
        type: integer
    mode: single
    then: 
      - lambda: id(ir_transmitter).transmit_nec(address, command);

If I remove the script: block, the code compiles successfully.

Can anyone see what might be causing this strange parsing error? Thank you so much for your help.

  1. You are missing the mandatory platform: key here - eg:
ota: 
  - platform: esphome
  1. You are using HA script syntax - read the correct docs…

https://esphome.io/components/script/

Also - if you want to run code from HA, you may be better off using user defined actions. You can use a script, but then you need to trigger that script using a button or similar.

User defined actions can be called directly without having to be triggered.