Skip to content

Commit

Permalink
Merge pull request #241 from kamtschatka/master
Browse files Browse the repository at this point in the history
Allow Default values for entities/allow still creating the row element #191
  • Loading branch information
benct authored May 30, 2023
2 parents 0cfc0a3 + 540edc9 commit 872354d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ attribute value instead of the state value. `icon` lets you display an icon inst
| toggle | bool | `false` | Display a toggle if supported by domain |
| icon | string/bool | `false` | Display default or custom icon instead of state or attribute value |
| state_color | bool | `false` | Enable colored icon when entity is active |
| default | string | | Display this value if the entity does not exist or should not be shown |
| hide_unavailable | bool | `false` | Hide entity if unavailable or not found |
| hide_if | object/any | _[Hiding](#hiding)_ | Hide entity if its value matches specified value or criteria |
| styles | object | | Add custom CSS styles to the entity element |
Expand Down
6 changes: 6 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ class MultipleEntityRow extends LitElement {

renderEntity(stateObj, config) {
if (!stateObj || hideIf(stateObj, config)) {
if (config.default) {
return html`<div class="entity" style="${entityStyles(config)}">
<span>${config.name}</span>
<div>${config.default}</div>
</div>`;
}
return null;
}
const onClick = this.clickHandler(stateObj.entity_id, config.tap_action);
Expand Down

0 comments on commit 872354d

Please sign in to comment.