šŸ”¹ Auto-entities - Automatically fill cards with entities

Are you sure that filling input_select options should be performed inside a card?
Probably you should fill it outside by some script, and you can use templates for it as a part of script syntax.
Once again - you are trying to mix unmixable things: auto-entities cannot be used for populating input_select.

Hi!
Can I know how you did to associate a realistic icon specific to each device?
Thank you for your help :slight_smile:

Well I used the NMAP integration, which created a ā€œknown_devices.yamlā€ file. And in there I put

picture: /local/path to image/image.png

Did this for all the discovered devices. But the NMAP integration changed some time ago. So iā€™m not using this anymore. Still looking for a new way to track all devices on my network.

Hope this helps a little.
If youā€™re trying and it wont work, let me know. Iā€™ll try to see if I can help.

1 Like

Try customizing entity_picture inside customize section for these device_tracker entities.

Hello all, hello @Ildar_Gabdullin ,

I was wondering if auto-entities could also work with Apexcharts without creating one chart with multiple but rather one chart per entity.

Code for multiple charts without auto-entities
type: vertical-stack
cards:
  - type: custom:apexcharts-card
    layout: minimal
    graph_span: 48h
    experimental:
      color_threshold: true
    update_interval: 10 s
    yaxis:
      - show: false
        max: 21
        min: 0
    header:
      title: Living Room Temperature
      show: true
      show_states: true
      colorize_states: true
    apex_config:
      legend:
        show: false
      datalabels:
        enabled: true
      grid:
        show: false
      chart:
        height: 100px
    series:
      - entity: sensor.eq_3_temperature_living_room
        stroke_width: 2
        group_by:
          func: last
        fill_raw: zero
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        type: line
        opacity: 1
        curve: smooth
      - entity: sensor.eq_3_temperature_living_room
        stroke_width: 0
        group_by:
          func: last
        fill_raw: zero
        type: area
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        opacity: 0.1
        curve: smooth
  - type: custom:apexcharts-card
    layout: minimal
    graph_span: 48h
    experimental:
      color_threshold: true
    update_interval: 10 s
    yaxis:
      - show: false
        max: 21
        min: 0
    header:
      title: Dining Room Temperature
      show: true
      show_states: true
      colorize_states: true
    apex_config:
      legend:
        show: false
      datalabels:
        enabled: true
      grid:
        show: false
      chart:
        height: 100px
    series:
      - entity: sensor.eq_3_temperature_dining_room
        stroke_width: 2
        group_by:
          func: last
        fill_raw: zero
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        type: line
        opacity: 1
        curve: smooth
      - entity: sensor.eq_3_temperature_dining_room
        stroke_width: 0
        group_by:
          func: last
        fill_raw: zero
        type: area
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        opacity: 0.1
        curve: smooth
  - type: custom:apexcharts-card
    layout: minimal
    graph_span: 48h
    experimental:
      color_threshold: true
    update_interval: 10 s
    yaxis:
      - show: false
        max: 21
        min: 0
    header:
      title: Master Bedroom Temperature
      show: true
      show_states: true
      colorize_states: true
    apex_config:
      legend:
        show: false
      datalabels:
        enabled: true
      grid:
        show: false
      chart:
        height: 100px
    series:
      - entity: sensor.eq_3_temperature_master_bedroom
        stroke_width: 2
        group_by:
          func: last
        fill_raw: zero
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        type: line
        opacity: 1
        curve: smooth
      - entity: sensor.eq_3_temperature_master_bedroom
        stroke_width: 0
        group_by:
          func: last
        fill_raw: zero
        type: area
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        opacity: 0.1
        curve: smooth
  - type: custom:apexcharts-card
    layout: minimal
    graph_span: 48h
    experimental:
      color_threshold: true
    update_interval: 10 s
    yaxis:
      - show: false
        max: 21
        min: 0
    header:
      title: Guest Toilet Temperature
      show: true
      show_states: true
      colorize_states: true
    apex_config:
      legend:
        show: false
      datalabels:
        enabled: true
      grid:
        show: false
      chart:
        height: 100px
    series:
      - entity: sensor.eq_3_temperature_guest_toilet
        stroke_width: 2
        group_by:
          func: last
        fill_raw: zero
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        type: line
        opacity: 1
        curve: smooth
      - entity: sensor.eq_3_temperature_guest_toilet
        stroke_width: 0
        group_by:
          func: last
        fill_raw: zero
        type: area
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        opacity: 0.1
        curve: smooth
  - type: custom:apexcharts-card
    layout: minimal
    graph_span: 48h
    experimental:
      color_threshold: true
    update_interval: 10 s
    yaxis:
      - show: false
        max: 21
        min: 0
    header:
      title: Office Temperature
      show: true
      show_states: true
      colorize_states: true
    apex_config:
      legend:
        show: false
      datalabels:
        enabled: true
      grid:
        show: false
      chart:
        height: 100px
    series:
      - entity: sensor.eq_3_temperature_office
        stroke_width: 2
        group_by:
          func: last
        fill_raw: zero
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        type: line
        opacity: 1
        curve: smooth
      - entity: sensor.eq_3_temperature_office
        stroke_width: 0
        group_by:
          func: last
        fill_raw: zero
        type: area
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        opacity: 0.1
        curve: smooth
  - type: custom:apexcharts-card
    layout: minimal
    graph_span: 48h
    experimental:
      color_threshold: true
    update_interval: 10 s
    yaxis:
      - show: false
        max: 21
        min: 0
    header:
      title: Kitchen Temperature
      show: true
      show_states: true
      colorize_states: true
    apex_config:
      legend:
        show: false
      datalabels:
        enabled: true
      grid:
        show: false
      chart:
        height: 100px
    series:
      - entity: sensor.eq_3_temperature_kitchen
        stroke_width: 2
        group_by:
          func: last
        fill_raw: zero
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        type: line
        opacity: 1
        curve: smooth
      - entity: sensor.eq_3_temperature_kitchen
        stroke_width: 0
        group_by:
          func: last
        fill_raw: zero
        type: area
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        opacity: 0.1
        curve: smooth
  - type: custom:apexcharts-card
    layout: minimal
    graph_span: 48h
    experimental:
      color_threshold: true
    update_interval: 10 s
    yaxis:
      - show: false
        max: 21
        min: 0
    header:
      title: Master Bathroom Temperature
      show: true
      show_states: true
      colorize_states: true
    apex_config:
      legend:
        show: false
      datalabels:
        enabled: true
      grid:
        show: false
      chart:
        height: 100px
    series:
      - entity: sensor.eq_3_temperature_master_bathroom
        stroke_width: 2
        group_by:
          func: last
        fill_raw: zero
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        type: line
        opacity: 1
        curve: smooth
      - entity: sensor.eq_3_temperature_master_bathroom
        stroke_width: 0
        group_by:
          func: last
        fill_raw: zero
        type: area
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        opacity: 0.1
        curve: smooth
  - type: custom:apexcharts-card
    layout: minimal
    graph_span: 48h
    experimental:
      color_threshold: true
    update_interval: 10 s
    yaxis:
      - show: false
        max: 21
        min: 0
    header:
      title: Walk-in Temperature
      show: true
      show_states: true
      colorize_states: true
    apex_config:
      legend:
        show: false
      datalabels:
        enabled: true
      grid:
        show: false
      chart:
        height: 100px
    series:
      - entity: sensor.eq_3_temperature_walk_in
        stroke_width: 2
        group_by:
          func: last
        fill_raw: zero
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        type: line
        opacity: 1
        curve: smooth
      - entity: sensor.eq_3_temperature_walk_in
        stroke_width: 0
        group_by:
          func: last
        fill_raw: zero
        type: area
        color_threshold:
          - value: 4.5
            color: blue
          - value: 20
            color: red
        opacity: 0.1
        curve: smooth
