Buttons in Entities card requires useless configuration entries

I tried adding buttons to ‘entities’ card, as described here:

This is what I did:

type: entities
entities:
  - type: buttons
    entities:
      - entity: switch.living_room_tv
        name: TV
      - entity: binary_sensor.always_off
        icon: mdi:video-input-hdmi
        name: HDMI 1
        tap_action:
          action: call-service
          service: remote.send_command
          service_data:
            entity_id: remote.rm4_pro_remote
            device: lg_tv
            command: hdmi_1

I used a special template sensor ‘always off’ to have an entity to use (it’s required) and keep the ‘disabled’ color. (A side question - is there a better way to do that?)

But the Lovelace code editor doesn’t let me save this config. It says:

Configuration errors detected:

* Required key "entities.0.entity" is missing.
* Required key "entities.0.name" is missing.
* Required key "entities.0.tap_action" is missing.
* Required key "entities.0.tap_action" is missing.
* Required key "entities.0.tap_action" is missing.
* Required key "entities.0.tap_action" is missing.
* Required key "entities.0.tap_action" is missing.
* Required key "entities.0.view" is missing.
* Required key "entities.0.view" is missing.
* Required key "entities.0.view" is missing.
* Required key "entities.0.conditions" is missing.
* Required key "entities.0.url" is missing.
* Required key "entities.0.entity" is missing.
* Required key "entities.0.attribute" is missing.
* Required key "entities.0.name" is missing.
* Required key "entities.0.service" is missing.
* Required key "entities.0.name" is missing.
* Required key "entities.0.text" is missing.

To have it working, I had to add extra lines:

type: entities
entities:
  - type: buttons
    entity: null
    name: null
    tap_action: null
    view: null
    conditions: null
    url: null
    attribute: null
    service: null
    text: null
    entities:
      - entity: switch.living_room_tv
        name: TV
      - entity: binary_sensor.always_off
        icon: mdi:video-input-hdmi
        name: HDMI 1
        tap_action:
          action: call-service
          service: remote.send_command
          service_data:
            entity_id: remote.rm4_pro_remote
            device: lg_tv
            command: hdmi_1

And with those changes it works as expected.
But it feels weird to have to add all those entries… Am I doing something wrong?

What you added is unrelated to the error message.
You might have had an alignment issue the first time.
I’d bet removing them won’t make any difference, now.

It is related. Removing even a single of those additional entries makes the corresponding error to come back.

Doesn’t make any sense, as the options you added are not even valid for type: buttons.
Maybe a plain bug of the lovelace UI…

I do separate button for each entity:

Also, isn’t it button and not buttons ?

type: entities
entities:
  - type: button
    entity: switch.living_room_tv
    name: TV
  - type: button
    entity: binary_sensor.always_off
    icon: mdi:video-input-hdmi
    name: HDMI 1
    tap_action:
      action: call-service
      service: remote.send_command
      service_data:
        entity_id: remote.rm4_pro_remote
        device: lg_tv
        command: hdmi_1

According to the docs, it can be either ‘button’ or ‘buttons’. The latter puts multiple buttons in one row, which is what I want :slight_smile:

So it has, sorry, never spotted that before, was using hoizontal stack and button card, time to have a look at my config !

EDIT: Just tried pasting your config in one of my cards (changing only the entities) and it works fine

I tried changing things some more, and ‘button’ doesn’t work either…

This works fine:

type: entities
entities:
  - entity: switch.living_room_tv

This causes the editor to complain about missing keys (Required key “entities.0.name” is missing - etc.):

type: entities
entities:
  - type: button
    entity: switch.living_room_tv

Am I editing it in the wrong place?
I opened the dashboard, and selected ‘edit dashboard’ in the top right corner, then ‘add card’ and ‘entities’ card, where I clicked ‘show code editor’ and that editor is giving me those errors…

I am running core-2021.6.6/supervisor-2021.06.6 version.

Obviously there is something different about my setup, any idea how to determine what is wrong?

Or maybe it’s just the editor that’s picky, is there a different way to edit Lovelace dashboard configuration?

Thanks…

Sorry, I use YAML mode for my lovelace so not sure how you do it from there

That’s the “code editor”, or is it something else? How do you access it?

Wanted to say I am also experiencing this with the latest update. It used to work fine 2-3 weeks ago.

I have existing cards that are working perfectly. However, when I edit these HA shows configuration errors requiring useless keys and preventing me from saving changes.

So I am now making the changes I need using the raw configuration editor till this gets fixed.
Giving a snapshot of what my card looks like and the errors below. If I can provide additional information to help, please let me know.

type: entities
entities:
  - type: button
    icon: mdi:snowflake
    name: AC Off
    action_name: Run
    tap_action:
      action: call-service
      service: remote.send_command
      service_data:
        entity_id: remote.rm4_remote
        command: b64:BASE64CodeHERE
        num_repeats: 1

Error messages:

Configuration errors detected:
Required key "entities.0.entity" is missing.
Required key "entities.0.view" is missing.
Required key "entities.0.view" is missing.
Required key "entities.0.view" is missing.
Required key "entities.0.conditions" is missing.
Required key "entities.0.url" is missing.
Required key "entities.0.entities" is missing.
Required key "entities.0.entity" is missing.
Required key "entities.0.attribute" is missing.
Required key "entities.0.service" is missing.
Required key "entities.0.text" is missing.

Hi,
well, what to say - I had the same error messages on editing my entity card (depending on attributes), and the only working way was to follow the advices of Qoobs (Thanks a lot):

type: entities
title: Batterie Level Tedee
tap_action:
  action: ''
entities:
  - type: attribute
    entity: lock.lock_keller
    entities: null
    attribute: battery_level
    name: Batterie-Level Tedee-Keller
    suffix: '%'
    icon: mdi:battery-50
    tap_action: null
    view: null
    conditions: null
    url: null
    service: null
    text: null
  - type: divider
state_color: true

image

But I didn’t get working a changeable icon depending on the battery-level.
can someone give advice, how to do this with “attributes” ?

You should create a template sensor for your battery, with the proper device_class, e.g.

template:
  - sensor:
    - name: Batterie-Level Tedee-Keller
      device_class: battery
      state: >
        {{ state_attr('lock.lock_keller', 'battery_level')}}

Thx for getting it work!

I recently experienced this behavior with type: button and came across your post. This info helped me figure out what to change on my existing configuration to stop the errors - thanks!

Earlier today, a github issue was filed for this bug: https://github.com/home-assistant/frontend/issues/9939

I updated to the 2021.9.1 release and this is no longer an issue for me.

I am updated to 2021.9.1 and I’m having similar issues.

I’m not trying to add a button. I’m trying to add in another entity and there is a long list of configuration errors similar to @Qoobs’ as soon as I start to edit the YAML.

I cant edit one letter of the YAML without configuration errors preventing me from saving.

hi i having same issues… what do i need to change in my code to fix this… its been since june since i edit things and i cant adjust anything… was told to edit it file explorer the yaml… but what do i need to change add?
i tried couple things you guys did above but didnt work

here is my code

