To-do list card - select list

Hi,

As it now is possible with multiple lists -how do people actually use this?

Would love examples on how one can choose a list in a kiosked dashboard, without having to show the actual todo-dashboard either as a navigate option or a web-page.

Guess what is needed is some way to have a list box populate every list on card-load, and then change the list in the view card when selected.

1 Like

I completely agree, there absolutely needs to be a card that can provide access to all of your ToDo lists. I’ve come up with a solution using a couple different add-ons from hacs (card-mod, auto-entites, custom-layout-card, local-conditional cards, and mushroom cards) that should, more or less, be a plug and play solution, but it’s not pretty in the slightest (i mean it looks pretty good on your dashboard if you resize it to fit where you want, but the code is bbaaaddd). I’m sure there’s more elegant solutions than this, but it seems to be working ok-ish for now.

type: custom:layout-card
layout_type: custom:grid-layout
cards:
  - type: custom:mod-card
    card:
      type: custom:auto-entities
      view_layout:
        grid-area: chips
      filter:
        template: >-
          {% set lists = states.todo | rejectattr('entity_id',
          'is_hidden_entity') %}

          {% set data = namespace(chips=[]) %}

          {% for list in lists %}
            {% set lists = states.todo | rejectattr('entity_id', 'is_hidden_entity') %}
              {% set subdata = namespace(todos=[]) %}
              {% for list_id in lists %}
                {% if list_id.entity_id == list.entity_id %}
                  {% set state = 'show' %}
                  {% else %}
                  {% set state = 'hide' %}
                {% endif %}
                {% set subdata.todos = subdata.todos + [{list_id.attributes.friendly_name|lower|replace(' ','_'): state}] %}

              {% endfor %}

            {% set data.chips = data.chips + [
              {
                "type": "entity",
                "entity": list.entity_id,
                "icon_color": "accent",
                "tap_action": {
                  "action": "fire-dom-event",
                  "local_conditional_card": {
                    "action": "set",
                    "ids": subdata.todos
                    }
                  }
                }
            ] %}
          {% endfor %}

          {{ data.chips }}
      show_empty: true
      card_param: chips
      card:
        type: custom:mushroom-chips-card
        alignment: end
        card_mod:
          class: chips
    card_mod:
      style: |
        ha-card {
          z-index: 1
        }
  - type: custom:mod-card
    card:
      type: custom:auto-entities
      filter:
        template: >-
          {% set lists = states.todo | rejectattr('entity_id',
          'is_hidden_entity') %}
            {% set data = namespace(todo_list=[]) %}
            {% for list in lists %}
              {%- if list.entity_id == 'todo.shopping_list' -%}
                {%- set def_state = "show" %}
                {%- else %}
                {%- set def_state = "hide" %}
              {%- endif -%}
              {% set data.todo_list = data.todo_list + [
                {
                  "type": "custom:mod-card",
                  "view_layout": {
                    "grid-area": "todo"
                    },
                  "card": {
                    "type": "custom:local-conditional-card",
                    "id": list.attributes.friendly_name|lower|replace(' ','_'),
                    "default": def_state,

                    "card": {
                      "type": "todo-list",
                      "title": list.attributes.friendly_name,
                      "entity": list.entity_id,
                      "card_mod": {
                        "style": "ha-card {\nbackground: transparent; overflow-y: scroll !important; overflow-x: clip !important; height: calc((100vh - (150px)) * .9) !important; \n}"
                      }
                    }
                  } 
                }
              ] %}
          {% endfor %}

          {{ data.todo_list }}
      show_empty: true
      card_param: cards
      card:
        type: custom:layout-card
        layout_type: custom:grid-layout
        layout:
          grid-template-rows: calc((100vh - (60px)) * .9)
          grid-template-areas: |
            "todo"
      view_layout:
        grid-area: list
layout:
  grid-template-areas: |
    "chips"
    "list"
  grid-template-rows: 10px calc((100vh - (85px)) * .9)
card_mod:
  style: |
    ha-card {
      overflow: scroll;
    }

2 Likes