The file has become very long and a bit difficult to maintain. I would like to split it up into smaller files according to the sections. I have tried a few ways but couldnât get it to see all the variables/definitions/macros.
Is there a way I can split it up into smaller files and keep the functionality?
Hi Petro, do you know anyone who can advise me on installing lovelace_gen ?
I've been trying here for a few days now, but no chance of getting it to work
The problem is {% comma error
A question about this beautiful compoments.
I would like to replicate this piece of code:
{% set my_lights = ["light.bed_light", "light.kitchen_lights", "light.ceiling_lights"] %}
title: My view
cards:
- type: entities
entities:
{% for light in my_lights %}
- {{ light }}
{% endfor %}
but instead of setting up manually the list âmy_litghtsâ i would like to create it dinamycally.
Is it possible to for loop maybe using a group or create a list based on domain like âLightâ?
something like this
title: My view
cards:
- type: entities
entities:
{% for light in domain.light %}
- {{ light.entity_id }}
{% endfor %}
I saw it but donât think it is relevant for my configurations.
My UI is a single picture-elements with tens if not hundreds of elements on it. It is a single file (2105 lines and counting) all heavily using lovelace_gen and jinja.
The file is broken up into sections: Variables, Macros and then the elementsâ implementation that is split into seperate sections for each of the element types and visual areas of the UI
Is there a simple way of splitting it into files each of these sections? Variable, Macros, Lights, Covers, Settings, Irrigations, etc�
I have no idea because I donât know the contents of your files.
I think you should spend some time learning what includes actually do. They simply piece together information.
i.e.
foo:
- bar: Foobar
with incldues is
foo: !include something.yaml
something.yaml
- bar: Foobar
The same principle is applied here, however the yaml requires what the documents say. And then the information you pass is passed via the supplied variables. As long as you have a field, that field can be broken out like above.
I went over how include works (again) and try to implement it but had issues with my configuration as I have macros and for loops that make it problematic.
Is there a way to âincludeâ files as a simple concatenation? Meaning taking split files and appending them to each other without considering their content? Identation and fields will be taken care of inside each of the files as if they were already a single file.
I tried to use a simple page with only a button and it work fine.
I have retry with complete page, adding one card at a time and I found that the problem is here:
If I remove the code under icon: the page loading correctly and with passed parameters, otherwise, in the log, after a long python exception, I see this error:
jinja2.exceptions.UndefinedError: 'is_state' is undefined
As far as I can tell, lovelace-Gen does not provide the built in HASS extensions to work with state entities. Iâm looking for a solution that does. Did you ever figure this out?