Code with auto-entities but each entity is one series

(Please ignore the config-template-card, it matters not)

type: custom:config-template-card
entities:
  - input_select.days_back_to_show
variables:
  span: states['input_select.days_back_to_show'].state+'d'
  days: |
    -states['input_select.days_back_to_show'].state+'d'+'1d'
card:
  type: vertical-stack
  cards:
    - type: custom:auto-entities
      filter:
        include:
          - entity_id: sensor.eq_3_temperature*
            options:
              entity: this.entity_id
              stroke_width: 2
              group_by:
                func: last
              fill_raw: zero
      card:
        type: custom:apexcharts-card
        graph_span: ${span}
        span:
          start: day
          offset: ${days}
        experimental:
          color_threshold: true
        update_interval: 10 s
        now:
          show: false
          color: red
          label: Now
        yaxis:
          - min: 0
        apex_config:
          grid:
            show: false

Adapt this example for your needs:

type: custom:auto-entities
card:
  type: vertical-stack
card_param: cards
filter:
  include:
    - entity_id: "sensor.cleargrass_1_*"
      options:
        type: history-graph
        entities:
          - entity: this.entity_id

Also - do not overload people with unimportant details, give Minimal Working Example.
Then people will help you faster!

P.S. I removed options for sort, show_empty etc to simplify the idea.

Hmmm, works with history-graph but not yet with ApexCharts. Still seem to have something wrong

type: custom:auto-entities
card:
  type: vertical-stack
card_param: cards
filter:
  include:
    - entity_id: sensor.eq_3_temperature*
      options:
        type: custom:apexcharts-card
        series:
          - entity: this.entity_id

Gives error: /// apexcharts-card version 1.10.1-dev.1 /// value.entity is extraneous
But series needs to be specified, otherwise error that series is missing.

The generated card is:
image
What you can do is:

  • either open an issue for auto-entities - ā€œgenerated card includes extraneous lineā€;
  • or open an issue for apexcharts-card - ā€œallow extraneous optionsā€

