Dal
1
Hi
I’m trying to move some templates out of configuration.yaml to customize.yaml.
But it gives me errors.
This is the config:
- platform: template
sensors:
vitaminer:
value_template: >-
{% if is_state ('input_boolean.vitaminer_tatt', 'on') %}
YESS
{% elif is_state ('input_boolean.vitaminer_tatt', 'off') %}
BUHU
{% endif %}
icon_template: >-
{% if is_state ('input_boolean.vitaminer_tatt', 'on') %},
mdi:mdi-thumb-up
{% elif is_state ('input_boolean.vitaminer_tatt', 'off') %}
mdi-thumb-down,
{% endif %}
But when I check configuration, it says:
expected a dictionary for dictionary value @ data[‘customize’]
When the config is in configuration.yaml, it works fine.
What am I doing wrong?
Thanks.
You can’t move template sensors to customize.yaml. Customize is to set friendly names, icons etc… not sensors.
Dal
3
Thanks for clearing that up.
Strangely enough, I’m not able to move the config back to configuration.yaml now.
- platform: template
sensors:
vitaminer:
value_template: >-
{% if is_state ('input_boolean.vitaminer_tattt', 'on') %}
YESS
{% elif is_state ('input_boolean.vitaminer_tatt', 'off') %}
BUHU
{% endif %}
icon_template: >-
{% if is_state ('input_boolean.vitaminer_tatt', 'on') %},
mdi:mdi-thumb-up
{% elif is_state ('input_boolean.vitaminer_tatt', 'off') %}
mdi-thumb-down,
{% endif %}
The file editor throws an error, saying:
bad indentation of a mapping entry at line 23, column 3:
- platform: template
Thanks
From the second line on your indent needs to be increased by 2 spaces and for the love of God, backup those files before you edit them
Dal
5
Finally figured it out, it had to be under sensor: to work.
I made a separate file for sensor: now, to avoid cluttering the configuration.yaml file
Yes, backups are learnt the hard way for me today.
Thanks again.
1 Like
good job… you might in the future like to look at using packages for declutering