lovelace-mushroom icon indicating copy to clipboard operation
lovelace-mushroom copied to clipboard

[Bug]: Secondary information not rendered in Template Card

Open lavinir opened this issue 10 months ago • 2 comments

Requirements

  • [X] I checked the troubleshooting section in the README to verify that I have the latest Mushroom version.
  • [X] I did a search to see if there is a similar issue or if a pull request is open.
  • [X] I have read the state of card mod support (in pin issues) and understand card mod support is not provided in this repository.

Current Behavior

I'm trying to get the template card to show a list of the open windows. I wrote a template and tested it in the Dev Tools which is showing the proper output. However when inserting the template into the card I get empty output and nothing is rendered.

Expected Behavior

The template output should be rendered in the card

Steps To Reproduce

  1. Create template card
  2. Paste in YAML in the context below (assumes you have at least one binary sensor of class 'window' which is open

Context

type: conditional
conditions:
  - condition: state
    entity: binary_sensor.all_windows
    state: 'on'
card:
  type: custom:mushroom-template-card
  primary: There are open windows
  secondary: >-
    {% for state in states.binary_sensor if state.attributes.device_class ==
    'window' and state.state == 'on' %} {{ state.name }} {% endfor %}
  icon: mdi:window-open
  icon_color: '#FF9900'
  multiline_secondary: true


### Environment

```markdown
- Browser: Brave
- HA Version: 2024.4.3
- Mushroom:3.5.4

Anything else?

No response

lavinir avatar Apr 18 '24 10:04 lavinir

I am getting this also. I know that the state is 'None' and I see that the icon colour is set as expected but the Secondary info is blank. Also, Putting the state in the Primary info works fine.

type: custom:mushroom-template-card
primary: |-
  {% if states(entity) == 'None' %}
    No radiators need heat at the moment
  {% else %}
    Radiators needing heat
  {% endif %}
secondary: '{{ states(entity) }}'
icon: mdi:radiator
entity: input_text.radiators_needing_heat
fill_container: false
multiline_secondary: true
tap_action:
  action: none
hold_action:
  action: none
double_tap_action:
  action: none
layout: horizontal
icon_color: |-
  {% if states(entity) == 'None' %}
    black
  {% else %}
    red
  {% endif %}

hunterdrayman avatar Apr 19 '24 10:04 hunterdrayman

Same here

adnansarajlic avatar Jun 06 '24 19:06 adnansarajlic