Hi Thomas, I am trying to integrate card-mod with my custom card but not having much success. In my render method, I output an ha-card tag. I looked at the new build chain for your ha-card.js which inserts a shadowdom at that element when entity_ids is populated. How/where does entity_ids get set in the ha-card lifecycle?
Card-mod looks for a property named config
or _config
in the parent nodes of the ha-card element (keeps looking up the tree if necessary).
Pretty much every card Iāve seen sets this property in the setConfig
function, and itās the only requirement for card-mod to work.
entity_ids
is a property in the card configuration, but is entirely optional. It can be used to tweak the update behavior of templates, but should generally not be necessary.
Anyway, itās nothing you should need to bother with.
I installed the card-mod using HACS. After a moment wondering the missing style changes, I noticed the error in web-console:
TypeError: Error resolving module specifier: card-tools/src/templates.js
Iām running HA 0.105.2, card-mod 12. Any hint how to resolve this error, a resource missing from the installation, maybe? Thanks!
Update hacs to 0.21.2 and then try again.
Update HACS to 0.21.3 and then try again.
Thank you! Update to the latest HACS + reinstall did it.
Iām trying to adjust the font-weight as it quite bold on default, everything else seems to work fine, but any syntax for font-weight doesnāt change anything, Iāve tried the following:
font-weight: normal;
font-weight: bold;
font-weight: lighter;
font-weight: 300;
Any ideas? thanks
I have a strange bug that seems to be repeatedly adding the (Iām assuming) default āha-cardā style block to my card, over and over again when using mod-card. Maybe something is ever so slightly off with my syntax?
Here is what my card (which appears to work fine) looks like with the style tweaks I needed to add:
type: 'custom:mod-card'
style: |
ha-card {
background-color: #263137;
overflow: hidden;
}
card:
cards:
- cards:
- entity: group.my_phone
show_name: false
state_image:
not_home: /local/my_away_crop.jpg
home: /local/my_crop.jpg
type: picture-entity
- entity: group.her_phone
show_name: false
state_image:
not_home: /local/her_away_crop.jpg
home: /local/her_crop.jpg
type: picture-entity
type: horizontal-stack
- entities:
- entity: input_boolean.im_actually_away
- entity: input_boolean.shes_actually_away
show_header_toggle: false
type: entities
type: 'custom:vertical-stack-in-card'
and here is what it looks like after I open it and save a couple times without making any changesā¦
type: 'custom:mod-card'
style: |
ha-card {
background: none;
box-shadow: none;
}
ha-card {
background: none;
box-shadow: none;
}
ha-card {
background: none;
box-shadow: none;
}
ha-card {
background: none;
box-shadow: none;
}
ha-card {
background: none;
box-shadow: none;
}
ha-card {
background: none;
box-shadow: none;
}
ha-card {
background: none;
box-shadow: none;
}
ha-card {
background: none;
box-shadow: none;
}
ha-card {
background: none;
box-shadow: none;
}
ha-card {
background: none;
box-shadow: none;
}
ha-card {
background: none;
box-shadow: none;
}ha-card {
background-color: #263137;
overflow: hidden;
}
card:
cards:
- cards:
- entity: group.my_phone
show_name: false
state_image:
not_home: /local/my_away_crop.jpg
home: /local/my_crop.jpg
type: picture-entity
- entity: group.her_phone
show_name: false
state_image:
not_home: /local/her_away_crop.jpg
home: /local/her_crop.jpg
type: picture-entity
type: horizontal-stack
- entities:
- entity: input_boolean.im_actually_away
- entity: input_boolean.shes_actually_away
show_header_toggle: false
type: entities
type: 'custom:vertical-stack-in-card'
card-mod doesnāt work for me.
I uninstalled it via hacs and reinstalled it.
Nothing works.
Maybe you can help me further.
Thank you.
Mine shows the same error/warning at the bottom when styling a simple entities card but it still works and applies the style changes when I save. Does yours do nothing on save? Maybe try some other CSS tags?
Should be fixed in release 13
Updated to v13, still having the issue. Installed via HACS (0.21.5) and running HA 0.105.1. About to update HA to latest and try again.
Edit - HA Update didnāt help
Edit 2 - Itās working as it should now. Weird because I havenāt changed anything in the past couple hours since updating, but all is good, thanks!
Works perfectly again for me. Cache has to be cleared out after the update.
Would it be possible to move the Entity name below the icon, but above the state on the Glance card with this mod, as shown below? thanks
Is it possible to concatenate text within a style? Or maybe that isnāt the right question.
I have 2 input booleans set up on multiple people for presence detection.
- input_boolean.name
- input_boolean.name_phone
I then have a glance card that auto populates when āi_b.nameā goes true and all that is working well. Iād like to take it a step further and change the text color based on the state of āi_b.name_phoneā.
For the style on the card, I wanted to modify the code here:
--primary-text-color: {% if is_state('config.entity', 'on') %} red {% else %} green {% endif %};
to where is would pick up the āi_b.nameā entity but then add ā_phoneā to the end of config.entity. I tried
if is_state('config.entity'+'_phone', 'on')
but that didnāt work.
I guess what I ultimately want to do is apply a style to a glance card entity based on the state of a different (but similar) entity and not affect the other entities on the card.
I hope Iām explaining it well enough.
Itās config.entity
, not 'config.entity'
.
I found both a reason and a temporary solution. The reason is a bug of hassio itself. the latest working version is 0.104. the Temporary solution is use custom:button-card instead of entity-button (HA).
So the line should read
if is_state(config.entity+'_phone', 'on')
Is that correct?