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

HI Thomas,

using this auto-entities card:

  - type: custom:auto-entities
    card:
      type: entities
      title: Github repos
      show_header_toggle: false
    entities:
      - entity: automation.github_repo_update
        secondary_info: last-triggered
    filter:
      include:
        - entity_id: sensor.github*
          options:
            type: custom:dummy-entity-row
#            state: >
#              {% if state_attr(config.entity,'latest_release_url') %}
#              {{ state_attr(config.entity,'latest_release_url').split('tag/')[1]}}
#              {% else %} Not set
#              {% endif %}
#            secondary: >
#              {{ state_attr(config.entity,'latest_commit_message')}}
  #            secondary: "{{ as_timestamp(states[config.entity].last_changed)| timestamp_custom('%X - %D') }}"
          sort:
            method: name

stopped working altogether now, because of this error, which is logged

2020-02-12 09:56:10 ERROR (SyncWorker_7) [homeassistant.components.github.sensor] GitHub error for custom-cards/vertical-stack-in-card: 401 {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}
2020-02-12 09:56:10 ERROR (SyncWorker_7) [homeassistant.components.github.sensor] Error setting up GitHub platform. Check previous errors for details

How could HA think this is a vertical-stack-in-cardā€¦?

Donā€™t understand the Github credentials error either, and I have even refreshed the token. But thatā€™s maybe another matter. Turning to you here for the ā€˜cardā€™ issue reported.

Iā€™m sorry for taking my time with this one. I had to sleep on it because itā€™s so utterly confusing.

I mean, assuming - of course - that you have determined that this error is caused by auto-entities, and are not just pasting random error messages here without even reading them - itā€™s weird how frontend errors suddenly show up in the backend log, isnā€™t it?

To make it even weirder, the errors show an integration name which just happens to be the very same that the sensor you include in a dummy-entity-row belongs to. Crazy coincidence, right?

Wouldnā€™t it be an even more amazing coincidence if the repository address in the first error message happened to match one that you are monitoring with a github sensor? The mere idea boggles the mind!

Alas, as it stands now Iā€™m absolutely baffled. Iā€™ve never before seen a lovelace card turn into a teapot (lacking any description at all on how ā€œstopped working altogetherā€ manifests, Iā€™ll assume it throws a HTTP 418 error). And ā€œbecause of [an] errorā€ none the lessā€¦

Fascinating

1 Like

well, now this is a very special reply of yours. Iā€™ll swallow the sarcasmā€¦

I was just as baffled as you are. Really sorry for being such an idiot, truly am.

Still, your response made me see what is wrong, so thank you very much indeed. The sensor config for the vertical-stack-in-card GitHub repo is erroring out, rather than it being an error for a vertical-stack-in-card Lovelace config. Which I have not, hence me being baffled. Again: I beg your pardon.

Because of that, the full set of GitHub sensors isnā€™t created. (ā€˜stopped working all togetherā€™) I see that now.

Because this is my sensor setup (If one of these returns an error, the full sensor config is being blocked)

sensor:
  - platform: github
    access_token: !secret github_token
    entity_namespace: Github
    scan_interval: 3600
    repositories:
      - path: home-assistant/home-assistant
        name: Home-assistant
      - path: thomasloven/hass-browser_mod
        name: Browser mod
      - path: dnguyen800/air-visual-card
        name: Air visual
      - path: thomasloven/lovelace-auto-entities
        name: Auto entities
      - path: custom-cards/bar-card
        name: Bar
      - path: custom-cards/bignumber-card
        name: Big number
      - path: custom-cards/button-card
        name: Button
      - path: thomasloven/lovelace-card-mod
        name: Card mod
      - path: thomasloven/lovelace-card-tools
        name: Card tools
#      - path: custom-cards/config-template-card
      - path: maykar/custom-header
        name: Custom header
#      - path: iammexx/home-assistant-config/tree/master/ui/darksky
#        name: Darksky weather card
      - path: custom-cards/decluttering-card
        name: Decluttering
      - path: custom-cards/entity-attributes-card
        name: Entity attributes
      - path: thomasloven/lovelace-fold-entity-row
        name: Fold entity row
      - path: custom-cards/gauge-card
        name: Gauge
      - path: custom-cards/group-card
        name: Group
      - path: thomasloven/lovelace-layout-card
        name: Layout card
      - path: DBuit/light-popup-card
        name: Light popup
      - path: iantrich/list-card
        name: List
      - path: gadgetchnnel/lovelace-card-templater
        name: Card templater
      - path: kalkih/mini-graph-card
        name: Mini graph
      - path: kalkih/mini-media-player
        name: Mini media player
      - path: benct/lovelace-multiple-entity-row
        name: Multiple entity row
      - path: gurbyz/power-wheel-card
        name: Power wheel
      - path: iantrich/restriction-card
        name: Restriction
      - path: custom-cards/secondaryinfo-entity-row
        name: Secondary info row
      - path: kalkih/simple-weather-card
        name: Simple weather
      - path: thomasloven/lovelace-slider-entity-row
        name: Slider entity row
      - path: thomasloven/lovelace-state-switch
        name: State switch
