Homeassistant.service and homeassistant.event not working

hi all,

I am trying to get a basic button to work to turn on /off a light in my home. I have the following config:

# Basic device configuration
esphome:
  name: test1
  platform: ESP32
  board: esp32dev

# WiFi configuration
wifi:
  networks:
    - ssid: 'C1'
      password: 'REDACTED'
      manual_ip:
        static_ip: 192.168.99.141
        gateway: 192.168.99.254
        subnet: 255.255.255.0
        dns1: 192.168.99.254

# Enable logging
logger:
  level: VERBOSE  # Increase logging level

# Enable Home Assistant API
api:
  encryption:
    key: "REDACTED"

ota:
  platform: esphome

# Button configuration
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO4  # Change this to your button's GPIO pin
      mode: INPUT_PULLUP  # Enable internal pull-up resistor
      inverted: true     # Invert the input (button connects to GND)
    name: "My Button"
    id: button1
    on_click:
      then:
        - homeassistant.event:
            event: esphome.button_pressed
            data:
              message: "Button1 singel"
        - logger.log: "Button pressed!"
        - homeassistant.service:
            service: light.turn_on
            data:
              entity_id: light.lamp_achter_tv_socket_1

I am trying to debug where it is going wrong. It seems the homeassistant.service and homeassistant.events don’t work. I don´t see any events when i listen on the event and the service is also not working. How can i debug this more? I see the message “Button pressed” from the logger in the console but i can’t seem to debug the api calls to homeassistant.

Never mind, i already found it: Issue with homeassistant.service in recet versions - #2 by mulcmu