Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All templates missing #6

Open
cgagliano opened this issue Oct 10, 2023 · 9 comments
Open

All templates missing #6

cgagliano opened this issue Oct 10, 2023 · 9 comments
Assignees

Comments

@cgagliano
Copy link

Hello there,

Wanted to bring up an issue I've been having. I've followed your instructions for installation; from a Home Assistant terminal session I've navigated to where the ui-lovelace.yaml is located and cloned this repository. I've also added the following to the top of my ui-lovelace.yaml file:
button_card_templates: !include_dir_merge_named creative-button-card-templates/
Each time that I attempt to use one of the templates, I get the same error:

Button-card template 'title' is missing!
type: custom:button-card
template: title

Any guidance or direction would be greatly appreciated.

Thanks!
Carlos

@wfurphy
Copy link
Owner

wfurphy commented Oct 14, 2023

Hi Carlos,

Can you please double-check that when you cloned the repository it created the folder creative-button-card-templates/ and that it contains all of the folders and .yaml files?

@cgagliano
Copy link
Author

Hey Will,

Thanks for the quick attention. As far as I can see, it did create the folder and it contains all the appropriate files:
Screenshot 2023-10-14 at 12 38 12 PM

Any thoughts?

@wfurphy
Copy link
Owner

wfurphy commented Oct 27, 2023

Hrmmmmm I see, just a few more qualifying questions then:

  • Are you able to create a generic button-card yourself without any issue?
  • Where is your code located for building your cards? In ui-lovelace.yaml?
  • Would you mind posting the code of one of your dashboards where you're trying to use the card? (Make sure to remove any private info)
  • Are the permissions the same for creative-button-card-templates as the other folders/files used by lovelace/HA config? This may include checking the permissions inside the HA docker container, I'm not sure what setup of HA you are running.
  • Do you use !include* elsewhere in your HA yaml config?

@cgagliano
Copy link
Author

Hey Will,

Thanks for your continued attention to this. I'll answer the questions to the best of my ability.

  • Are you able to create a generic button-card yourself without any issue?

  • Yes

  • Where is your code located for building your cards? In ui-lovelace.yaml?

  • The code for each card is in its respective dashboard

  • Would you mind posting the code of one of your dashboards where you're trying to use the card? (Make sure to remove any private info)

  • No problem! Posting it at the bottom.

  • Are the permissions the same for creative-button-card-templates as the other folders/files used by lovelace/HA config? This may include checking the permissions inside the HA docker container, I'm not sure what setup of HA you are running.

  • All permissions should be the same. I'm not using a Docker container for this setup yet.

  • Do you use !include* elsewhere in your HA yaml config?

  • There are various !include statements in the configuration.yaml file. Most of them are in the default files

Dashboard code:
button_card_templates:
picture_button:
aspect_ratio: 1/1
color_type: icon
hold_action:
action: none
layout: vertical
show_entity_picture: true
show_icon: false
show_label: false
show_name: false
show_state: false
styles:
card:
- '--ha-card-background': rgba(0, 0, 0, 0)
entity_picture:
- width: 100%
- height: 100%
- object-fit: contain
tap_action:
action: call-service
views:

  • title: Lights Control
    cards:
    • square: false
      type: grid
      title: Lights Control
      cards:
      • show_name: true
        show_icon: true
        color: black
        name: Living Room
        entity: light.living_room
        icon: mdi:lightbulb-group
        type: button
        tap_action:
        action: call-service
        service: pyscript.lights_on_off
        target: {}
        data:
        group: lrLights
      • show_name: true
        show_icon: true
        name: Kitchen
        entity: light.kitchen
        icon: mdi:lightbulb-group
        type: button
        tap_action:
        action: call-service
        service: pyscript.lights_on_off
        target: {}
        data:
        group: kLights
      • show_name: true
        show_icon: true
        name: Upstairs
        entity: light.upstairs
        icon: mdi:lightbulb-group
        type: button
        tap_action:
        action: call-service
        service: pyscript.lights_on_off
        target: {}
        data:
        group: uLights
    • square: false
      type: grid
      title: Brightness
      cards:
      • show_name: true
        show_icon: true
        type: button
        icon: mdi:numeric-1
        tap_action:
        action: call-service
        service: pyscript.change_brightness
        target: {}
        data:
        b: 1
      • show_name: true
        show_icon: true
        type: button
        icon: mdi:numeric-2
        tap_action:
        action: call-service
        service: pyscript.change_brightness
        target: {}
        data:
        b: 2
      • show_name: true
        show_icon: true
        type: button
        icon: mdi:numeric-3
        tap_action:
        action: call-service
        service: pyscript.change_brightness
        target: {}
        data:
        b: 3
      • show_name: true
        show_icon: true
        type: button
        icon: mdi:numeric-4
        tap_action:
        action: call-service
        service: pyscript.change_brightness
        target: {}
        data:
        b: 4
      • show_name: true
        show_icon: true
        type: button
        icon: mdi:numeric-5
        tap_action:
        action: call-service
        service: pyscript.change_brightness
        target: {}
        data:
        b: 5
        columns: 5
    • square: false
      type: grid
      title: Scenes
      cards:
      • type: custom:button-card
        template: picture_button
        entity_picture: /local/light-button-icons/dimBulb.png
        tap_action:
        action: call-service
        service: pyscript.change_scheme
        target: {}
        data:
        scheme: dim
      • type: custom:button-card
        template: picture_button
        entity_picture: /local/light-button-icons/standardBulb.png
        tap_action:
        action: call-service
        service: pyscript.change_scheme
        target: {}
        data:
        scheme: standard
      • type: custom:button-card
        template: picture_button
        entity_picture: /local/light-button-icons/brightBulb.png
        tap_action:
        action: call-service
        service: pyscript.change_scheme
        target: {}
        data:
        scheme: bright
      • type: custom:button-card
        theme: noctis
        template: picture_button
        entity_picture: /local/light-button-icons/warmColors.png
        tap_action:
        action: call-service
        service: pyscript.change_scheme
        target: {}
        data:
        scheme: warmColors
      • type: custom:button-card
        template: picture_button
        entity_picture: /local/light-button-icons/coolColors.png
        tap_action:
        action: call-service
        service: pyscript.change_scheme
        target: {}
        data:
        scheme: coolColors
      • type: custom:button-card
        template: picture_button
        entity_picture: /local/light-button-icons/snowIce.png
        tap_action:
        action: call-service
        service: pyscript.change_scheme
        target: {}
        data:
        scheme: snowIce
      • type: custom:button-card
        template: picture_button
        entity_picture: /local/light-button-icons/pumpkin2.png
        tap-action: call-service
        tap_action:
        action: call-service
        service: pyscript.change_scheme
        target: {}
        data:
        scheme: bengals
      • type: custom:button-card
        template: picture_button
        entity_picture: /local/light-button-icons/greens.png
        tap_action:
        action: call-service
        service: pyscript.change_scheme
        target: {}
        data:
        scheme: greens
      • type: custom:button-card
        template: picture_button
        entity_picture: /local/light-button-icons/rainbow.png
        tap_action:
        action: call-service
        service: pyscript.change_scheme
        target: {}
        data:
        scheme: rainbow
      • type: custom:button-card
        template: picture_button
        entity_picture: /local/light-button-icons/brazil.png
        tap_action:
        action: call-service
        service: pyscript.change_scheme
        target: {}
        data:
        scheme: brazil
      • type: custom:button-card
        template: picture_button
        entity_picture: /local/light-button-icons/usa.png
        tap_action:
        action: call-service
        service: pyscript.change_scheme
        target: {}
        data:
        scheme: usa
      • type: custom:button-card
        template: picture_button
        entity_picture: /local/light-button-icons/christmas.png
        tap_action:
        action: call-service
        service: pyscript.change_scheme
        target: {}
        data:
        scheme: christmas
        columns: 3

