thomasloven / lovelace-auto-entities

🔹Automatically populate the entities-list of lovelace cards
MIT License
1.2k stars 111 forks source link

Multiple card_param fields #328

Open brechtvhb opened 1 year ago

brechtvhb commented 1 year ago

Is it possible to set multiple card param fields?

I am using auto entities together with config-template-card to dynamically render a list of my smart sockets. Somehow I would need to be able to define 2 card_param fields. Right now it is set to variables, but I would also need it to render for entities how can I get around this?

type: custom:auto-entities
show_empty: false
card_param: variables
card:
  type: custom:config-template-card
  entities:
    - entity: sensor.socket_wireless_power_watt
    - entity: sensor.socket_christmass_tree_power
  element:
    type: custom:bar-card
    entities: >-
      ${vars.filter(v => states[v.entity].state > 5).sort((v1,v2) =>
      states[v2.entity].state-states[v1.entity].state)}
    direction: right
    entity_row: true
    min: 0
    max: ${ Math.max(...vars.map(v => states[v.entity].state))}
    height: 25px
    stack: vertical
    decimal: 2
    positions:
      icon: 'off'
      indicator: outside
      name: inside
      value: inside
    severity:
      - color: '#a1a1a18a'
        from: 0
        to: 2
      - color: '#3ea8328a'
        from: 2
        to: 10
      - color: '#85a8328a'
        from: 10
        to: 50
      - color: '#a8a4328a'
        from: 50
        to: 200
      - color: '#a887328a'
        from: 200
        to: 500
      - color: '#a867328a'
        from: 500
        to: 1000
      - color: '#a846328a'
        from: 1000
        to: 3000
      - color: '#a832328a'
        from: 3000
        to: 10000
    style: "#states > * {\n  margin: 5px 0;\n}\nbar-card-name,\nbar-card-value {\n  \n  color: #ffffff;\n  }\nbar-card-value\t{\n  font-weight: bold;\n}\nbar-card-indicator {\n  margin-top: 4px;\n  transform: scaleY(-1);\n}"
filter:
  include:
    - entity_id: sensor.socket_*_power*
  exclude:
    - entity_id: sensor.*_kilowatt