type: entities
entities:
    entity: switch.b_hot_water_tank_switch
    name: Hot Water Tank
    icon: mdi:water
    secondary_info: last-updated
    card_mod: null
    style: |
      :host {
      --card-mod-icon-color: 
      {% if states(config.entity) == 'on' %} 
        yellow
      {% elif states(config.entity) == 'off' %}
        green
      {% else %}
        blue
      {% endif %}
      ;
      } 
    entity: switch.b_bedroom_light_switch
    name: Bedroom Light
    icon: mdi:lightbulb
    secondary_info: last-updated
    card_mod: null
    style: |
      :host {
      --card-mod-icon-color: 
      {% if states(config.entity) == 'on' %} 
        yellow
      {% elif states(config.entity) == 'off' %}
        green
      {% else %}
        blue
      {% endif %}
      ;
      } 
  - entity: switch.b_grow_light_1
    name: Grow Light 1
    icon: hass:lightbulb
    secondary_info: last-updated
    card_mod: null
    style: |
      :host {
      --card-mod-icon-color: 
      {% if states(config.entity) == 'on' %} 
        yellow
      {% elif states(config.entity) == 'off' %}
        green
      {% else %}
        blue
      {% endif %}
      ;
      } 
  - entity: switch.b_grow_light_2_upstairs
    name: Grow Light 2 Upstairs
    icon: hass:lightbulb
    secondary_info: last-updated
    card_mod: null
    style: |
      :host {
      --card-mod-icon-color: 
      {% if states(config.entity) == 'on' %} 
        yellow
      {% elif states(config.entity) == 'off' %}
        green
      {% else %}
        blue
      {% endif %}
      ;
      } 
  - entity: switch.b_building_light_1
    name: Building Light 1
    icon: hass:lightbulb
    secondary_info: last-updated
    card_mod: null
    style: |
      :host {
      --card-mod-icon-color: 
      {% if states(config.entity) == 'on' %} 
        yellow
      {% elif states(config.entity) == 'off' %}
        green
      {% else %}
        blue
      {% endif %}
      ;
      } 
  - entity: switch.b_building_light_2
    name: Building Light 2
    icon: hass:lightbulb
    secondary_info: last-updated
    card_mod: null
    style: |
      :host {
      --card-mod-icon-color: 
      {% if states(config.entity) == 'on' %} 
        yellow
      {% elif states(config.entity) == 'off' %}
        green
      {% else %}
        blue
      {% endif %}
      ;
      } 
  - entity: switch.b_speaker_plug
    name: Speaker
    icon: hass:speaker
    secondary_info: last-updated
    card_mod: null
    style: |
      :host {
      --card-mod-icon-color: 
      {% if states(config.entity) == 'on' %} 
        yellow
      {% elif states(config.entity) == 'off' %}
        green
      {% else %}
        blue
      {% endif %}
      ;
      } 
  - entity: switch.kitchen
    name: Kitchen
    icon: hass:speaker
    secondary_info: last-updated
    card_mod: null
    style: |
      :host {
      --card-mod-icon-color: 
      {% if states(config.entity) == 'on' %} 
        yellow
      {% elif states(config.entity) == 'off' %}
        green
      {% else %}
        blue
      {% endif %}
      ;
      } 
title: Building's Switch's
state_color: true
theme: midnight
show_header_toggle: false

Try removing these code_mod: null parts. Make a quick copy of your yaml into a notepad or something first.

I eventually fixed my issue by removing a lot of label: null or section: null parts that I had in my lovelace card.

didnt work still get this error i didnt post it all

and i cant even use the save button anyways… i change 1 character like the name boom i cant save nothing


