Hi all:
I’m new to tile card and have 2 questions:
Notice for some attributes tile card can find out unit of measure and display them, for example all attributes in a weather entity. However for other entities with raw attribute values I can’t seem to find a way to append the unit. Is there a solution?
Is it possible for tile card to include attribute from other entities? I have a temperature and humidity sensor and would like to display them together. Many thanks
Attributes can have UoM, depends on an integration which creates a sensor.
You can add manually any additional labels like UoM or a state of another entity to any card using a pseudo class like “after/before”, go to main card mod thread - 1st post - link to fantastic post - others - after/before for examples.
Hi @Ildar_Gabdullin : thank you will give a try. For my future reference the post is here:
Hope you don’t mind me asking for a different question:
I have extensively used card-mod in picture element card (main floor plan) and bubble card pop-ups which can embed another picture element card. I noticed when I refresh the page or load the page first time from browser, card-mod style doesn’t apply consistently. I can always solve the issue by switch to another HA page (like energy) and switch back then everything works.
Recently I leaned a trick to load by adding card-mod.js to “frondend” in configuration.yaml. So it works better for the top level picture element card (floor plan) which consistently loads the styling. However the secondary pop-up picture element card (via bubble card pop-up) doesn’t get the styling always, and the trick is the same to switch to another HA page and then switch back, everything works again.
I’m trying everything that I can find online to attack this issue but nothing works so far, so would like to ask if you have heard similar issue and what was the solution? Very much appreciated!
Technically, it is better to ask this either in the main card-mod thread (better) or create a separate thread since it is not related to the main topic.
Can say nothing about bubbles.
If you experience issues with INSTANT applying of cardmod - consider using an external JS, find examples in main card-mod thread. (also in that fantastic post)
If you are using Frontend module then you are likely now running two versiosn of card_mod so will still see weird issues like card_mod not applying - card_mod should always apply, even if slightly delayed. If it is not applying but does on change view etc, then it is likely due to duplicate card_mod running. See README in v4 beta branch which have an updated readme. This also applies to current release 3.4.5.
In summary if you have both Dashboard resource URL and Frontend module URL, they need to match EXACTLY including ?hacstag...
Dear @dcapslock : thank you very much! I tried to update the path in configuration.yaml to match with resources and it indeed loads faster and more consistently now. However one of my pop-up picture element card still doesn’t get (some) styles applied for some reason, other pop-ups to work great now. The most strange part is for this particular pop-up, the complex style like spinning fan and a few icon-labels gets applied, however simple style like set background colour of the card and other icon-labels don’t apply. I suspect something wrong with my yaml. Have no idea how to troubleshoot such issue. The issue can be solved by simply switch to another HA page and switch back, so maybe some conflicting order of load resources. I’m not a UI developer so running out of ideas…
If mod-card works then you will find v4 (in beta) should work fine without mod-card. I say that the timimg of ha-card being available may have to do with loading of image. v4 will patch via hui-card which contains picture elememts card where v3.4.5 patches from ha-card which is in shadow root of picture elements card.
you can also try if using a setter for the fan-mode helps
{% set ventilation = states('binary_sensor.nilan_ventilation_off') %}
{% set fan_mode = state_attr('climate.nilan_ventilation', 'fan_mode') %}
{% if is_state(ventilation, 'on') %}
color: #f44336; /* Red when off */
animation: none;
{% elif fan_mode == 'low' %}
color: #45729e; /* Blue low */
animation: rotation 4s linear infinite;
{% elif fan_mode == 'middle' %}
color: #4caf50; /* Green middle */
animation: rotation 2s linear infinite;
{% elif fan_mode == 'medium' %}
color: #ffeb3b; /* Yellow medium */
animation: rotation 1.5s linear infinite;
{% elif fan_mode == 'high' %}
color: #ffc108; /* Orange high */
animation: rotation 1s linear infinite;
{% else %}
color: #9e9e9e; /* Grey fallback */
animation: none;
{% endif %}
}
its always wise to make those templates as robust as possible. using a setter like this assures there wont be timing problems inside the template itself
personally, I’d take out these comments inside the /* */ escapers, to be sure that wont break the interpreter under the multiline pipe. just incase…
if must be use the jinja comments
{% set ventilation = states('binary_sensor.nilan_ventilation_off') %}
{% set fan_mode = state_attr('climate.nilan_ventilation', 'fan_mode') %}
{# Red when off #}
{% if is_state(ventilation, 'on') %}
color: #f44336;
animation: none;
{# Blue low #}
{% elif fan_mode == 'low' %}
color: #45729e;
animation: rotation 4s linear infinite;
{# Green middle #}
{% elif fan_mode == 'middle' %}
color: #4caf50;
animation: rotation 2s linear infinite;
{# Yellow medium #}
{% elif fan_mode == 'medium' %}
color: #ffeb3b;
animation: rotation 1.5s linear infinite;
{# Grey fallback #}
{% elif fan_mode == 'high' %}
color: #ffc108;
animation: rotation 1s linear infinite;
{# Grey fallback #}
{% else %}
color: #9e9e9e;
animation: none;
{% endif %}
}
You’ll see the difference in the dev tools template editor
but, this has evolved a lot out of the original topic…