Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 540edc9

Browse files
committed
Allow Default values for entities/allow still creating the row element #191
Added the possibility to show a default value in the UI if the entity does not exist or should not be shown updated the README.MD to describe the default parameter
1 parent e2d2508 commit 540edc9

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ attribute value instead of the state value. `icon` lets you display an icon inst
8080
| toggle | bool | `false` | Display a toggle if supported by domain |
8181
| icon | string/bool | `false` | Display default or custom icon instead of state or attribute value |
8282
| state_color | bool | `false` | Enable colored icon when entity is active |
83+
| default | string | | Display this value if the entity does not exist or should not be shown |
8384
| hide_unavailable | bool | `false` | Hide entity if unavailable or not found |
8485
| hide_if | object/any | _[Hiding](#hiding)_ | Hide entity if its value matches specified value or criteria |
8586
| styles | object | | Add custom CSS styles to the entity element |

‎src/index.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ class MultipleEntityRow extends LitElement {
107107

108108
renderEntity(stateObj, config) {
109109
if (!stateObj || hideIf(stateObj, config)) {
110+
if (config.default) {
111+
return html`<div class="entity" style="${entityStyles(config)}">
112+
<span>${config.name}</span>
113+
<div>${config.default}</div>
114+
</div>`;
115+
}
110116
return null;
111117
}
112118
const onClick = this.clickHandler(stateObj.entity_id, config.tap_action);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /