Attempting to switch to YAML mode and lovelace_gen

I thought that only applied to ui-lovelace/ui_lovelace.yaml and since I wasn’t using that, it didn’t apply.

So, I should simply remove #lovelace_gen from Test.yaml, but then what?

It specifically says “#lovelace_gen” only works in lovelace_gen included files. It has to be !included via the documented ways to include files.

FYI this is my main view file

OK, so it’s ui**(dash)**lovelace.yaml and it is required to get lovelace_gen to work (simply as a place to !include the actual .yaml files). That’s two less things I can stop researching :wink:

I did previously try that, but didn’t include the "views: " Here’s what I’ve got now in ui-lovelace.yaml:
image

I’ve kept the # lovelace_gen at the top of Test.yaml, restarted HA, and cleared my browser cache and I’m still getting the token error.

verify that your syntax for lovelace is correct. I.e. test.yaml does not have views because you’re specifying it in the main area.

Also, ddi you install lovelace_gen or did you simply add the line to your config?

To check my syntax (since I’m still learning), I just created a new UI dashboard, added a Picture Elements card, and opened the Raw configuration editor. The only line I added to it was the type: panel line since that’s how I’d like the Test dashboard to render. It looks like this and it works.

To rule out possible issues, I removed the theme and badge lines from Test.yaml and restarted HA. Same issue.

To configure for using lovelace_gen, I followed the Installation Instructions here ( thomasloven/hass-lovelace_gen: :small_blue_diamond: Improve the lovelace yaml parser for Home Assistant (github.com)). I just looked and I see it in HACS. I’ll try deleting the two files from my manual configuration and try to install that.

image

EDIT: maybe you dont understand what I’m saying: Delete views: from your test.yaml file.

OK, I installed lovelace_gen via HACS using the master branch (correct?).

I deleted views: and outdented the remaining lines:

Same error.

You have to restart after installing lovelace_gen

I did…and again after making these changes to Test.yaml

Master branch, right?

Then, based on what I’ve seen (bar syntax errors in jina) it should work.

Do you have a simple lovelace_gen enabled .yaml you could share with me to check basic functionality?

you can create one yourself. Just remove all the code from your lovelace_gen files and get a separate view working with the !include.

TBH, to me it seems like you don’t have basic lovelace yaml functionality nailed down and you’re trying to install the hardest, most complicated lovelace modification. You’re trying to run before you know how to walk.

OK. Thanks for all your help. I’ll keep trying to figure it out.

Yeah, I know what you’re saying. I’ve watched plenty of yaml syntax videos, but ultimately I just need lovelace_gen to work for this one view. As you mentioned, we’ve ruled out the issues and its still not working. For things like this, I usually find that reverse engineering working code is the best way for me to learn (e.g. referencing the Raw configuration editor), but for some reason, that doesn’t seem to be a winning strategy in this case. :man_shrugging:

@thomasloven You might want to mention that lovelace_gen is available to install via HACS on your lovelace_gen GitHub page. Also, thanks to you and @petro and the team for creating it and many other HA integrations. I’ll eventually figure out how to harness its power! :laughing:

well you don’t understand basic yaml. Skipping the regular code. You’re making simple mistakes with the yaml, not even the lovelace_gen side.

Bare minimum, this will work:

ui-lovelace.yaml

title: Home
# Exclude entities from "Unused entities" view

views: !include master.yaml

master.yaml

#lovelace_gen
{% set bar = 'bar' %}

- title: Foo
  cards:
  - type: markdown
    content: {{ bar }}

Correct. I do not understand basic yaml. I’ve admitted that at least twice now, but also explained how I’m trying to learn it. I’m not sure how else you’d like me to learn yaml when so much of the basic dashboard design is UI driven. I tried your sample code which also didn’t work for me, so it seems clear to me that something else is (also) going on with my configuration (my issue, not yours).

Again, thank you for your help.

You should try creating the dashboard without Lovelace gen in yaml. Then switch to Lovelace gen. You’d learn the basics of yaml and using !include

For anyone reading this in the future, I got this working after reading this post entry (🔹 Lovelace_gen - Add abilities to ui_lovelace.yaml - #98 by thomasloven).

  1. Using YAML mode with multiple dashboards - When using YAML (with or without lovelace_gen), you only have to put ui-lovelace.yaml into YAML mode if you intend to set your primary dashboard to YAML. That primary dashboard can be left in UI or storage mode and you can selectively set the dashboards you intend to use to YAML mode allowing them to be optionally configured for lovelace_gen ( Multiple Dashboards - Home Assistant (home-assistant.io)).

  2. EVERY dashboard that uses lovelace_gen must have the main YAML file set to reference the #lovelace_gen commented file - The important note here ( hass-lovelace_gen/README.md at master · thomasloven/hass-lovelace_gen (github.com)) mentions it for the primary dashboard (ui-lovelace.yaml), but this also applies to any secondary dashboard using lovelace_gen.

Ironically, after figuring this out, I now feel like I have the basic dashboard structure to experiment (e.g. yaml, lovelace_gen, etc.) in sandbox dashboards without affecting my default dashboard to create code that I can copy over when it’s properly configured.

configuration.yaml

YAMLSandbox.yaml:

YAMLSandboxIncluded.yaml:
image

I intend to make my contribution to HA by submitting recommendations for improved documentation based on what I’ve learned.

3 Likes

Hi, can you help me please?

I didn’t find Developer tools → Info

And I did the same as your images above but the comma {% error remains

I’ll do what I can.

What are you looking for in Developer Tools…and why?

I need more info on what you’re trying to do and some of the code you’re using in order to help.