#      - path: bramkragten/custom-ui/tree/master/swipe-card
      - path: thomasloven/lovelace-template-entity-row
        name: Template entity row
#      - path: rodrigofragadf/lovelace-cards/tree/master/tiles-card
      - path: thomasloven/lovelace-toggle-lock-entity-row
        name: Toggle lock entity row
      - path: ofekashery/vertical-stack-in-card
        name: Vertical stack in card
      - path: royto/waze-card
        name: Waze
      - path: sgttrs/lovelace-weather-card-chart
        name: Weather card chart

Hope I will get a chance to ask you about the issue I have with the (now commented) templates I use when the card type is template-entity-row. Ive posted it on the correct thread. They keep switching between showing the template, and the template output.

2 Likes

Iā€™m sorry for the hard words.
Itā€™s justā€¦ as Iā€™m seeing parts of your configuration evolve, and seeing what you are making from my plugins, I believe Iā€™m starting to understand your capabilities and how you think about this kind of things.

ā€¦and you could have cracked that one yourself - absolutely no doubt! - if youā€™d just looked it all over once more before posting.
I also believe people in general learn more by solving problems themselves. Iā€™m not trying to discourage anyone from asking for help, justā€¦ give it some rest and then try once more before asking. Perhaps just stepping back a minute will help seeing things differently.

Iā€™m glad you solved it. I tried to be a bit helpful behind all that stupid sarcasm, and Iā€™m happy you saw that - I was almost certain you would.

As for your other problem, I think Iā€™m starting to understand whatā€™s happening, and itā€™s possible that the new version released yesterday might actually fix it.

Sorry.

6 Likes

Thx mate. Really. Much appreciated!
Will check the update soon and report back :+1:

update

indeed seems to have fixed it:

only left (for me in this card) is the need for a more-info on tap.

  - type: custom:auto-entities
    card:
      type: entities
#      title: Github repos
      show_header_toggle: false
      header:
        type: picture
        image: /local/images/github_owler.png
    entities:
      - entity: automation.github_repo_update
        secondary_info: last-triggered
    filter:
      include:
        - entity_id: sensor.github*
          options:
            type: custom:template-entity-row
            state: >
              {% if state_attr(config.entity,'latest_release_url') %}
              {{ state_attr(config.entity,'latest_release_url').split('tag/')[1]}}
              {% else %} Not set
              {% endif %}
            secondary: >
              {{ state_attr(config.entity,'latest_commit_message')}}
#  #            secondary: "{{ as_timestamp(states[config.entity].last_changed)| timestamp_custom('%X - %D') }}"
          sort:
            method: name}

when clicking a row, nothing happens. Would be really nice if you could explain to me how I can enable that. If needed, Iā€™ll hop over to the template-entity-row thread.
aamof, it would be great if we could use both tap and hold action. tap for more-info, hold for url navigation to the repoā€¦

    filter:
      include:
        - entity_id: sensor.github*
          options:
            type: custom:template-entity-row
            state: >
              {% if state_attr(config.entity,'latest_release_url') %}
              {{ state_attr(config.entity,'latest_release_url').split('tag/')[1]}}
              {% else %} Not set
              {% endif %}
            secondary: >
              {{ state_attr(config.entity,'latest_commit_message')}}
          sort:
            method: name
          tap_action:
            action: more-info
          hold_action:
            url_path: >
              {{ state_attr(config.entity,'latest_release_url')}}

hope you will consider.

1 Like

HI Thomas,
please let me bother you once again, really sorry, and yes, Ive been trying to look at this from all angles (known to meā€¦)

Iā€™ve been checking this for the last few hours, but canā€™t find the answer, other than the combination of glance core card and auto-entities (and/or template-entity-row) has some incompatibilities.

Ive even made various forms of template sensors, which use custom_timestamp or not for state, and now finally wound up using a template sensor that has the timestamp for state, and an attribute_template ā€˜dateā€™, using the custom_timestamp.

posted here Iā€™ll summarize:

using the entities card this works perfectly

  - type: 'custom:auto-entities'
    card:
      type: entities
    filter:
      include:
        - entity_id: sensor.*_trash_timestamp
          options:
            type: custom:template-entity-row
            state: >
              {{state_attr(config.entity,'date')}}
    sort:
      method: state

but using the exact same setup with glance card (also tried custom:hui-glance-card), the sensors are displayed with their state, and not the template-entity-row templates for state.

  - type: 'custom:auto-entities'
    card:
      type: glance
    filter:
      include:
        - entity_id: sensor.*_trash_timestamp
          options:
            type: custom:template-entity-row
            state: >
              {{state_attr(config.entity,'date')}}
    sort:
      method: state

Am I missing the obvious here, because of tunnel vision, or is this an incompatibilityā€¦

once again: sorry if this sounds really noobish, I am simply out of ideas.

What happens when you manually place them into a glance card without the custom card? As a test.

As a matter of fact, I think that is what is happening just nowā€¦
the states of these sensors are the timestamps, so that would be the same output?

btw, I created these timestamp sensors for the reliability of the sort order, based on state. (just like the alarm sensors you and I worked on so intenselyā€¦)

  - type: glance
    title: Timestamp
    entities:
      - sensor.gft_trash_timestamp
      - sensor.papier_trash_timestamp
      - sensor.plastic_verpakkingsafval_trash_timestamp
      - sensor.restafval_trash_timestamp

Well, I think this requires an Issue: FeatureRequest on the front end. Looks like the issue is with glance not accepting timestamp device_class.

yeah, something is not right, timestamps are not compatible with glance

but thereā€™s more, I tried this next:

  - type: glance
    title: Timestamp
    columns: 4
    entities:
      - sensor.gft_trash_timestamp
      - type: custom:template-entity-row
        state: >
          {{state_attr('sensor.gft_trash_timestamp','date')}}
      - sensor.papier_trash_timestamp
      - type: custom:template-entity-row
        state: >
          {{state_attr('sensor.papier_trash_timestamp','date')}}
      - sensor.plastic_verpakkingsafval_trash_timestamp
      - type: custom:template-entity-row
        state: >
          {{state_attr('sensor.plastic_verpakkingsafval_trash_timestamp','date')}}
      - sensor.restafval_trash_timestamp
      - type: custom:template-entity-row
        state: >
          {{state_attr('sensor.restafval_trash_timestamp','date')}}

but that wont work either, glance doesnā€™t accept a card for an entity, like entities card does. it even stumbles on the columns in this case:

Well the timestamp device_class is only ā€˜meantā€™ for timestamps in the past. Iā€™ve always thought that was stupid, but thatā€™s the case. So, to me, itā€™s no surprise that they donā€™t work in the future on glances, etc.

Glance cards canā€™t take custom stuff (yet?). So for a glance card youā€™re stuck with glance buttons.

probably need to create some custom card buttons thenā€¦ thing is I need to order then based on the timestamp, which poses a new challenge altogetherā€¦ no sure if the auto-entities card does that, but will try before I ask :wink:

somehow I feel a tweak coming up nextā€¦ #fingerscrossed

Hello,

Is it possible to make this card work with cards that only take one entity? Such as media-control card? The idea would be that it then expanded out to show multiple copies of the card if the filter returned more than one entity.

Hi Thomas,

to have auto-entities select the only 4 sensors in my setup with an attribute next_pickup_in_days I think I need to do this:

  - type: 'custom:auto-entities'
    card:
      type: glance
    filter:
      include:
        - domain: sensor
          attributes:
            next_pickup_in_days: '! none'

wouldnā€™t it be a future possibility to change the config into:

  - type: 'custom:auto-entities'
    card:
      type: glance
    filter:
      include:
        - attributes: next_pickup_in_days

meaning, filter all entities that have an attribute next_pickup_in_days?

would you accept a feature request for this? I feel it would make the auto-entities even more powerful.

thanks for considering.

Yes, using layout-card. Thereā€™s an example near the bottom of the readme here: https://github.com/thomasloven/lovelace-layout-card

2 Likes

That feels like a bit too much work, and a new configuration method - with associated documentation and confusement - for a minimal simplification of something thatĀ“s already very easy.

attributes:
  next_pickup_in_days: *

Just want to say that this worked brilliantly, thanks!

completely missed that option, working nicely indeed, thank you very much!

hmmm, I think I saw the sensors appear, but now only see an empty cardā€¦must have ben a cache thing, still loading my previous config.

also, using the single * without quotes results in an error:

while scanning an alias in "/config/lovelace/views/view_Tijd_agenda.yaml", line 34, column 34 expected alphabetic or numeric character, but found '\n' in "/config/lovelace/views/view_Tijd_agenda.yaml", line 34, column 35

using

  - type: 'custom:auto-entities'
    card:
      type: glance
    filter:
      include:
        - domain: sensor
          attributes:
            next_pickup_in_days: *

managed to take out the domain: sensor, but canā€™t use the *, and need to set

  - type: 'custom:auto-entities'
    card:
      type: glance
    filter:
      include:
        - attributes:
            next_pickup_in_days: '! none'

And with quotes?