i am relativly new to home assistant with very little coding knowledge but trying to learn. i am setting up grow tent right now. i have had all my sensors working in the past and when i put them in the template checker they all still work, but are not available. i am trying to split up config to make it easier as i will have an entire house with allot on it eventually. so i have made my template sensors work when they were in a templates.yaml file but as soon as i split it up into templates folder with sensor.yaml, binary_sensor.yaml etc inside the templates folder i cant get them to work i have put my .yaml files with different names in different spots in or out of folder, i have used the !include: in config. here are a couple snippets of my yaml to see if anyone can help me figure out the problem. i have changed everything so much i am lost now as to how it was. this is 1 sensor in the sensor.yaml file which is not in a folder
Once you’ve fixed the / that @armedad pointed out,
You have the sensor: heading in the !include line of the main file, so remove it from here. Sensor file should start:
- name: blah
It’s a bit confusing because your templates.yamlshould start with - sensor: or - binary_sensor as they are the “second level” under template:. The templates.yaml file you posted is correct.
Have you put them in a different folder? With the !include statements you’ve used (with the extra / removed), they should be in the same folder as configuration.yaml.
If you want to put them in folders and potentially split them up further, you can do something like this:
ok i am definetly going with the !include_dir_merge_list version where i can split up my files for organization. i now have set up a tent_templates.yaml and a air_quality_templates.yaml file in a templates folder. everything works in the tent_templates.yaml but nothing works that is in the air_quality_templates.yaml. if i use
automation: !include automations.yaml
are there any issues with mixing different sensors with switches with cameras etc. in 1 .yaml templates file?
do i need to use templates in the name of the file?
this is a pic of the VPD sensor which is in the air_quality_templatesss.yaml file just showing it works.
i have seen the Templates and sensor templates pages but is there any good documentation on what exactly to put where as far as syntax etc goes?
Thanks for everything by the way!!!
means “pull in all YAML files in the templates folder (or sub-folders) and join them all together”. You’ve introduced an unknown top-level heading with your new line.
Yes. If you want to split things that way, look into Packages instead.
No, any .yaml file in the templatesfolder will get read in.
ok i got the everything working. air_quality_templates.yaml was big indentation error. But as for mixing different entities in same file what is the issue. i do have binary sensors and sensors in 1 yaml and it is working? just getting into this but want to do it right the first time without even more ballistic learning curve. are packages not something i should look at in the future are they hard to setup and work around? P.S Great thanks for your help so far!!