Skip to content

Commit

Permalink
update doc-ref, bumb version for release 0.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
daringer committed Apr 20, 2022
1 parent d352468 commit 41291f7
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/config-ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,18 @@ definition. Apart from `sort_by` no other option requires referencing of this id
| `prefix` | string | optional | to be applied _before_ all cell contents
| `suffix` | string | optional | to be appended _after_ all cell contents
| `multi_delimiter` | string | optional | defaults to ' ', concat multiple selector-data using this string
| `fmt` | string | optional | format using predefined 'formatters'

<!--|&nbsp;&lt;content&gt; | | **required** | see in `column contents` below, one of those must exist! -->

*Use `modify` with _caution_ and on your own risk only. This will directly execute code using `eval()`, which is by definition a safety risk. Especially avoid processing any third party APIs / contents with `flex-table-card` using the `modify` parameter, *only apply this parameter, if you are 100% sure about the contents and origin of the data.*
Apart from that `modify` is very powerful, see [advanced cell formatting](https://github.com/custom-cards/flex-table-card/blob/master/docs/example-cfg-advanced-cell-formatting.md).


Currently the available formatters are: `full_datetime`, `hours_passed`, `hours_mins_passed`, `number`. Feel free to contribute, just share your best `modify` line to allow others to use them, too.





[Return to main README.md](../README.md)
59 changes: 59 additions & 0 deletions docs/example-cfg-advanced-cell-formatting.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
## Examples - Advanced Cell Content Formatting & Modification

Om top of the in following described method there is also now the option
to choose from predefined format styles for each cell in a column. This
is simply done by addin the `fmt` property to your column and choosing
one of the available formatters. As of now there are not many, but as
these are essentially hidden `modify:` scripts I have some hopes that people
will share their coolest formattings - making it available to everyone
through `flex-table-card` .

``` yaml
type: custom:flex-table-card
title: Battery Levels (Top 10)
clickable: true
max_rows: 30
sort_by: state+
entities:
include: sensor.*_battery_level(_[0-9]+)?
columns:
- data: name
name: NodeID
- name: Battery Level (%)
data: state
fmt: number
suffix: '%'
align: right
- data: last_updated
name: Hours Passed
fmt: hours_passed


# make every cell/row 'clickable': show entity-popup for more entity details
clickable: true

entities:
exclude:
- zwave.unknown_device_*
- zstick_gen5
include: zwave.*

columns:
# 1st + 2nd column are <NodeID> + <NodeName>, remember to set 'name' for a
# human-readable / fancy header content
- name: NodeID
data: node_id
- name: Name
data: name

# 'receivedTS' and 'sentTS' are strings like: '2020-12-24 00:40:57:758'
# using 'modify' and a JavaScript expression the strings can be converted to
# hours using 'Date.parse' and friends
- data: receivedTS
modify: Math.round((Date.now() - Date.parse(x)) / 36000.) / 100.
name: Recv. Age (h)
- data: sentTS
modify: Math.round((Date.now() - Date.parse(x)) / 36000.) / 100.
name: Sent Age (h)
```
**Monitoring and identifying nodes, which are not communicating anymore** with
the Z-Wave controller, can be extracted and also sorted according to their last
sent/received message with the following config:
Expand Down

0 comments on commit 41291f7

Please sign in to comment.