Configuration errors detected:
Required key "entities.0.type" is missing.
Required key "entities.0.tap_action" is missing.
Required key "entities.0.tap_action" is missing.
Required key "entities.0.tap_action" is missing.
Required key "entities.0.tap_action" is missing.
Required key "entities.0.tap_action" is missing.
Required key "entities.0.tap_action" is missing.
Required key "entities.0.type" is missing.
Required key "entities.0.view" is missing.
Required key "entities.0.view" is missing.
Required key "entities.0.view" is missing.
Required key "entities.0.type" is missing.
Required key "entities.0.conditions" is missing.
Required key "entities.0.type" is missing.
Required key "entities.0.type" is missing.
Required key "entities.0.type" is missing.
Required key "entities.0.url" is missing.
Required key "entities.0.type" is missing.
Required key "entities.0.entities" is missing.
Required key "entities.0.type" is missing.
Required key "entities.0.attribute" is missing.
Required key "entities.0.type" is missing.
Required key "entities.0.service" is missing.
Required key "entities.0.type" is missing.
Required key "entities.0.text" is missing.
Required key "entities.0.type" is missing.
Required key "entities.1.type" is missing.
Required key "entities.1.tap_action" is missing.
Required key "entities.1.tap_action" is missing.
Required key "entities.1.tap_action" is missing.
Required key "entities.1.tap_action" is missing.
Required key "entities.1.tap_action" is missing.
Required key "entities.1.tap_action" is missing.
Required key "entities.1.type" is missing.
Required key "entities.1.view" is missing.
Required key "entities.1.view" is missing.
Required key "entities.1.view" is missing.
Required key "entities.1.type" is missing.
Required key "entities.1.conditions" is missing.
Required key "entities.1.type" is missing.
Required key "entities.1.type" is missing.
Required key "entities.1.type" is missing.
Required key "entities.1.url" is missing.
Required key "entities.1.type" is missing.
Required key "entities.1.entities" is missing.
Required key "entities.1.type" is missing.
Required key "entities.1.attribute" is missing.
Required key "entities.1.type" is missing.
Required key "entities.1.service" is missing.
Required key "entities.1.type" is missing.
Required key "entities.1.text" is missing.
Required key "entities.1.type" is missing.
Required key "entities.2.type" is missing.
Required key "entities.2.tap_action" is missing.
Required key "entities.2.tap_action" is missing.
Required key "entities.2.tap_action" is missing.
Required key "entities.2.tap_action" is missing.
Required key "entities.2.tap_action" is missing.
Required key "entities.2.tap_action" is missing.
Required key "entities.2.type" is missing.
Required key "entities.2.view" is missing.
Required key "entities.2.view" is missing.
Required key "entities.2.view" is missing.
Required key "entities.2.type" is missing.
Required key "entities.2.conditions" is missing.
Required key "entities.2.type" is missing.
Required key "entities.2.type" is missing.
Required key "entities.2.type" is missing.
Required key "entities.2.url" is missing.
Required key "entities.2.type" is missing.
Required key "entities.2.entities" is missing.
Required key "entities.2.type" is missing.
Required key "entities.2.attribute" is missing.
Required key "entities.2.type" is missing.
Required key "entities.2.service" is missing.
Required key "entities.2.type" is missing.
Required key "entities.2.text" is missing.
Required key "entities.2.type" is missing.
Required key "entities.3.type" is missing.
Required key "entities.3.tap_action" is missing.
Required key "entities.3.tap_action" is missing.
Required key "entities.3.tap_action" is missing.
Required key "entities.3.tap_action" is missing.
Required key "entities.3.tap_action" is missing.
Required key "entities.3.tap_action" is missing.
Required key "entities.3.type" is missing.
Required key "entities.3.view" is missing.
Required key "entities.3.view" is missing.
Required key "entities.3.view" is missing.
Required key "entities.3.type" is missing.
Required key "entities.3.conditions" is missing.
Required key "entities.3.type" is missing.
Required key "entities.3.type" is missing.
Required key "entities.3.type" is missing.
Required key "entities.3.url" is missing.
Required key "entities.3.type" is missing.
Required key "entities.3.entities" is missing.
Required key "entities.3.type" is missing.
Required key "entities.3.attribute" is missing.
Required key "entities.3.type" is missing.
Required key "entities.3.service" is missing.
Required key "entities.3.type" is missing.
Required key "entities.3.text" is missing.
Required key "entities.3.type" is missing.
Required key "entities.4.type" is missing.
Required key "entities.4.tap_action" is missing.
Required key "entities.4.tap_action" is missing.
Required key "entities.4.tap_action" is missing.
Required key "entities.4.tap_action" is missing.
Required key "entities.4.tap_action" is missing.
Required key "entities.4.tap_action" is missing.
Required key "entities.4.type" is missing.
Required key "entities.4.view" is missing.
Required key "entities.4.view" is missing.
Required key "entities.4.view" is missing.
Required key "entities.4.type" is missing.
Required key "entities.4.conditions" is missing.
Required key "entities.4.type" is missing.
Required key "entities.4.type" is missing.
Required key "entities.4.type" is missing.
Required key "entities.4.url" is missing.
Required key "entities.4.type" is missing.
Required key "entities.4.entities" is missing.
Required key "entities.4.type" is missing.
Required key "entities.4.attribute" is missing.
Required key "entities.4.type" is missing.
Required key "entities.4.service" is missing.
Required key "entities.4.type" is missing.
Required key "entities.4.text" is missing.
Required key "entities.4.type" is missing.
Required key "entities.5.type" is missing.
Required key "entities.5.tap_action" is missing.
Required key "entities.5.tap_action" is missing.
Required key "entities.5.tap_action" is missing.
Required key "entities.5.tap_action" is missing.
Required key "entities.5.tap_action" is missing.
Required key "entities.5.tap_action" is missing.
Required key "entities.5.type" is missing.
Required key "entities.5.view" is missing.
Required key "entities.5.view" is missing.
Required key "entities.5.view" is missing.
Required key "entities.5.type" is missing.
Required key "entities.5.conditions" is missing.
Required key "entities.5.type" is missing.
Required key "entities.5.type" is missing.
Required key "entities.5.type" is missing.
Required key "entities.5.url" is missing.
Required key "entities.5.type" is missing.
Required key "entities.5.entities" is missing.
Required key "entities.5.type" is missing.
Required key "entities.5.attribute" is missing.
Required key "entities.5.type" is missing.
Required key "entities.5.service" is missing.
Required key "entities.5.type" is missing.
Required key "entities.5.text" is missing.
Required key "entities.5.type" is missing.
Required key "entities.6.type" is missing.
Required key "entities.6.tap_action" is missing.
Required key "entities.6.tap_action" is missing.
Required key "entities.6.tap_action" is missing.
Required key "entities.6.tap_action" is missing.
Required key "entities.6.tap_action" is missing.
Required key "entities.6.tap_action" is missing.
Required key "entities.6.type" is missing.
Required key "entities.6.view" is missing.
Required key "entities.6.view" is missing.
Required key "entities.6.view" is missing.
Required key "entities.6.type" is missing.
Required key "entities.6.conditions" is missing.
Required key "entities.6.type" is missing.
Required key "entities.6.type" is missing.
Required key "entities.6.type" is missing.
Required key "entities.6.url" is missing.
Required key "entities.6.type" is missing.
Required key "entities.6.entities" is missing.
Required key "entities.6.type" is missing.
Required key "entities.6.attribute" is missing.
Required key "entities.6.type" is missing.
Required key "entities.6.service" is missing.
Required key "entities.6.type" is missing.
Required key "entities.6.text" is missing.
Required key "entities.6.type" is missing.
Required key "entities.7.type" is missing.
Required key "entities.7.tap_action" is missing.
Required key "entities.7.tap_action" is missing.
Required key "entities.7.tap_action" is missing.
Required key "entities.7.tap_action" is missing.
Required key "entities.7.tap_action" is missing.
Required key "entities.7.tap_action" is missing.
Required key "entities.7.type" is missing.
Required key "entities.7.view" is missing.
Required key "entities.7.view" is missing.
Required key "entities.7.view" is missing.
Required key "entities.7.type" is missing.
Required key "entities.7.conditions" is missing.
Required key "entities.7.type" is missing.
Required key "entities.7.type" is missing.
Required key "entities.7.type" is missing.
Required key "entities.7.url" is missing.
Required key "entities.7.type" is missing.
Required key "entities.7.entities" is missing.
Required key "entities.7.type" is missing.
Required key "entities.7.attribute" is missing.
Required key "entities.7.type" is missing.
Required key "entities.7.service" is missing.
Required key "entities.7.type" is missing.
Required key "entities.7.text" is missing.
Required key "entities.7.type" is missing.
Visual editor is not supported for this configuration:
Key "entities.0.style" is not expected or not supported by the visual editor.
The provided value for "entities.0" is not supported by the visual editor. We support (string) but received ({"entity":"switch.b_hot_water_tank_switch","name":"Hot Water Tank","icon":"mdi:water","secondary_info":"last-updated","style":":host {\n--card-mod-icon-color: \n{% if states(config.entity) == 'on' %} \n  yellow\n{% elif states(config.entity) == 'off' %}\n  green\n{% else %}\n  blue\n{% endif %}\n;\n} \n"}).