J’ai essayer et toujours une carte vide (alors que j’ai une MAJ en attente de redemarrage.
Il n’y a qu’en ajoutant
selectattr('attributes.release_summary','defined') |
que ca fonctionne chez moi
J’ai essayer et toujours une carte vide (alors que j’ai une MAJ en attente de redemarrage.
Il n’y a qu’en ajoutant
selectattr('attributes.release_summary','defined') |
que ca fonctionne chez moi
bizarre, comme dit chez moi le copier coller ne fonctionne pas non plus mais en suppriment la première variable et en la remettent en forme correctement la carte s’affiche.
selectattr(‹ attributes.release_summary ›,‹ defined ›)
parce que cette fonction n’ajoute rien de plus que de vérifié que l’attribut et présent sachant que chez moi il est sur tous les updates.
enfin le principal c’est que ça fonctionne.
Mais oui je sais bien ca m’a rendu fou il y a deux jours ca ne fais que verifier si elles possèdent l’attribut, mais ca ne marchait pas. Alors que dans Outils de développements → modèles, ca fonctionnait bien :o
Salut,
Désolé, je n’ai pas trop eu de temps dernièrement
Ok, j’abandonne l’idée alors.
J’ai quand même essayé sur 3 entités de MAJ :
homeassistant:
customize:
# update.hacs_update:
# entity_picture: /local/icons_images/hacs.png
update.local_conditional_card_update:
entity_picture: /local/_images/hacs.png
update.local_conditional_card_update:
entity_picture: /local/_images/hacs.png
update.mushroom_update:
entity_picture: /local/_images/hacs.png
J’ai bien placé le fichier hacs.png
dans /config/www/_images/hacs.png
, mais j’ai une entité qui résiste :
(je précise que les deux autres n’avaient pas d’icone/image avant) :
@BBE , sympa ça
/Mode fainéant : tu ne voudrais pas partager le code du template s’il te plait ?
Salut,
ça ne fonctionne pas en ajoutant custom brand icon ?
homeassistant:
customize:
update.custom_brand_icons_update:
entity_picture: /local/_images/hacs.png
Ha punaise oui ! J’avais pas vu que je n’avais pas modifié un des copier coller dans mon code
homeassistant:
customize:
# update.hacs_update:
# entity_picture: /local/icons_images/hacs.png
update.local_conditional_card_update:
entity_picture: /local/_images/hacs.png
update.custom_brand_icons_update:
entity_picture: /local/_images/hacs.png
update.mushroom_update:
entity_picture: /local/_images/hacs.png
Du coup là c’est bon
Mais va falloir que j’ajoute manuellement un icône quand une des entités n’en a pas lol
Oui lol
pour ça que j’ai abandonné l’idée des icônes.
Il y a une soluce pour éviter de maintenir une liste …
{{state_attr(core_entity, 'entity_picture')|default('/local/images/hacs.png',true)}}
Si le résultat de state_attr
n’existe pas, ça prends l’image par défaut.
En mettant ça dans la carte, pas besoin de tout vérifier
Je mets ça où exactement dans la carte ?
Perso je suis resté sur la carte que j’avais fait pour @Schumi à l’époque
- type: markdown
content: >-
{%- set core_entities = states['update'] |
selectattr("state","eq","on") | map(attribute='entity_id') |list -%}
{%- set sum = core_entities|length -%} {%- if sum > 0%}
<table><thead><tr><th colspan="2">
{{ sum }} Mise{{ 's' if sum > 1 else '' }} à jour disponible{{ 's' if sum > 1 else '' }}
</th></tr></thead><tbody>
{%- for core_entity in core_entities -%}
<tr>
<td><img src="{{state_attr(core_entity, 'entity_picture')|default('/local/images/brands/hacs.png',true)}}" height="20"></td>
<td><a href="{{ state_attr(core_entity, 'release_url') }}">{{ state_attr(core_entity, 'title')| default(state_attr(core_entity,"friendly_name")|title, boolean=true) }} ⭐ {{ state_attr(core_entity,'installed_version') }} ⏩ {{ state_attr(core_entity, 'latest_version') }}</a> ({{ state_attr(core_entity, 'friendly_name')|title }})</td>
</tr>
{%- endfor -%}
{%- endif -%}
Il y a tellement de versions sur ce sujet, que je ne connais pas la tienne
Sur une carte flex-table-card
@BBE , pour info il y a une petite coquille dans ton code qui contrôle si HACS est à jour, c’est dans ta clause select(‹ is_state ›,‹ of ›) au lieu de select(‹ is_state ›,‹ on ›)
ce qui donne avant:
et après
Dans tous les cas un GRAND MERCI pour tout ce contenu à tout le monde (j’ai aussi joué avec le codes des bubble) ^^
Oui exact je m’en suis aperçu aussi en voyant cette notif de maj ^^
Bonsoir,
Toutes ces discussions m’ont donné qques idées et envie de voire ce que je pourrais faire.
Design originel = @WarC0zes et beaucoup d’autres pour toutes les idées !!
Voila ce que cela donne:
et j’ai créé mon premier template avec des variables ^^!!!
Le voici
button_card_templates:
addon-states:
color: rgb(31, 111, 235)
aspect_ratio: 1/1
show_icon: false
show_entity_picture: true
show_label: true
label: |
[[[
if (entity.state == "on") return '<font color="red">Mise à jour</font>';
else return '<font color="green">À jour</font>';
]]]
state:
- value: 'on'
styles:
state:
- color: red
- value: 'off'
styles:
state:
- color: green
styles:
card:
- padding: 0.2em
- background-color: |
[[[
const my_id = variables.var_run;
const STATE = states[my_id].state;
if (STATE === 'off')
return "rgb(230,38,0,0.3)";
else return "";
]]]
- '--mdc-ripple-color': rgb(68, 115, 158)
- '--mdc-ripple-press-opacity': 0.5
- transition: true
- font-size: 16px
icon:
- opacity: 1
- animation: |
[[[ if (entity.state == 'on') return 'blink 2s ease infinite'; ]]]
custom_fields:
ncpu:
- position: absolute
- left: 4px
- top: 3px
- font-size: 10px
cpu:
- position: absolute
- left: 23%
- top: 3px
- font-size: 10px
nram:
- position: absolute
- left: 52%
- top: 3px
- transition: true
- font-size: 10px
ram:
- position: absolute
- left: 75%
- top: 3px
- transition: true
- font-size: 10px
name:
- font-weight: normal
- font-size: 0.85em
- white-space: normal
state:
- font-size: 0.75em
- white-space: normal
label:
- font-size: 0.75em
- white-space: normal
custom_fields:
ncpu:
card:
type: custom:button-card
name: CPU
styles:
name:
- font-size: 10px
- font-weight: bold
- justify-self: start
- color: rgba(255,255,255,0.5)
card:
- background-color: rgba(255,255,255,0.0)
- border: none
tap_action:
action: none
hold_action:
action: none
nram:
card:
type: custom:button-card
name: RAM
styles:
name:
- font-size: 10px
- font-weight: bold
- color: rgba(255,255,255,0.5)
- justify-self: start
card:
- background-color: rgba(255,255,255,0.0)
- border: none
tap_action:
action: none
hold_action:
action: none
cpu:
card:
type: custom:button-card
entity: |
[[[
return variables.var_cpu;
]]]
show_name: false
show_icon: false
show_state: true
tap_action: none
state_display: |
[[[
const my_id = variables.var_cpu;
const STATE = states[my_id].state;
if (STATE === 'unavailable')
return "n/a";
else return (Math.round(STATE*10)/10) + "%";
]]]
styles:
state:
- font-size: 10px
- font-weight: bold
- color: dimgray
- justify-self: end
- padding-right: 3%
ram:
card:
type: custom:button-card
entity: |
[[[
return variables.var_ram;
]]]
show_name: false
show_icon: false
show_state: true
tap_action: none
state_display: |
[[[
const my_id = variables.var_ram;
const STATE = states[my_id].state;
if (STATE === 'unavailable')
return "n/a";
else return (Math.round(STATE*10)/10) + "%";
]]]
styles:
state:
- font-size: 10px
- font-weight: bold
- color: dimgray
- justify-self: end
- padding-right: 3%
Et voici le code de la carte:
type: custom:vertical-stack-in-card
cards:
- type: picture
image: /local/images/home-assistant2.png
card_mod:
style: |
ha-card {
border-radius: 0px;
}
- type: horizontal-stack
cards:
- type: custom:button-card
entity: update.home_assistant_core_update
icon: mdi:home-assistant
size: 50px
name: HA CORE
aspect_ratio: 1.1/1
styles:
card:
- color: var(--text-medium-color)
- padding-left: 10px
- border-radius: 20px
- padding: 5%
- font-size: 12px
- text-transform: capitalize
- border-radius: 0px
- size: 50px
grid:
- grid-template-areas: '"i i" "n n" "cpu cpu" "ram ram" "cpu2 cpu2" "sd sd"'
- grid-template-columns: 1fr 1fr
- grid-template-rows: 1fr min-content min-content min-content min-content min-content
name:
- font-weight: bold
- font-size: 12px
- align-self: middle
- justify-self: start
- padding-bottom: 4px
- color: var(--text-color)
icon:
- color: |
[[[
if (entity.state == 'on') return 'red';
return 'rgb(31, 111, 235)';
]]]
- width: 45%
- animation: >
[[[ if (entity.state == 'on') return 'blink 2s ease infinite';
]]]
custom_fields:
cpu:
- '--text-color-sensor': >-
[[[if
(states['update.home_assistant_core_update'].attributes.latest_version
!=
states['update.home_assistant_core_update'].attributes.installed_version)
return "red";else return "green"]]]
- padding-bottom: 2px
- justify-self: start
ram:
- padding-bottom: 2px
- justify-self: start
cpu2:
- padding-bottom: 2px
- justify-self: start
custom_fields:
cpu: |
[[[
return `<ha-icon icon="mdi:home-assistant" style="width: 16px; height: 16px; color: rgb(31, 111, 235);"></ha-icon>
<span>Disponible: <span style="color: var(--text-color-sensor);">${states['update.home_assistant_core_update'].attributes.latest_version}</span></span>`
]]]
ram: |
[[[
return `<ha-icon icon='mdi:home-assistant' style='width: 16px; height: 16px; color: rgb(31, 111, 235);'></ha-icon>
<span>Installée: <span style='color: var(--text-color-sensor);'>${states['update.home_assistant_core_update'].attributes.installed_version}</span></span>`
]]]
cpu2: |
[[[
return `<ha-icon icon='mdi:home-assistant' style='width: 16px; height: 16px; color: rgb(31, 111, 235);'></ha-icon>
<span>CPU:<span style='color: var(--text-color-sensor);'>${states['sensor.home_assistant_core_cpu_percent'].state}% RAM:${states['sensor.home_assistant_core_memory_percent'].state}% </span></span>`
]]]
- type: custom:button-card
entity: update.home_assistant_supervisor_update
icon: mdi:home-assistant
size: 50px
name: HA SUPERVISOR
aspect_ratio: 1.1/1
styles:
card:
- color: var(--text-medium-color)
- padding-left: 10px
- border-radius: 20px
- padding: 5%
- font-size: 12px
- text-transform: capitalize
- border-radius: 0px
- size: 50px
grid:
- grid-template-areas: '"i i" "n n" "cpu cpu" "ram ram" "cpu2 cpu2" "sd sd"'
- grid-template-columns: 1fr 1fr
- grid-template-rows: 1fr min-content min-content min-content min-content min-content
name:
- font-weight: bold
- font-size: 12px
- align-self: middle
- justify-self: start
- padding-bottom: 4px
- color: var(--text-color)
icon:
- color: |
[[[
if (entity.state == 'on') return 'red';
return 'rgb(31, 111, 235)';
]]]
- width: 45%
- animation: >
[[[ if (entity.state == 'on') return 'blink 2s ease infinite';
]]]
custom_fields:
cpu:
- '--text-color-sensor': >-
[[[if
(states['update.home_assistant_supervisor_update'].attributes.latest_version
!=
states['update.home_assistant_supervisor_update'].attributes.installed_version)
return "red";else return "green"]]]
- padding-bottom: 2px
- justify-self: start
cpu2:
- padding-bottom: 2px
- justify-self: start
ram:
- padding-bottom: 2px
- justify-self: start
custom_fields:
cpu: |
[[[
return `<ha-icon icon="mdi:home-assistant" style="width: 16px; height: 16px; color: rgb(31, 111, 235);"></ha-icon>
<span>Disponible: <span style="color: var(--text-color-sensor);">${states['update.home_assistant_supervisor_update'].attributes.latest_version}</span></span>`
]]]
ram: |
[[[
return `<ha-icon icon='mdi:home-assistant' style='width: 16px; height: 16px; color: rgb(31, 111, 235);'></ha-icon>
<span>Installée: <span style='color: var(--text-color-sensor);'>${states['update.home_assistant_supervisor_update'].attributes.installed_version}</span></span>`
]]]
cpu2: |
[[[
return `<ha-icon icon='mdi:home-assistant' style='width: 16px; height: 16px; color: rgb(31, 111, 235);'></ha-icon>
<span>CPU:<span style='color: var(--text-color-sensor);'>${states['sensor.home_assistant_supervisor_cpu_percent'].state}% RAM:${states['sensor.home_assistant_supervisor_memory_percent'].state}% </span></span>`
]]]
- type: custom:button-card
entity: update.home_assistant_operating_system_update
icon: mdi:home-assistant
size: 50px
name: HA OS
aspect_ratio: 1.1/1
styles:
card:
- color: var(--text-medium-color)
- padding-left: 10px
- border-radius: 20px
- padding: 5%
- font-size: 12px
- text-transform: capitalize
- border-radius: 0px
- size: 50px
grid:
- grid-template-areas: '"i i" "n n" "cpu cpu" "ram ram" "cpu2 cpu2" "sd sd"'
- grid-template-columns: 1fr 1fr
- grid-template-rows: 1fr min-content min-content min-content min-content
name:
- font-weight: bold
- font-size: 12px
- align-self: middle
- justify-self: start
- padding-bottom: 4px
- color: var(--text-color)
icon:
- color: |
[[[
if (entity.state == 'on') return 'red';
return 'rgb(31, 111, 235)';
]]]
- width: 45%
- animation: >
[[[ if (entity.state == 'on') return 'blink 2s ease infinite';
]]]
custom_fields:
cpu:
- '--text-color-sensor': >-
[[[if
(states['update.home_assistant_operating_system_update'].attributes.latest_version
!=
states['update.home_assistant_operating_system_update'].attributes.installed_version)
return "red";else return "green"]]]
- padding-bottom: 2px
- justify-self: start
ram:
- padding-bottom: 2px
- justify-self: start
custom_fields:
cpu: |
[[[
return `<ha-icon icon="mdi:home-assistant" style="width: 16px; height: 16px; color: rgb(31, 111, 235);"></ha-icon>
<span>Disponible: <span style="color: var(--text-color-sensor);">${states['update.home_assistant_operating_system_update'].attributes.latest_version}</span></span>`
]]]
ram: |
[[[
return `<ha-icon icon='mdi:home-assistant' style='width: 16px; height: 16px; color: rgb(31, 111, 235);'></ha-icon>
<span>Installée: <span style='color: var(--text-color-sensor);'>${states['update.home_assistant_operating_system_update'].attributes.installed_version}</span></span>`
]]]
cpu2: "[[[\n return `<span>\_ </span></span>`\n]]]\n"
- type: custom:text-divider-row
text: LOGS
- type: horizontal-stack
cards:
- type: markdown
content: >-
<center>📄 <strong>Log Size</strong>: {{
states("sensor.home_assistant_log_taille") }} MB</center>
card_mod:
style: |
:host {
--card-mod-icon-color: rgb(68, 115, 158);
}
ha-card {
top: -15px;
margin-bottom: -25px;
}
- type: markdown
content: >-
<center>📄 <strong>DB Size</strong>: {{
(states('sensor.home_assistant_v2_db_taille') | float(0) / 1.049) |
round(2) }} MB</center>
card_mod:
style: |
:host {
--card-mod-icon-color: rgb(68, 115, 158);
}
ha-card {
top: -15px;
margin-bottom: -25px;
}
- type: custom:text-divider-row
text: MODULES
align: center
- type: grid
square: true
columns: 4
cards:
- type: custom:button-card
entity: update.onedrive_backup_update
template: addon-states
name: 1Drive
variables:
var_cpu: sensor.onedrive_backup_cpu_percent
var_ram: sensor.onedrive_backup_memory_percent
var_run: binary_sensor.onedrive_backup_running
- type: custom:button-card
entity: update.glances_update
name: Glances
template: addon-states
variables:
var_cpu: sensor.glances_pourcentage_du_processeur
var_ram: sensor.glances_pourcentage_de_memoire
var_run: binary_sensor.glances_en_cours_d_execution
- type: custom:button-card
entity: update.zigstar_silicon_labs_fw_flasher_update
name: ZigStart
template: addon-states
variables:
var_cpu: sensor.zigstar_silicon_labs_fw_flasher_pourcentage_du_processeur
var_ram: sensor.zigstar_silicon_labs_fw_flasher_pourcentage_de_memoire
var_run: binary_sensor.zigstar_silicon_labs_fw_flasher_en_cours_d_execution
- type: custom:button-card
entity: update.studio_code_server_update
name: VS Studio
template: addon-states
variables:
var_cpu: sensor.studio_code_server_cpu_percent
var_ram: sensor.studio_code_server_memory_percent
var_run: binary_sensor.studio_code_server_running
- type: custom:button-card
entity: update.influxdb_update
name: InfluxDB
template: addon-states
variables:
var_cpu: sensor.influxdb_cpu_percent
var_ram: sensor.influxdb_memory_percent
var_run: binary_sensor.influxdb_running
- type: custom:button-card
entity: update.pigpio_update
name: Pigpio
template: addon-states
variables:
var_cpu: sensor.pigpio_pourcentage_du_processeur
var_ram: sensor.pigpio_pourcentage_de_memoire
var_run: binary_sensor.pigpio_en_cours_d_execution
- type: custom:button-card
entity: update.samba_share_update
name: Samba Share
template: addon-states
variables:
var_cpu: sensor.samba_share_cpu_percent
var_ram: sensor.samba_share_memory_percent
var_run: binary_sensor.samba_share_running
- type: custom:button-card
entity: update.ssh_web_terminal_update
name: Terminal SSH
template: addon-states
variables:
var_cpu: sensor.ssh_web_terminal_cpu_percent
var_ram: sensor.ssh_web_terminal_memory_percent
var_run: binary_sensor.ssh_web_terminal_running
- type: custom:button-card
entity: update.mosquitto_broker_update
name: Mosquitto
template: addon-states
variables:
var_cpu: sensor.mosquitto_broker_cpu_percent
var_ram: sensor.mosquitto_broker_memory_percent
var_run: binary_sensor.mosquitto_broker_running
- type: custom:button-card
entity: update.zigbee2mqtt_update
name: Zigbee2MQTT
template: addon-states
variables:
var_cpu: sensor.zigbee2mqtt_cpu_percent
var_ram: sensor.zigbee2mqtt_memory_percent
var_run: binary_sensor.zigbee2mqtt_running
- type: custom:button-card
entity: update.nginx_proxy_manager_update
name: NGinx Proxy
template: addon-states
variables:
var_cpu: sensor.nginx_proxy_manager_cpu_percent
var_ram: sensor.nginx_proxy_manager_memory_percent
var_run: binary_sensor.nginx_proxy_manager_running
- type: custom:button-card
entity: update.myelectricaldata_update
name: MyElectricalData
template: addon-states
variables:
var_cpu: sensor.myelectricaldata_cpu_percent
var_ram: sensor.myelectricaldata_memory_percent
var_run: binary_sensor.myelectricaldata_running
card_mod:
style: |
ha-card {
--text-divider-color: rgb(68, 115, 158);
--text-divider-line-size: 1px;
--text-divider-font-size: 15px;
box-shadow: 0 0 0 1px gray;
}
Si un module est arrêté, le fond passe en rouge. C’est la partie module qui utilise le template pour le moment, il faut que je fasse la mm chose pour la partie HA mais là le week-end est finit ^^