alias: test
description: ''
trigger:
- platform: state
entity_id: input_boolean.testknop
condition: []
action:
- service: script.tekst_motor
data:
wie: Bureau
spreker: Google
tekst: !include ../teksten/tekst.yaml
volume: 0.5
mode: single
Hi, I am very new to HA. try to make a simple automation that says some text. What am I doing wrong here. HA does not accept the "!include …/teksten/tekst.yaml ". thanks in advance.
First off you need to start getting used to posting your code snippets properly formatted by using three back-ticks (```) on the line before and after the code block. it makes it hard to read and understand it if you don’t.
But you can’t use !include in a service call. You have to write the text out in that variable data line.
- service: script.tekst_motor
data:
wie: Bureau
spreker: Google
tekst: !include ../teksten/tekst.yaml #<-- replace this with the text in the file
volume: 0.5
The automation editor reacts differently than code stored in a .yaml file. Accordingly, the author of the youtube tutorial uses packages to insert .yaml files via !include.
I have created a file text.yaml in folder packages. When I check HA the configuration I get the following error"Error loading /config/configuration.yaml: in “/config/automations.yaml”, line 998, column 14: Unable to read file /config/…/text.yaml. " What is the problem here and how do I get this resolved?
automations.yaml represents the UI automation editor’s content. Create a file or a folder in your packages directory and put your automation into it:
# Example path: /config/packages/automations/custom_automations.yaml
# custom_automations.yaml:
automation:
- id: tekst_motor
alias: Tekst Motor
mode: single
max_exceeded: silent
trigger:
…
…
Thanks for your response. I don’t get it anymore. Don’t get it working!! I think this is still a bit too difficult for me. Will have to read and practice some more.
When I check configuration I get the following error: “Error loading /config/configuration.yaml: while scanning for the next token
found character ‘%’ that cannot start any token
in “/config/packages/tekst.yaml”, line 3, column 6”
Like this? Error loading /config/configuration.yaml: while scanning for the next token
found character ‘%’ that cannot start any token
in “/config/packages/tekst.yaml”, line 3, column 6
same error!