@wfurphy
Copy link
Owner

wfurphy commented Nov 1, 2023

Hi again Carlos,

When you say "The code for each card is in its respective dashboard" do you mean each dashboard has it's own yaml file that is included in ui-lovelace.yaml? Or are you referring to editing the YAML in the Home Assistant UI?

Another thing I noticed is that the first line of your dashboard code is button_card_templates: which is a potential problem as you already specified that in the ui-lovelace.yaml correctly and this may be overriding it or confusing it at least.

@wfurphy
Copy link
Owner

wfurphy commented Nov 2, 2023

I had a read over this again and I'm fairly certain the issue is that you are redefining button_card_templates in your dashboard code when you have already defined it, correctly for using these templates, in ui-lovelace.yaml.

If you wish to add your own template picture_button you can add a .yaml file for it in the creative-button-card-templates/custom/ folder.

@cgagliano
Copy link
Author

Hi Will,

I think I misunderstood your question about the code for each card. I'm brand new to Home Assistant and YAML in general. It does seem like the code you were asking about is in ui-lovelace.yaml. I'd be happy to provide it (or an excerpt) if it'd help.

I did create a brand new testing dashboard and attempted to create a new custom button card with template "title" and was still greeted with the same "Button-card template 'title' is missing!" error.

I also noticed that if I change the first line on my dashboard to anything else, it breaks the "picture_button" items.

Any hope for this, or should I just burn the whole thing down and start over?

Thanks again for your continued attention to this. It's greatly appreciated.

@wfurphy
Copy link
Owner

wfurphy commented Jan 4, 2024

@cgagliano Sorry for the delay on getting back to you here. I just had a look at this with fresh eyes though. Hopefully you still want to try and get it working?

I think I made it a tad confusing because I assumed by the way you asked the question that you are using your dashboards in YAML mode, but I should have asked. Do you have dashboards configured in yaml mode and are editing them in the YAML files or are you editing dashboards within the Home Assistant user interface?

Either way it looks as though you are overriding the button_card_templates: property which is set in ui-lovelace.yaml with the one you are setting in the dashboard code you posted above. You can't set this twice. So solutions are:

  • YAML Mode: If you're using YAML mode and have added the correct code to ui-lovelace.yaml as you said you have then you can add any .yaml file to the creative-button-card-templates/custom folder and it will add your custom template in automatically. There's an example in there to help get you started.

  • UI (Storage) Mode: If you're using the UI then you'll need to paste the code in as per the instructions but you can add your own custom templates either at the top or the bottom of the code that is pasted under button_card_templates:.

Sorry I didn't pick this up first time round - if you are able to enclose any code you post in a code block (surrounded by three (3) backticks) that would be a massive help moving forward. I'm precious and can't read the code properly without syntax highlighting and formatting, haha.

Hope this isn't too late and helps you to solve the issue.

@cgagliano
Copy link
Author

Hi @wfurphy! Thanks so much for the continued attention to this. And no worries! I understand that we all get busy. In fact, I'm kinda going through it right now. I haven't had a chance to fully review your last message, but I'll take some time this week and I'll keep you posted.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants