Skip to content

[Feature]: allow the location/zone icon to be rendered in the text #1944

Description

@rolfvreijdenberger

Requirements

  • I have updated Mushroom to the latest available version
  • I did a search to see if there is a similar issue or if a pull request is open.

Is your feature request related to a problem?

Happy mushroom badge user here :)

I'd like to be able to show the location icon in the content section since we are using zones a lot in the family and the visual representation of the zone (the mdi icon) is a great addition. They cannot be rendered in the label or content field.

Describe the solution you'd like

I'd like to keep the entity image belonging to the person, as it is currently (see the screenshot).
But then, where the location/zone name is, i would also like to have the mdi-icon rendered.

As you can see in the screenshot, I'm using the template badge for entity 'lex' to display his glucose value (he's diabetic).
To be able to use the entity picture, i'm using the 'picture' field.

And in the content, I'd like to render an icon. (possibly, that could also be done for the 'label', where I am currently using unicode emojis.

type: custom:mushroom-template-badge
content: '{{states.person.lex.state | capitalize | replace(''Not_home'', ''Away'') }}'
icon: mdi:diabetes
color: >-
  {% set glucose_value = states.sensor.lex_glucose_value.state |
  default('-', true) %}

  {% if glucose_value == '-' %}
    blue
  {% elif glucose_value | float < 4 %}
    red
  {% elif glucose_value | float >= 4 and glucose_value | float <= 10 %}
    green
  {% else %}
    orange
  {% endif %}
entity: sensor.lexglucose_values
label: >-
  lex 

  {% set trend_value = states.sensor.lex_glucose_trend.state |
  default('-', true) | lower -%}

  {% if trend_value == 'steady' -%}

  ➡️

  {%- elif trend_value == 'rising_quickly' -%}

  ⬆️

  {% elif trend_value == 'rising_slightly' -%}

  ↗️

  {% elif trend_value == 'rising' -%}

  ⤴️

  {% elif trend_value == 'falling' -%}

  ⤵️

  {% elif trend_value == 'falling_slightly' -%}

  ↘️

  {% elif trend_value == 'falling_quickly' -%}

  ⬇️

  {% else -%}

  {% endif -%}

  {{ (states.sensor.lex_glucose_value.state | lower | default('-',
  true) | replace('unknown', '?') | float | round(1)) if
  (states.sensor.lex_glucose_value.state | lower | default('-',
  true) | replace('unknown', '?')) | regex_match('^[0-9.]+$') else
  (states.sensor.lex_glucose_value.state | lower | default('-',
  true) | replace('unknown', '?')) }}
hold_action:
  action: navigate
  navigation_path: >-
    /history?entity_id=sensor.lex_glucose_value,sensor.statistics_lex_glucose_value_average
picture: /api/image/serve/86dcc67c7c079c5bcc0762375ea31e3b/512x512
tap_action:
  action: more-info
  entity: person.lex
double_tap_action:
  action: more-info
  entity: sensor.lex_glucose_value
visibility:
  - condition: state
    entity: person.lex
    state_not: home

Describe alternatives you've considered

Additional context

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions