Skip to content

Commit

Permalink
Override icon with an image URL
Browse files Browse the repository at this point in the history
added image attribute to override icon with a URL.
  • Loading branch information
jampez77 committed Apr 14, 2022
1 parent 4aa28fc commit dc8aa92
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ We recommend looking at the [Example usage section](#example-usage) to understan
| type ***(required)*** | string | | v0.0.1 | `custom:mini-graph-card`.
| entities ***(required)*** | list | | v0.2.0 | One or more sensor entities in a list, see [entities object](#entities-object) for additional entity options.
| icon | string | | v0.0.1 | Set a custom icon from any of the available mdi icons.
| icon_image | string | optional | v0.11.0 | Override icon with an image url
| name | string | | v0.0.1 | Set a custom name which is displayed beside the icon.
| unit | string | | v0.0.1 | Set a custom unit of measurement.
| tap_action | [action object](#action-object-options) | | v0.7.0 | Action on click/tap.
Expand Down
7 changes: 7 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,13 @@ class MiniGraphCard extends LitElement {
}

renderIcon() {

if (this.config.icon_image != undefined){
return html` <div class="entity__icon">
<img src="${this.config.icon_image}" height=25/>
</div>`;
}

const { icon, icon_adaptive_color } = this.config.show;
return icon ? html`
<div class="icon" loc=${this.config.align_icon}
Expand Down

0 comments on commit dc8aa92

Please sign in to comment.