Sensor template not working

Sorry for the noob question. I have scrub the forums for the answer but still can not figure out what I am doing incorrectly.

Please find attached picture

I test the template in the template editor but whenever I add it to the config.yaml file, I get the green checker, but it does not pass validation.

any help / insight on what I am. doing wrong will be appreciated.

The validation will give you an error with the file and line number, so that information would help greatly. However, I have a feeling that a sensor name of “Apple TV” will not work, but “apple_tv” would.

Otherwise, posting the formatted config would help to make sure spacing is correct.

- platform: template
sensors:
apple_tv_family_room:
    value_template: '{% if is_state("device_tracker.atv_familyroom", "home") %}online{% else %}offline{% endif %}'
    friendly_name: 'Apple TV (Familyroom)'

I have included the error message I keep on getting when trying to validate the config.yalm file.

Incorrect alignment (number of spaces), necessary:

  - platform: template
    sensors:
      apple_tv_family_room:
        value_template: '{% if is_state("device_tracker.atv_familyroom", "home") %}online{% else %}offline{% endif %}'
        friendly_name: 'Apple TV (Familyroom)'

screen

OMG you really helped me out, that did that trick – I passed Configuration validation.

What was I doing wrong? so I deleted the pi_hole sensor, but I will really like to have them. but for now I can do more reading to figure out what I was doing wrong to begin with.

What editor are you using “atom” (if so) what did you have to enable to have it trace out with the lines so I can catch my errors?

pi_hole doesn’t need to be removed, he’s fine. I removed it to reduce the amount of code on the screenshot.

The editor on the screenshot is VSCode + Home Assistant Config Helper extension.

1 Like

Thanks a million!
No more using the built in hassio configurator for me.

I am going to clean up my configure file. really appreciate your guidance and insight.

I want to extend my appreciation to you for introducing me to VScode, I was able to resolved many of my problems (noob I am) with this tool. Thanks again., and again…

1 Like