Skip to content

Commit

Permalink
Support any string value as secondary_info (closes #51)
Browse files Browse the repository at this point in the history
  • Loading branch information
benct committed Mar 7, 2020
1 parent 00021a2 commit 10087ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ attribute value instead of the state value. `icon` lets you display an icon inst

### Secondary Info

The `secondary_info` field can either be the string `last-changed` or an object containing the following configuration:
The `secondary_info` field can either be *any string* if you just want to display some text,
the string `last-changed` if you want to display the entity's last changed time,
or an object containing the following configuration:

| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
Expand Down
5 changes: 4 additions & 1 deletion multiple-entity-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@
toggle: this.checkToggle(this._config, mainStateObj),

entities: this._config.entities ? this._config.entities.map(entity => this.initEntity(entity, mainStateObj)) : [],
info: this.lastChanged ? null : this.initEntity(this._config.secondary_info, mainStateObj),
info: this.lastChanged ? null :
typeof this._config.secondary_info === 'string'
? {value: this._config.secondary_info}
: this.initEntity(this._config.secondary_info, mainStateObj),
}
}
}
Expand Down

0 comments on commit 10087ec

Please sign in to comment.