Skip to content

Commit

Permalink
Merge pull request #53 from PavelD/master
Browse files Browse the repository at this point in the history
Enable card in hass
  • Loading branch information
iantrich committed Jan 20, 2023
2 parents 3cfc8e8 + c1976fe commit 530534f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions hacs.json
@@ -0,0 +1,5 @@
{
"name": "List Card",
"render_readme": true,
"filename": "list-card.js"
}
12 changes: 11 additions & 1 deletion list-card.js
@@ -1,3 +1,5 @@
console.log(`%clist-card\n%cVersion: ${'0.0.1'}`, 'color: rebeccapurple; font-weight: bold;', '');

class ListCard extends HTMLElement {

constructor() {
Expand Down Expand Up @@ -172,7 +174,7 @@ class ListCard extends HTMLElement {
let newText = feed[entry][columns[column].field];

if (columns[column].hasOwnProperty('regex')) {
newText = new RegExp(columns[column].regex).exec(feed[entry][columns[column].field]);
newText = new RegExp(columns[column].regex, 'u').exec(feed[entry][columns[column].field]);
}
if (columns[column].hasOwnProperty('prefix')) {
newText = columns[column].prefix + newText;
Expand Down Expand Up @@ -215,3 +217,11 @@ class ListCard extends HTMLElement {
}

customElements.define('list-card', ListCard);

window.customCards = window.customCards || [];
window.customCards.push({
type: "list-card",
name: "List Card",
preview: false,
description: "The List Card generate table with data from sensor that provides data as a list of attributes."
});

0 comments on commit 530534f

Please sign in to comment.