esphome:
  name: api-custom-services-test
host:

# This is required for CustomAPIDevice to work
api:
  custom_services: true
  # Also test that YAML services still work
  actions:
    - action: test_yaml_service
      then:
        - logger.log: "YAML service called"

    # Test YAML service with arguments (tests UserServiceBase with const char* array)
    - action: test_yaml_service_with_args
      variables:
        my_int: int
        my_string: string
      then:
        - logger.log:
            format: "YAML service with args: %d, %s"
            args: [my_int, my_string.c_str()]

    # Test YAML service with multiple arguments
    - action: test_yaml_service_many_args
      variables:
        arg1: int
        arg2: float
        arg3: bool
        arg4: string
      then:
        - logger.log:
            format: "YAML service many args: %d, %.2f, %d, %s"
            args: [arg1, arg2, arg3, arg4.c_str()]

logger:
  level: DEBUG

# External component that uses CustomAPIDevice
external_components:
  - source:
      type: local
      path: EXTERNAL_COMPONENT_PATH
    components: [custom_api_device_component]

custom_api_device_component:
