question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: template card not rendering icon and icon_color

See original GitHub issue

Current Behavior

Template is not rendering for

  • icon
  • icon_color

However it renders properly for

  • primary
  • secondary

Expected Behavior

We expect it to render properly.

Steps To Reproduce

We have a presence integration that creates a sensor as follow image

We’re using Template card like this

type: custom:mushroom-template-card
primary: '{{ states(''sensor.presence_REDACTED'') }}'
secondary: '{{ states[''sensor.presence_REDACTED''].attributes.availability }}'
icon: '{{ states[''sensor.presence_REDACTED''].attributes.icon }}'
icon_color: '{{ states[''sensor.presence_REDACTED''].attributes.color }}'
tap_action:
	action: more-info
entity: sensor.presence_REDACTED
fill_container: false

As seen, availability is an attribute similar to icon and color. Code renders properly for secondary, but not for icon or icon_color

In fact it break the rest of the rendering, and even primary / secondary don’t get displayed if icon and icon_color have the above code. image

Environment

- OS: Ubuntu
- Browser: Chrome
- Version: 1.9.0
- Hassio: Home Assistant Core 2022.6.4
Home Assistant Supervisor 2022.05.3

Anything else?

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
123devcommented, Jun 15, 2022

Thank you @piitaya it’s working all good now, and by the way, wonderful project. This issue can be resolved as None Issue

1reaction
123devcommented, Jun 15, 2022

Apologies, it might be working, I think the attributes were not properly updated and it was throwing me off. I will do some troubleshooting and report back, I believe state_attr is good to use.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Struggling with card_mod not changing icon colour / color ...
I get the expected displayed card on my PC but when using the iPhone app or Android app the icon is blue and...
Read more >
--card-mod-icon stopped working in Entities card · Issue #176 ...
I found that the --card-mod-icon stops working (or works sometimes after F5) in case of using a card-mod-theme. With the default theme or...
Read more >
Mushroom chip card not changing icon color : r/homeassistant
Entity chips seem to have a bug or something. Are you on the latest version of mushroom? Here's my config for icon color...
Read more >
SwiftUI - Unable to change color of Image icon - Stack Overflow
I'm not sure what are you trying to to achieve, but probably you just need template rendering mode, like. Image(self.icon) .
Read more >
ion-item - Ionic Framework
ion-item elements for iOS/Android contain text, icons, images, and other custom elements. They're placed in a list and can be input, deleted, edited, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found