Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add attribute for logo and cover image #139

Merged
merged 1 commit into from
Nov 14, 2024
Merged

Conversation

ov3rk1ll
Copy link
Contributor

This PR adds a new attribute for the logo and cover image shown in the app.

This could be used in a custom:auto-entities template to set the image field on a custom:multiple-entity-row entry

@ov3rk1ll ov3rk1ll mentioned this pull request Nov 12, 2024
3 tasks
@tjorim tjorim merged commit dd11f06 into Chouffy:main Nov 14, 2024
@tjorim
Copy link
Collaborator

tjorim commented Nov 14, 2024

Thanks for your contribution! If you have an example of how you use it, feel free to add it as well.

@ov3rk1ll
Copy link
Contributor Author

This can be used by adding 'image': state_attr(entity_id, 'logo_url') to the README example like so

type: custom:auto-entities
card:
  type: entities
  title: TGTG Surprise Bags
filter:
  template: |-
    {% for state in states.sensor if 'sensor.tgtg_' in state.entity_id %}
      {% set entity_id = state.entity_id %}
      {% set state = states(entity_id) %}
      {%- if is_number(state) and state | int > 0 %}
        {% set pickup_start = state_attr(entity_id, 'pickup_start') %}
        {%- if pickup_start is not none -%}
          {{
            {
              'entity': entity_id,
              'name': state_attr(entity_id, 'friendly_name')[5:],
              'type': "custom:multiple-entity-row",
              'unit': false,
              'secondary_info': as_timestamp(pickup_start) | timestamp_custom('Pickup on %d-%m between %H:%M and ', true) + as_timestamp(state_attr(entity_id, 'pickup_end')) | timestamp_custom('%H:%M, € ', true) + state_attr(entity_id, 'item_price')[:-3],
              'image': state_attr(entity_id, 'logo_url'),
              'tap_action': {
                'action': 'url',
                'url_path': state_attr(entity_id, 'item_url')
              }
            }
          }},
        {%- endif -%}
      {%- endif -%}
    {%- endfor %}

which will look like this
image

@ov3rk1ll ov3rk1ll deleted the logo-attribute branch November 15, 2024 14:08
@tjorim tjorim linked an issue Nov 23, 2024 that may be closed by this pull request
3 tasks
tjorim added a commit that referenced this pull request Nov 23, 2024
tjorim added a commit that referenced this pull request Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

URL of the shop image
2 participants