标签:# <标签:0 x00007fc3f153de98 >

亲爱的朋友们
谢谢听到我的问题,请给我以下问题的解决方案
首先:我对HA很陌生,我在编程方面没有经验。但是我认为我正在慢慢地进步。无论如何,请保持任何答案尽可能简单。

问题:我用的是ESP32s野猪,用它,我连接了蜂鸣器和运动传感器,它工作得很好,但当我把自动化设置为蜂鸣器时,它会出错。
error: Message malformed: Service esphome.esp-buzzer_unit_keep_buzzer不匹配格式。对于字典值@ data[' action '][0][' service ']

但是当我在开发人员工具中调用服务时,蜂鸣器正在工作

- >自动化

alias:新增自动化描述:" mode: single trigger: - platform: state entity_id: binary_sensor. alias:新增自动化描述:" mode: single trigger: - platform: state entity_id: binary_sensor. "操作:- service: esphome.esp-buzzer_unit_keep_buzzer data: {}

- >IN ESPHOME - >这是我在ESP32s板编译的程序

esphome: name: esp-buzzer_unit platform: ESP32 board: nodemu -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 #在wifi连接失败时开启备用热点(浮动portal) ap: ssid: "Esp-Buzzer Unit fallback hotspot " password:"bYWd6djiF7pq" captive_portal: # Enable logging logger: # Enable 19463331伟德国际Home Assistant API ota: password: "123456" API: password: "123456" services:—service: keep_buzzer then:—rtttl。播放:“beep:d=16,o=5,b=100:b”- service: play_rtttl variables: song_str: string then: - rtttl。玩:rtttl !λ的返回song_str;传感器:-平台:wifi_signal名称:“无线信号传感器蜂鸣器”update_interval: 5 s id: esp32s_buzzer_wifi binary_sensor: -平台:gpio销:14名:“PIR传感器”device_class:运动输出:-平台:ledc销:5 id: rtttl_out rtttl:输出:rtttl_out on_finished_playback: - logger.log:“首歌结束了!”

大家好,欢迎来到论坛。有两点可以帮助我们回答你的问题:

  1. 在发表文章之前先阅读文章主题,然后选择最合适的一个。这次我已经为你做了。

  2. 请不要粘贴文字图片。对于要复制粘贴的文本,请正确格式化。看到11点在这里然后编辑你的帖子。

对不起兄弟。这是我的第一个帖子,我编辑了它。现在一切都好

1像

可能是设备名称中的破折号导致了问题。更改为下划线:

Esphome: name: esp-buzzer_unit ^
1像

兄弟先生,你说得对。现在它起作用了。

1像

很高兴听你这么说。谢谢你修改你的帖子:+ 1:

1像