Issue with homeassistant.service in recet versions

After updating to the most recent version of ESPHome ( ESPHome version 2023.7.0 compiled on Jul 22 2023, 10:56:59 ) and of HomeAssistant (Home Assistant 2023.7.1) I have the following use case:

1) an ESP8266 attached to 4 relays that is controlling led light. One of these relays has an identity ID switch.phantom_sw1. And on its own is working perfectly well:

|11:18:00|[D]|[switch:012]|‘Phantom SW1’ Turning ON.|
|11:18:00|[D]|[switch:055]|‘Phantom SW1’: Sending state ON|
|11:18:01|[D]|[switch:016]|‘Phantom SW1’ Turning OFF.|
|11:18:01|[D]|[switch:055]|‘Phantom SW1’: Sending state OFF|

2 ) A second ESP8266 is switching the switch off and on when a Button is pressed:

  - platform: gpio
    name: "bottone1"                    
    internal: true
      number: D1
      mode: INPUT_PULLUP
      inverted: True
    id: INT1
    device_class: light
          - homeassistant.service:
              service: switch.toggle
                entity_id: switch.phantom_sw1

the secong ESP works as well
[11:26:20][D][binary_sensor:036]: ‘bottone1’: Sending state ON
[11:26:21][D][binary_sensor:036]: ‘bottone1’: Sending state OFF

But nothing happen on the first ESP and the relays is not triggered

It goes without saying that API is enabled. This scenario worked for me for years and now stopped . I don’t know how to debugg it and where to look for a solution.

Any help will be really appreciated

There was a breaking change mentioned in the HA July release notes. It says prior ESPHome devices shouldn’t be impacted but sure looks like yours was messed up.

Thanks for the information. And it could be a good hint!

WHen it says " to permit the ESPHome device to make service calls, it must be enabled in the options flow."
How do you enable an ESP device in the option flow? What is the option flow? How can you enable it ?


Under Settings → Devices and Services, Pick the ESPHome integration. Then pick configure for the devices to allow services:


Tks found it …But didn’t solve the problem
It is enable on the ESP managing the relays and the ESP issue the command, but nothing changed.
I tryed to reboot the RaspberryPI and to add the Encryption on the API: directive … But nothing new!

change also the command sintax

 - homeassistant.service:
              service: homeassistant.toggle:
              data: { entity_id: switch.phantom_sw1 }

Same story

I did some quick testing and everything worked as expected here with the toggle service calls running Home Assistant OS 2023.7.2 and ESPHome 2023.7.0. Tested on an ESP32 board, both arduino and esp-idf frameworks. I was toggling a zwave switch.

Anything showing up in your HA logs? Have you tried toggling a non ESPHome entity from the ESP8266?

        # #worked
        # - homeassistant.service:
        #       service: light.toggle
        #       data:
        #         entity_id:        
        # #worked
        # - homeassistant.service:
        #       service: switch.toggle
        #       data:
        #         entity_id:    

          - homeassistant.service:
                        service: homeassistant.toggle
                        data: { entity_id: }

OK the problem is solved !

  • I tried with other switches on other devices same story … was not working!

The solution has been : Rebuild from scratch the calling controller. I create a new controller with a different name, same fixed IP, and copied exactly the same configuration.

Both Sintaxes are working. And only the calling ESP has to have the tick for permitting the remote service call. Receive can stay off … reasonable.

Now I don’t know what was the problem, but at least I identify a workaround.
Thanks for the help

1 Like

I have had a couple of issues with ESPhome since the 7.0. Release. The solution for me so far seems to be to clean the build files and then install.

Might help you?