ESPHome user defined service not shown in HA

Hi,

I created ESPHome IR transmitter using esp32. It works fine as such, but I got interested of user defined service I saw that sends any IR signals given in variables while called from HA. For some reason the service won’t show up in HA. Any tips why?

So I copied this logic in aims to command my yamaha rxv-450. I read API guide and to my best understanding API is defined correctly like this:

# Enable Home Assistant API
api:
  id: yk_kake
  encryption:
    key: !secret api_key
  services:
    - service: remote_2code
      variables:
        rc_code_1: int
        rc_code_2: int
      then:
        - remote_transmitter.transmit_pioneer:
            transmitter_id: yamaha_amp
            rc_code_1: !lambda 'return rc_code_1;'
            rc_code_2: !lambda 'return rc_code_2;'
    - service: remote_1code
      variables:
        rc_code_1: int
      then:
        - remote_transmitter.transmit_pioneer:
            transmitter_id: yamaha_amp
            rc_code_1: !lambda 'return rc_code_1;'

I have other setup like buttons etc, which work fine and immediately pop up into ESPhome device in HA. But the above services won’t get listed anywhere. Why?

The buttons that work, later defined after the above api part:

remote_transmitter:
  pin: '${tx_pin}'
  carrier_duty_percent: 50%
  id: yamaha_amp

button:
  - name: "ON"
    platform: template
    on_press:
      remote_transmitter.transmit_pioneer:
        transmitter_id: yamaha_amp
        rc_code_1: 0x7E7E

I run latest HA in container on VM in NAS, and compile and upload the firmware for ESPhome on my laptop using the latest official container. What fails here, why do the buttons get listed in HA, but the service not?

Thanks, I also saw this checkbox, but by the sound of it it denies esphome to call HA service. Now this would need to be the other way around, HA should consume the service provided by the ESPHome box. So I’d assume it would be somehow listed as a service provided by the ESPHome unit.

However, I enabled it now anyhow, but no difference.

Here is btw the code, I mapped all the buttons now.

How do you get that from the word “Allow”?

Sorry, I meant that when it wass unchecked in my case, it denies esphome to call HA services. “Allow the device to make Home Assistant service calls.” So I read it so that ESPHome can’t call any service defined by HA. In this case the service is defined in ESPHome and HA should be able to call it. So vice versa to this setting. Or what don’t I understand?

I thought I would now need to create some action in HA to call service from ESPHome, where it’s defined. Am I somehow mistaken? Which is very likely with my lack of experience.

Never mind. I found it comes up in automation tab when I select action. There I can find it as esphome service. So my own ignorance. I was looking for it in panels and under esphome ir-transmitter device.

1 Like