Message malformed: Service esphome.esp-buzzer_unit_keep_buzzer does not match format

Dear friends
thanks for hearing my problem, please give me the solution for the following issue
First: I´m very new to HA, and I have no experience in programming. But I like to think I´m slowly improving. Anyways, please keep any answers as simple as possible.

Problem: I’m using ESP32s boar, with that, I connected buzzer and motion sensor… it is working great, but when I set automation to buzzer it is giving error.
ERROE : Message malformed: Service esphome.esp-buzzer_unit_keep_buzzer does not match format . for dictionary value @ data[‘action’][0][‘service’]

But when I call service in Developer Tools - the buzzer is working

–>Automation

alias: New Automation
description: ''
mode: single
trigger:
  - platform: state
    entity_id: binary_sensor.pir_sensor
    to: 'on'
condition: []
action:
  - service: esphome.esp-buzzer_unit_keep_buzzer
    data: {}

–>IN ESPHOME–> this is the program that I compiled in ESP32s board

esphome:
  name: esp-buzzer_unit
  platform: ESP32
  board: nodemcu-32s

wifi:
  ssid: "xxx"
  password: "xxx"
  manual_ip:
    static_ip: 192.168.10.9
    gateway: 192.168.10.1
    subnet: 255.255.255.0
    dns1: 192.168.10.1
    dns2: 192.168.10.1

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp-Buzzer Unit Fallback Hotspot"
    password: "bYWd6djiF7pq"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
ota:
  password: "123456"

api:
  password: "123456"
  
  services:
    - service: keep_buzzer
      then:
        - rtttl.play: "beep:d=16,o=5,b=100:b"
    - service: play_rtttl
      variables:
        song_str: string
      then:
        - rtttl.play:
            rtttl: !lambda 'return song_str;'

sensor:
  - platform: wifi_signal
    name: "WiFi Signal Sensor buzzer"
    update_interval: 5s
    id: esp32s_buzzer_wifi
 
binary_sensor:
  - platform: gpio
    pin: 14
    name: "PIR Sensor"
    device_class: motion
 
output:
  - platform: ledc
    pin: 5
    id: rtttl_out

rtttl:
  output: rtttl_out
  on_finished_playback:
    - logger.log: 'Song ended!'

Hi and welcome to the forum. Two things that will help us answer your question:

  1. Read the category topics before posting and select the most appropriate one. I have already done this for you this time.

  2. Please don’t paste pictures of text. And for text that you do copy and paste please format it correctly. See point 11 here and then edit your post.

sorry bro. That was my first post, I edited it . now everything ok

1 Like

It could be the dash in your device name that is causing the issue. Change it to an underscore:

esphome:
  name: esp-buzzer_unit
           ^
1 Like

sir bro, you are correct. Now it is working.

1 Like

Glad to hear it. Thanks for fixing your post :+1:

1 Like