Open ov1d1u opened 1 year ago
I have an issue that is very close, trying to built a weather mushroom card using either entity or template card (I want it bigger that the wonderful weather chip...)
This would be a great feature as I also frequently find myself resorting to using icon: "{{ state_attr(entity, 'icon') }}"
. I find that this doesn't always work though as some entities don't appear to expose an icon attribute. In particular I'm having problems with a weather entity. It would be great if the card could behave more like the Mushroom Entity card when not using a template value.
Along the same lines, I have trouble with the entity state using the Template card, again with a weather entity. If I have something like secondary: {{ states(entity) }}
it might display partlycloudy
rather than Partly Cloudy
, as it would appear using the Mushroom Entity card.
For the icon, options I can think of might include:
icon: None
to hide the icon. To be consistent with the Entity card I suppose you'd specify icon_type: none
instead.icon: sensor.xyz
. The entity may already have been specified under entity: sensor.xyz
, although this would allow you to reference a different entity if desired. It might be nice (and consistent) to allow any of icon: entity
(which references the card's entity) or icon: sensor.xyz
.Do something similar for the primary:
and secondary:
values:
primary: entity
or primary: sensor.xyz
to be specified, which would display the regionalized entity state string as occurs with the Mushroom Entity card.name
, state
, none
, etc. to be specified.
Requirements
Is your feature request related to a problem?
I know that I could use
{{ state_attr('switch.entity_id', 'icon') }}
for icon in a template card, but this requires a request to the HA backend (which causes some rendering issues) and it doesn't return an icon reflecting the current state of the entity. It would be nice to directly reference the entity icon (and other things, such the entity's name) in the template card fields.Describe the solution you'd like
I'm not sure how the best solution would look here. I made an implementation here for my personal use which detects if the icon value is not a template and contains a . (dot) and if it does, it uses
stateIcon
with that value. I know it is a stupid solution (I just discovered this project yesterday so I'm not really experienced with the code) so something better needs to be designed. I'm not primarily a TypeScript developer, but I'm willing to contribute with a solution.Describe alternatives you've considered
No response
Additional context
No response