尝试编辑 configuration.yaml 但出错
Trying to edit configuration.yaml but erroring
我正在尝试使用 raspberry pi、家庭助理和电报制作门铃,但是在尝试向 configurations.yaml 添加部件时,我一直收到此错误。
Jul 14 15:49:19 homeassistant hass[9133]: 2020-07-14 15:49:18 ERROR (MainThread) [homeassistant.bootstrap] Failed to parse configuration.yaml: mapping values are not allowed here
Jul 14 15:49:19 homeassistant hass[9133]: in "/home/pi/.homeassistant/configuration.yaml", line 23, column 12. Activating safe mode
这是我的配置文件。
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
camera:
- platform: mqtt
topic: dev/camera
# Text to speech
#tts:
# - platform: google_translate
notify:
- name: Telegram
platform: telegram
api_key: 1194049919:AAEC_sgl94lgVhFnWCcse9HXegC3A4_eZbY
chat_id: 1154840631
automation:
- alias: Doorbell_pressed_automation
trigger:
platform: mqtt
topic: dev/test
payload: 'Capture!'
action:
- service: automation.turn_off
entity_id: automation.doorbell_pressed_automation
- service: script.turn_on
entity_id: script.doorbell_pressed_script
- delay: "00:00:5"
- service: automation.turn_on
entity_id: automation.doorbell_pressed_automation
doorbell_pressed_script:
sequence:
- service: notify.Telegram
data:
title: Home Assistant Notification
message: --Doorbell Pressed--
data:
photo:
- url: http://192.168.1.15/images/image.jpg
caption: Doorbell View
dev_publish_on_script:
sequence:
- service: mqtt.publish
data: {"topic":"dev/test", "payload":"ON"}
#import scripts
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
customize: !include customize.yaml
任何帮助将不胜感激,因为我真的不知道我哪里出错了。是我的格式不正确,间距错误,还是我在某处漏掉了行尾?
这是因为 trigger:
和 action:
比 alias:
更缩进。它们需要处于相同的缩进级别。
当 trigger:
比 alias:
缩进更多时,它被读取为 alias
的标量值的一部分,有效地使该标量的值成为 Doorbell_pressed_automation\ntrigger
。但是,虽然允许使用多行标量,但不得将其用作隐式映射键。因此,当映射值在 trigger
的 :
之后开始时,您会收到错误消息,即 此处不允许映射值 。
我正在尝试使用 raspberry pi、家庭助理和电报制作门铃,但是在尝试向 configurations.yaml 添加部件时,我一直收到此错误。
Jul 14 15:49:19 homeassistant hass[9133]: 2020-07-14 15:49:18 ERROR (MainThread) [homeassistant.bootstrap] Failed to parse configuration.yaml: mapping values are not allowed here Jul 14 15:49:19 homeassistant hass[9133]: in "/home/pi/.homeassistant/configuration.yaml", line 23, column 12. Activating safe mode
这是我的配置文件。
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
camera:
- platform: mqtt
topic: dev/camera
# Text to speech
#tts:
# - platform: google_translate
notify:
- name: Telegram
platform: telegram
api_key: 1194049919:AAEC_sgl94lgVhFnWCcse9HXegC3A4_eZbY
chat_id: 1154840631
automation:
- alias: Doorbell_pressed_automation
trigger:
platform: mqtt
topic: dev/test
payload: 'Capture!'
action:
- service: automation.turn_off
entity_id: automation.doorbell_pressed_automation
- service: script.turn_on
entity_id: script.doorbell_pressed_script
- delay: "00:00:5"
- service: automation.turn_on
entity_id: automation.doorbell_pressed_automation
doorbell_pressed_script:
sequence:
- service: notify.Telegram
data:
title: Home Assistant Notification
message: --Doorbell Pressed--
data:
photo:
- url: http://192.168.1.15/images/image.jpg
caption: Doorbell View
dev_publish_on_script:
sequence:
- service: mqtt.publish
data: {"topic":"dev/test", "payload":"ON"}
#import scripts
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
customize: !include customize.yaml
任何帮助将不胜感激,因为我真的不知道我哪里出错了。是我的格式不正确,间距错误,还是我在某处漏掉了行尾?
这是因为 trigger:
和 action:
比 alias:
更缩进。它们需要处于相同的缩进级别。
当 trigger:
比 alias:
缩进更多时,它被读取为 alias
的标量值的一部分,有效地使该标量的值成为 Doorbell_pressed_automation\ntrigger
。但是,虽然允许使用多行标量,但不得将其用作隐式映射键。因此,当映射值在 trigger
的 :
之后开始时,您会收到错误消息,即 此处不允许映射值 。