custom-cards / button-card

❇️ Lovelace button-card for home assistant
MIT License
1.97k stars 242 forks source link

Button-card template 'menu_button' is missing! #851

Closed 400HPMustang closed 3 months ago

400HPMustang commented 5 months ago

Checklist

Describe the bug Building a button card, trying to use the template 'menu_button' and receive the error is missing. This happens when trying to build the simplest of cards but here is a complex configuration that doesn't build either.

Version of the card Version: 4.1.2

To Reproduce This is the configuration I used:

entities:
  - card_type: horizontal-stack
    cards:
      - entity: sensor.front_door_status_sc_2
        card_mod:
          style: |
            ha-card {
              {% if states('sensor.front_door_status_sc_2') == 'Locked' %}
                --card-mod-icon-color: green;
              {% elif states('sensor.front_door_status_sc_2') == 'Unlocked' %}
                --card-mod-icon-color: red;
              {% elif states('sensor.front_door_status_sc_2') == 'Open' %}
                --card-mod-icon-color: blue;
              {% elif states('sensor.front_door_status_sc_2') == 'Closed' %}
                --card-mod-icon-color: yellow;
              {% else %}
                --card-mod-icon-color: orange;
              {% endif %}
                 } 
        tap_action:
          action: call-service
          service: |
            [[[
              return (entity.state === 'Locked') ? 'lock.unlock' : 'lock.lock';
            ]]]
          service_data:
            entity_id: lock.front_door
        name: Front
        template: menu_button
        type: custom:button-card
      - entity: sensor.porch_door_status_sc
        card_mod:
          style: |
            ha-card {
                {% if states('sensor.porch_door_status_sc') == 'Locked' %}
                --card-mod-icon-color: green;
                {% elif states('sensor.porch_door_status_sc') == 'Unlocked' %}
                --card-mod-icon-color: red;
                {% elif states('sensor.porch_door_status_sc') == 'Open' %}
                --card-mod-icon-color: blue;
                {% elif states('sensor.porch_door_status_sc') == 'Closed' %}
                --card-mod-icon-color: yellow;
                {% else %}
                --card-mod-icon-color: orange;
                {% endif %}
                     }
        tap_action:
          action: call-service
          service: |
            [[[
              return (entity.state === 'Locked') ? 'lock.unlock' : 'lock.lock';
            ]]]
          service_data:
            entity_id: lock.deck
        name: Porch
        template: menu_button
        type: custom:button-card
      - entity: sensor.breezeway_door_status_sc
        card_mod:
          style: |
            ha-card {
                {% if states('sensor.breezeway_door_status_sc') == 'Locked' %}
                --card-mod-icon-color: green;
                {% elif states('sensor.breezeway_door_status_sc') == 'Unlocked' %}
                --card-mod-icon-color: red;
                {% elif states('sensor.breezeway_door_status_sc') == 'Open' %}
                --card-mod-icon-color: blue;
                {% elif states('sensor.breezeway_door_status_sc') == 'Closed' %}
                --card-mod-icon-color: yellow;
                {% else %}
                --card-mod-icon-color: orange;
                {% endif %}
                     }
        tap_action:
          action: call-service
          service: |
            [[[
              return (entity.state === 'Locked') ? 'lock.unlock' : 'lock.lock';
            ]]]
          service_data:
            entity_id: lock.breezeway
        name: Breezeway
        template: menu_button
        type: custom:button-card
      - entity: sensor.basement_door_status_sc
        card_mod:
          style: |
            ha-card {
                {% if states('sensor.basement_door_status_sc') == 'Locked' %}
                --card-mod-icon-color: green;
                {% elif states('sensor.basement_door_status_sc') == 'Unlocked' %}
                --card-mod-icon-color: red;
                {% elif states('sensor.basement_door_status_sc') == 'Open' %}
                --card-mod-icon-color: blue;
                {% elif states('sensor.basement_door_status_sc') == 'Closed' %}
                --card-mod-icon-color: yellow;
                {% else %}
                --card-mod-icon-color: orange;
                {% endif %}
                     }
        name: Basement
        tap_action:
          action: call-service
          service: |
            [[[
              return (entity.state === 'Locked') ? 'lock.unlock' : 'lock.lock';
            ]]]
          service_data:
            entity_id: lock.basement
        template: menu_button
        type: custom:button-card
    type: custom:hui-element
  - card_type: horizontal-stack
    cards:
      - entity: sensor.garage_door_status_sc
        card_mod:
          style: |
            ha-card {
                {% if states('sensor.garage_door_status_sc') == 'Locked' %}
                --card-mod-icon-color: green;
                {% elif states('sensor.garage_door_status_sc') == 'Unlocked' %}
                --card-mod-icon-color: red;
                {% elif states('sensor.garage_door_status_sc') == 'Open' %}
                --card-mod-icon-color: blue;
                {% elif states('sensor.garage_door_status_sc') == 'Closed' %}
                --card-mod-icon-color: yellow;
                {% else %}
                --card-mod-icon-color: orange;
                {% endif %}
                     }
        tap_action:
          action: call-service
          service: |
            [[[
              return (entity.state === 'Locked') ? 'lock.unlock' : 'lock.lock';
            ]]]
          service_data:
            entity_id: lock.garage
        template: menu_button
        name: Garage
        type: custom:button-card
      - entity: sensor.garage_east_door_status_sc
        card_mod:
          style: |
            ha-card {
              {% if states('cover.garage_door_2') == 'open' %}
                --card-mod-icon-color: red;
              {% elif states('cover.garage_door_2') == 'closed' %}
                --card-mod-icon-color: green;
              {% else %}
                --card-mod-icon-color: orange;
              {% endif %}
                 } 
        tap_action:
          action: call-service
          service: cover.toggle
          target:
            entity_id: cover.garage_door_2
        name: East
        template: menu_button
        type: custom:button-card
      - entity: sensor.garage_west_door_status_sc
        card_mod:
          style: |
            ha-card {
              {% if states('cover.garage_door') == 'open' %}
                --card-mod-icon-color: red;
              {% elif states('cover.garage_door') == 'closed' %}
                --card-mod-icon-color: green;
              {% else %}
                --card-mod-icon-color: orange;
              {% endif %}
                 } 
        tap_action:
          action: call-service
          service: cover.toggle
          target:
            entity_id: cover.garage_door
        name: East
        template: menu_button
        type: custom:button-card
      - entity: sensor.garage_shop_door_status_sc
        card_mod:
          style: |
            ha-card {
              {% if states('cover.sgarage') == 'open' %}
                --card-mod-icon-color: red;
              {% elif states('cover.sgarage') == 'closed' %}
                --card-mod-icon-color: green;
              {% else %}
                --card-mod-icon-color: orange;
              {% endif %}
                 } 
        tap_action:
          action: call-service
          service: cover.toggle
          target:
            entity_id: cover.sgarage
        name: Shop
        template: menu_button
        type: custom:button-card
    type: custom:hui-element
show_header_toggle: false
title: All Doors
type: entities

Screenshots If applicable, add screenshots to help explain your problem.

image

Expected behavior I would expect the card to compile without an error.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

pedolsky commented 4 months ago

Did you create a template named 'menu_button'?

Opontios commented 3 months ago

You have to create a template first, then to use it.

Mariusthvdb commented 3 months ago

please close.....