Skip to content

Instantly share code, notes, and snippets.

@mathieucarbou
Created November 14, 2023 11:03
Show Gist options
  • Save mathieucarbou/49b1b3fff963f0d6c8e0ae98edcfdccb to your computer and use it in GitHub Desktop.
Save mathieucarbou/49b1b3fff963f0d6c8e0ae98edcfdccb to your computer and use it in GitHub Desktop.
Example: config-template-card + bar-card

Example: config-template-card + bar-card

Screenshot 2023-11-14 at 11 58 22

type: custom:config-template-card
variables:
  - entity: sensor.deshumidificateur_chambre_power
    name: Déshumidificateur chambre
  - entity: sensor.deshumidificateur_etage_power
    name: Déshumidificateur étage
  - entity: sensor.deshumidificateur_salon_power
    name: Déshumidificateur salon
  - entity: sensor.lampadaire_salon_power
    name: Lampadaire
  - entity: sensor.sapin_noel_power
    name: Sapin
  - entity: sensor.dry_cabinets_power
    name: Dry cabinets
  - entity: sensor.lave_vaisselle_power
    name: Lave-vaisselle
  - entity: sensor.four_power
    name: Four
  - entity: sensor.circuit_climatisation_power
    name: Climatisation
  - entity: sensor.chauffage_power
    name: Chauffage
  - entity: sensor.circuit_lumieres_power
    name: Lumières
  - entity: sensor.laveuse_fagor_power
    name: Laveuse Fagor
  - entity: sensor.laveuse_proline_power
    name: Laveuse Proline
  - entity: sensor.secheuse_power
    name: Sécheuse
  - entity: sensor.cameras_garage_power
    name: Caméras garage
  - entity: sensor.openevse_power
    name: Chargeur Zoé
  - entity: sensor.robot_tondeuse_power
    name: Robot tondeuse
  - entity: sensor.frigo_power
    name: Frigo
  - entity: sensor.prise_bureau_imprimante_power
    name: Prise bureau (imprimante)
  - entity: sensor.prise_bureau_ordis_power
    name: Prise bureau (ordis)
  - entity: sensor.prise_chambre_imprimante_power
    name: Prise chambre (imprimante)
  - entity: sensor.prise_chambre_ordis_power
    name: Prise chambre (ordis)
  - entity: sensor.prise_chambre_tv_power
    name: Prise chambre (TV)
  - entity: sensor.prise_salon_tv_power
    name: Prise salon (TV)
  - entity: sensor.prise_cuisine_cave_a_vin_power
    name: Prise cuisine (cave à vin)
  - entity: sensor.prise_salon_ordis_power
    name: Prise salon (ordis)
  - entity: sensor.fossibot_f3600_power
    name: Fossibot F3600
entities:
  - sensor.deshumidificateur_chambre_power
  - sensor.deshumidificateur_etage_power
  - sensor.deshumidificateur_salon_power
  - sensor.lampadaire_salon_power
  - sensor.sapin_noel_power
  - sensor.dry_cabinets_power
  - sensor.lave_vaisselle_power
  - sensor.four_power
  - sensor.circuit_climatisation_power
  - sensor.chauffage_power
  - sensor.circuit_lumieres_power
  - sensor.laveuse_fagor_power
  - sensor.laveuse_proline_power
  - sensor.secheuse_power
  - sensor.cameras_garage_power
  - sensor.openevse_power
  - sensor.robot_tondeuse_power
  - sensor.frigo_power
  - sensor.prise_bureau_imprimante_power
  - sensor.prise_bureau_ordis_power
  - sensor.prise_chambre_imprimante_power
  - sensor.prise_chambre_ordis_power
  - sensor.prise_chambre_tv_power
  - sensor.prise_salon_tv_power
  - sensor.prise_cuisine_cave_a_vin_power
  - sensor.prise_salon_ordis_power
  - sensor.fossibot_f3600_power
element:
  type: custom:bar-card
  entities: >-
    ${vars.filter(v => states[v.entity] && states[v.entity].state &&
    states[v.entity].state >= 1).sort((v1,v2) =>
    states[v2.entity].state-states[v1.entity].state)}
  direction: right
  entity_row: false
  min: 0
  max: >-
    ${ Math.max(...vars.map(v => states[v.entity].state).filter(v => v !=
    'unavailable'))}
  height: 20px
  stack: vertical
  decimal: 0
  icon: mdi:flash
  positions:
    icon: 'off'
    indicator: outside
    name: inside
    value: inside
  severity:
    - color: '#a1a1a1a8'
      from: 0
      to: 2
    - color: '#3ea832a8'
      from: 2
      to: 10
    - color: '#85a832a8'
      from: 10
      to: 50
    - color: '#a8a432a8'
      from: 50
      to: 200
    - color: '#a88732a8'
      from: 200
      to: 500
    - color: '#a86732a8'
      from: 500
      to: 1000
    - color: '#a84632a8'
      from: 1000
      to: 3000
    - color: '#a83232a8'
      from: 3000
      to: 10000
  style: |
    #states > * {
      margin: 1px;
    }
    bar-card-name, bar-card-value {
      font-size: 0.9rem;
      color: #ffffffaa;
      font-weight: bold;
    }
    bar-card-value {
      font-weight: bolder;
    }
    bar-card-indicator {
      margin-top: 4px;
      transform: scaleY(-1);
    }
@patmtp35
Copy link

hi,
one more time thanks for you're share.
my question is how could you have the rounded corner. i'm trying to use radius but seems it dosen t work

@mathieucarbou
Copy link
Author

hi, one more time thanks for you're share. my question is how could you have the rounded corner. i'm trying to use radius but seems it dosen t work

Hi,
Thanks!
I didn't do anything for that... Here is my current yaml code:

element:
  type: custom:bar-card
  entities: >-
    ${vars.filter(v => states[v.entity] && states[v.entity].state &&
    states[v.entity].state >= 1).sort((v1,v2) =>
    states[v2.entity].state-states[v1.entity].state)}
  direction: right
  entity_row: false
  min: 0
  max: >-
    ${ Math.max(...vars.map(v => states[v.entity].state).filter(v => v !=
    'unavailable'))}
  height: 20px
  stack: vertical
  decimal: 0
  icon: mdi:flash
  positions:
    icon: 'off'
    indicator: outside
    name: inside
    value: inside
  severity:
    - color: '#a1a1a1a8'
      from: 0
      to: 2
    - color: '#3ea832a8'
      from: 2
      to: 10
    - color: '#85a832a8'
      from: 10
      to: 50
    - color: '#a8a432a8'
      from: 50
      to: 200
    - color: '#a88732a8'
      from: 200
      to: 500
    - color: '#a86732a8'
      from: 500
      to: 1000
    - color: '#a84632a8'
      from: 1000
      to: 3000
    - color: '#a83232a8'
      from: 3000
      to: 10000
  style: |
    #states > * {
      margin: 1px;
    }
    bar-card-name, bar-card-value {
      font-size: 0.9rem;
      color: #ffffffaa;
      font-weight: bold;
    }
    bar-card-value {
      font-weight: bolder;
    }
    bar-card-indicator {
      margin-top: 4px;
      transform: scaleY(-1);
    }

I am wondering if this is because I am using some attributes (like entity_row false) that are letting the current theme I am using render the card ? The theme I am using is "Caule Black Orange"

@patmtp35
Copy link

patmtp35 commented Apr 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment