You most likely have to name each one then. Merging lists will work, see the automations section of the link I posted.
EDIT: Or that only works on the automation section, but I doubt that.
You most likely have to name each one then. Merging lists will work, see the automations section of the link I posted.
EDIT: Or that only works on the automation section, but I doubt that.
If you name them all it doesn’t even compile the configuration.
If you are referring to the last paragraph of the link, it doesn’t use !include
several times like in your example, it mixes !include_dir_merge_list
and !include
, each used once.
include vrs include_merge_dir_lists is just how they compile the included file(s) into the main file. You can use both as !include. This must only work on the automation section.
EDIT: Nevermind, just checked the code, it just doesn’t work on the template section.
I don’t think that’s correct. You can’t use an !include
if you are including multiple files with lists like in my example. Your first post looks like the way to go.
Can you paste the code you are referring to from your link? I couldn’t find your example anywhere in the page.
The example doesn’t have to match exactly… it’s just how include works. Include just takes a file and plops the contents as yaml into the field. Splitting 1 section between two files is possible with naming, the example is at the bottom. You’re confusing !include and !include_merge_lists as mutually exclusive, which they are not.
This is the example:
# My own handmade automations
automation manual: !include_dir_merge_list automations/
# Automations I create in the UI
automation ui: !include automations.yaml
while this is entirely possible
# My own handmade automations
automation manual: !include_dir_merge_list room1/
# My own handmade automations
automation manual2: !include_dir_merge_list room2/
# My own handmade automations
automation manual3: !include_dir_merge_list room3/
# My own handmade automations
automation manual4: !include some_other_automations.yaml
# Automations I create in the UI
automation ui: !include automations.yaml
I didn’t test the first example block from the documentation, but the configuration from your second block of code doesn’t compile if you replace automation
with template
, probably the files linked have a different structure, dunno.
Yes, did you even read my response or are you busy arguing…
Yeah, I’ve also read all your other non working examples and guesswork fixes, so I guess I wanted to double check.
You mean that one single non-working post based on an assumption on how the all the other fields in home assistant work? The template field is a special case, I’m sorry that single post ruined your evening.
FWIW, I just re-organized my Template entities using what I had suggested earlier and can confirm it works (as expected).
I created a sub-directory called templates
and moved all of my existing Template entities (58 in total and all are defined using the new format) into separate files, organized by the entity’s type. There are five files within the templates
directory:
The configuration.yaml
file now contains this:
template: !include_dir_merge_list templates/
It passes Check Configuration and, after restarting Home Assistant, all 58 Template entities are properly generated.
Yes, that’s what I use in my config
So I wasn’t completely wrong. I just added a stray “_” in my suggestion.
It really doesn’t work the same as the rest.
Ya. I think this all stems from how bad this stuff was hamfisted into HA back in the day. Still hasn’t been refactored
Petro you helped me understand this splitting issue in another thread a couple of years ago. I believe there was 4 or 5 messages back and forth that I finally understood. Maybe if you have time you can add many of the pictures you posted to the docs?
you got a link to that convo?
Sorry I didn’t link it before ( I was on the my phone and it wasn’t easy to find).
https://community.home-assistant.io/t/lovelace-button-card/65981/3285
We had several messages back and forth for me to (almost) understand. I still make mistakes sometimes.
You took a lot of time walking me through this with pictures and it was very helpful.
Ah, ok, I forgot about that
Ok so now I’m playing around with a very simple template…
This is my template called presence.yaml that I put in my sensor folder [and my sensor folder is included in my config.yaml].
- platform: template
sensors:
john_presence:
friendly_name: John presence
value_template: >-
{% if is_state (device_tracker.sm_f926u1, away) %}
John's Out {% else %}
John's In {% endif %}
to that end I put this in my lovelace.yaml:
##################################################################
# Bathroom INFO #
##################################################################
- title: Bathroom
icon: mdi:paper-roll
cards:
- type: horizontal-stack
cards:
- <<: *cb_spacer_10px
- type: entities
entities:
- sensor.john_presence
I get back:
John’s presence unavailble
Where did I go wrong? or what did I not do
Always consult the under the hood state in the developer tools → states page. There, you’ll see that away is not a state used by device_trackers.
Secondly, you’re missing quotes around all your strings.
{% if is_state('device_tracker.sm_f926u1', 'not_home') %}
Ok that makes sense! NOW to figure out how to show pictures instead