Update:

Unfortunately, auto-entities still gives unstable results with map.
Sometimes this card does not show a map:

type: vertical-stack
cards:
  - type: entity
    entity: sun.sun
  - type: custom:auto-entities
    card:
      type: map
    show_empty: false
    filter:
      include:
        - entity_id: device_tracker.life360*
          options:
            default_zoom: 14

When it does:

I used to have a auto-entities card with the types of waste that are going to be picked up (GitHub - pippyn/Home-Assistant-Sensor-Afvalbeheer: Provides Home Assistant sensors for multiple Dutch and Belgium waste collectors). It worked great until two days ago. I have an empty card with only the title.
I donā€™t know if it was the update to HA 2021.12 or just after that. The individual sensors are working if I look them up. I did not make any changes to the card. Does anyone have an idea what goes wrong?

type: custom:auto-entities
card:
  show_header_toggle: false
  type: entities
  title: Afvalkalender
filter:
  include:
    - attributes:
        Days-until: < 14
      options:
        secondary_info: Nog [[ {entity}.attributes.Days-until ]] dag(en)
        type: custom:secondaryinfo-entity-row
      entity_id: sensor.meerlanden*
  show_empty: false
sort:
  method: attribute
  attribute: Days-until
  numeric: true

Hi, how can i hide entities with some state (where are unavailable) ?
exp.

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - entity_id: '*sensor.washmaschine*'
      not:
        state: '*unavailable*'
  exclude: []

put the filter under exclude not include since your goal is to EXCLUDE unavailable entities. Itā€™s explained in the ReadMe in Github pretty well. Did you bother to check there? Like this example there:

type: custom:auto-entities
show_empty: false
card:
  type: entities
  title: Lights on
  show_header_toggle: false
filter:
  include:
    - domain: light
  exclude:
    - state: "off"
    - state: "unavailable"
1 Like

Thank you, I tried the examples in the first place only in a stupid way I tried to filter out the unavailable state in Polish instead of English and it didnā€™t work.

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - entity_id: '*sensor.pralka*'
  exclude:
    - state: "off"
    - state: "niedostępny"

works very well in English :slight_smile:

Surely since Polish values are only for UI, internally the state is ā€œunavailableā€.

1 Like

Solved: the attribute Days-until has been altered to Days_until apparently. Changed that in the code and itā€™s working again :slight_smile:

1 Like

Now that HA provides a button to trigger the OTA update for Shelly devices I thought is was time to add a card to my maintenance dashboard that shows me what device have an update pending.

image

type: custom:auto-entities
card:
  type: entities
  title: Shelly OTA Updates
filter:
  template: |
    {% for sensor in states.binary_sensor -%}
      {% if 'firmware_update' in sensor.entity_id and sensor.state == 'on' %}
        {{ sensor.entity_id | regex_replace('^binary_sensor.([a-z0-9_]+)_firmware_update$','button.\\1_ota_update') }}, 
      {% endif %}
    {%- endfor %}

To get this to work make sure you are on HA 2021.12, use the official Shelly integration and have the firmware sensor of your Shelly devices enabled.

@thomasloven tnx for this great card

2 Likes

Hi hope someone can help me with this.
I would like a card for birthdays. So far so good.

The problem is, I need 2 filters because of different attributes I want to show in the card and for one filter 1 need 2 states: > 0 and < 20.
But I donā€™t get that to work.

Here is the code:

type: custom:auto-entities
card:
  type: entities
  title: 'Verjaardagen'
filter:
  include:
    - entity_id: sensor.anniversary*
      options:
        type: custom:multiple-entity-row
        entity: this.entity_id
        entities:
          - attribute: years_at_next_anniversary
            unit: jaar
      state: '< 20'
    - entity_id: sensor.anniversary*
      options:
        type: custom:multiple-entity-row
        entity: this.entity_id
        entities:
          - attribute: current_years
            unit: jaar
      state: '= 0'
sort:
  method: state
  numeric: true
show_empty: false

Hi All,
Iā€™ve been using this card for a while now and created quite a comprehensive list of warnings. Iā€™ve a new challenge and I canā€™t think how to solve it.
Iā€™ve created enhanced sensors for local river level sensors, adding their maximum ā€˜normalā€™ level (and locations for showing on a map).
Iā€™ve set a filter group for sensors containing the word ā€œfloodā€ but of course I get all the flood sensors regardless of their level. I want them to only appear when their state value exceeds this attribute value, Iā€™m having a mental block and canā€™t sus how to express this in a filter.

Can anyone help?

Thanks

Post a simplified code for your attempts for auto-entities-card containing your sensors.
Have you tried this?

Thatā€™s not quite what Iā€™m trying to achieve, here is some code that doesnā€™t work:


    - domain: sensor
      entity_id: /flood/
      state: ā€˜> this.entity_id.maximum_normalā€™

I know itā€™s wrong but Iā€™m not thinking clearly as to what it should be