Je vais regarder ton exemple du coup, merci
Fait…
- type: custom:decluttering-card
template: bar-card-percent-higherbetter-step20
variables:
- column: 2
- entity_exc:
- entity_id: ^sensor.robonect_battery*$
- entity_inc:
- entity_id: ^sensor.radiateur_*_battery_level$
- entity_id: ^sensor.*_battery$
- entity_id: ^sensor.tpms*_batt$
- entity_id: ^sensor.*_battery_charge$
bar-card-percent-higherbetter-step20:
element:
type: custom:auto-entities
card:
type: custom:bar-card
title_position: inside
height: 38
card_mod: null
positions:
icon: inside
indicator: inside
name: inside
value: inside
show_icon: true
align: split
columns: '[[column]]'
max: 100
unit_of_measurement: '%'
severity:
- color: '#d11e1e'
from: 0
to: 5
- color: '#cf2d11'
from: 6
to: 10
- color: '#cc3900'
from: 11
to: 15
- color: '#c84400'
from: 16
to: 20
- color: '#c44d00'
from: 21
to: 25
- color: '#bf5600'
from: 26
to: 30
- color: '#b95f00'
from: 31
to: 35
- color: '#b36600'
from: 36
to: 40
- color: '#ac6e00'
from: 41
to: 45
- color: '#a57500'
from: 46
to: 50
- color: '#9d7b00'
from: 51
to: 55
- color: '#948100'
from: 56
to: 60
- color: '#8b8700'
from: 61
to: 65
- color: '#818d00'
from: 66
to: 70
- color: '#769200'
from: 71
to: 75
- color: '#6a9700'
from: 76
to: 80
- color: '#5d9c00'
from: 81
to: 85
- color: '#4da100'
from: 86
to: 90
- color: '#39a500'
from: 91
to: 95
- color: '#15a911'
from: 96
to: 100
style: |
bar-card-currentbar, bar-card-current, bar-card-backgroundbar {
height: 5px !important;
margin-top: 30px;
}
ha-card {
background: none;
box-shadow: none;
}
ha-icon{
color: white !important;
}
bar-card-iconbar {
margin-bottom: 10px;
}
animation:
state: 'on'
speed: '2'
filter:
exclude: '[[entity_exc]]'
include: '[[entity_inc]]'
@Pulpy-Luke , je cherchais justement une carte automatique pour surveiller les batteries de mes capteurs sans forcément mettre à jour une carte à chaque fois que j’en ajoute un.
J’ai donc suivi ton code et je n’arrive pas à avoir des icône comme toi qui sont spécifique au sensor.
Peux-tu expliquer comment tu fais pour afficher l’icône d’une lampe sur « Chevet 1 » par exemple et afficher un friendly_name sympa s’il te plait ?
Car quand j’ajoute ce code sur mon Lovelace :
Code carte Batterie
type: custom:auto-entities
card:
type: custom:bar-card
title_position: inside
height: 38
positions:
icon: inside
indicator: inside
name: inside
value: inside
show_icon: true
align: split
columns: '2'
max: 100
unit_of_measurement: '%'
severity:
- color: '#d11e1e'
from: 0
to: 5
- color: '#cf2d11'
from: 6
to: 10
- color: '#cc3900'
from: 11
to: 15
- color: '#c84400'
from: 16
to: 20
- color: '#c44d00'
from: 21
to: 25
- color: '#bf5600'
from: 26
to: 30
- color: '#b95f00'
from: 31
to: 35
- color: '#b36600'
from: 36
to: 40
- color: '#ac6e00'
from: 41
to: 45
- color: '#a57500'
from: 46
to: 50
- color: '#9d7b00'
from: 51
to: 55
- color: '#948100'
from: 56
to: 60
- color: '#8b8700'
from: 61
to: 65
- color: '#818d00'
from: 66
to: 70
- color: '#769200'
from: 71
to: 75
- color: '#6a9700'
from: 76
to: 80
- color: '#5d9c00'
from: 81
to: 85
- color: '#4da100'
from: 86
to: 90
- color: '#39a500'
from: 91
to: 95
- color: '#15a911'
from: 96
to: 100
style: |
bar-card-currentbar, bar-card-current, bar-card-backgroundbar {
height: 5px !important;
margin-top: 30px;
}
ha-card {
background: none;
box-shadow: none;
}
ha-icon {
color: white !important;
}
bar-card-iconbar {
margin-bottom: 10px;
}
animation:
state: 'on'
speed: '2'
filter:
include:
- entity_id: ^sensor.*_battery$
exclude: []
sort:
method: friendly_name
show_empty: false
Je vois toujours l’icône « oeil » et des nom pas très « friendly »
Salut
Si tu cliques sur l’entité puis roue crantée en haut à droite, tu dois pouvoir éditer l’icône et le nom.
Salut,
C’est nickel chrome, j’essaierais de le faire
On peut même faire des cartes decluterring qui utilisent des cartes decluterring
bar-card_percent_generic:
element:
type: custom:auto-entities
card:
type: custom:bar-card
title_position: inside
height: 38
card_mod: null
positions:
icon: inside
indicator: inside
name: inside
value: inside
show_icon: true
align: split
columns: '[[column]]'
max: 100
unit_of_measurement: '%'
severity: '[[severity]]'
style: |
bar-card-currentbar, bar-card-current, bar-card-backgroundbar {
height: 5px !important;
margin-top: 30px;
}
ha-card {
background: none;
box-shadow: none;
}
ha-icon{
color: white !important;
}
bar-card-iconbar {
margin-bottom: 10px;
}
animation:
state: 'on'
speed: '2'
filter:
exclude: '[[entity_exc]]'
include: '[[entity_inc]]'
bar-card_percent_higherbetter_step20:
element:
type: custom:decluttering-card
template: bar-card_percent_generic
variables:
- column: '[[column]]'
- entity_exc: '[[entity_exc]]'
- entity_inc: '[[entity_inc]]'
- severity:
- color: '#d11e1e'
from: 0
to: 5
- color: '#cf2d11'
from: 6
to: 10
- color: '#cc3900'
from: 11
to: 15
- color: '#c84400'
from: 16
to: 20
- color: '#c44d00'
from: 21
to: 25
- color: '#bf5600'
from: 26
to: 30
- color: '#b95f00'
from: 31
to: 35
- color: '#b36600'
from: 36
to: 40
- color: '#ac6e00'
from: 41
to: 45
- color: '#a57500'
from: 46
to: 50
- color: '#9d7b00'
from: 51
to: 55
- color: '#948100'
from: 56
to: 60
- color: '#8b8700'
from: 61
to: 65
- color: '#818d00'
from: 66
to: 70
- color: '#769200'
from: 71
to: 75
- color: '#6a9700'
from: 76
to: 80
- color: '#5d9c00'
from: 81
to: 85
- color: '#4da100'
from: 86
to: 90
- color: '#39a500'
from: 91
to: 95
- color: '#15a911'
from: 96
to: 100
bar-card_percent_lowerbetter_step5:
element:
type: custom:decluttering-card
template: bar-card_percent_generic
variables:
- column: '[[column]]'
- entity_exc: '[[entity_exc]]'
- entity_inc: '[[entity_inc]]'
- severity:
- color: '#d93131'
from: 81
to: 100
- color: '#c45800'
from: 61
to: 80
- color: '#a07500'
from: 41
to: 60
- color: '#6f8b00'
from: 21
to: 40
- color: '#0f9b0f'
from: 0
to: 20
J’avais encore jamais testé top du top decluterring
Super,
Je cherchais justement une vue sympa pour mes batteries et je trouve celle ci au top.
Merci pour le partage.
Apres recopie je n’ai pas le même résultat, une idée du PB?
Merci
Salut.
Les friendly name sont trop longs et passent sur 2/3 lignes.
Tu peux au choix les raccourcir ou bien passer la carte sur 1 seule colonne
Merci pour ce retour.
J’ai changé les friendly name mais j’ai toujours le même PB (le graphique est sur l’ensemble et pas juste en petit dessous comme dans votre cas.
Merci de votre aide
As-tu installé card-mod également ?
Qui permet de changer les CSS à la volée
https://forum.hacf.fr/t/personnaliser-ses-cartes-avec-card-mod/4447
Super c’est bien cela. J’ai encore quelques petits reglage avant d’arriver à votre resultat.
Encore merci pour votre aide.
Oui encore quelques noms et la couleur des icones à changer (white)
ha-icon{
color: white !important;
}
vous avez un moyen de supprimer « batterie ou battery » dans les noms?
Merci
En changeant le nom dans l’entité directement, ce n’est pas suffisant ?
Si mais on perd l’info batterie du sensor.
Merci pour votre aide.
Je vois pas bien le lien entre les 2 ou je suis pas sur de bien comprendre
Un petit exemple détaillé avec les infos du/des sensor(s) en question (outils de développement) ?
J’ai bien un nom qui sert pour l’affichage (en vert) et un id qui contient toujours l’information batterie (en orange)
Je fais le renommage ailleurs pour ma part d’où le nom vide mais c’est pareil. et j’ai inversé 2 noms ^^
je vois mais pour ma part cela renomme les infos capteur en général.
Voici un exemple de capteur complet.