github kalkih/mini-graph-card v0.14.0-dev.4

pre-releaseone hour ago

WARNING

This is a pre-release, some functionality might be changed in the final "normal" release (like a name of an option, behaviour of a feature).
Please test, report bugs, provide observations.

What's Changed

features:

fixes:

docs:

New Contributors

Full Changelog: v0.14.0-dev.3...v0.14.0-dev.4


More detailed about new features

"Overall" value - show an aggregated value for a whole time period; either the same aggregation method is used which is defined for a card or per-entity, or another method (for instance, it is possible to use a "last" aggregation method for a graph and a "sum" method for the "overall" value; any aggregation method may be selected for the "overall" value).

image image

"group_by: 12h" variant is supported to group data by half-days (00:00 - 11:59, 12:00 - 23:59).

So, currently these methods are supported: interval, week, date, 12h, hour, 30min, 15min.


Refactored state_map; check a very brief description below:

  1. state_map option can be set not only globally, but also per-entity. This allows to implement the following use-case: one entity is numeric on a primary Y-axis, another entity is binary (on/off) on a secondary Y-axis with a per-entity state_map defined.
  2. state_map option can be set per-axis. This allows to implement the following use-case: one entity is numeric on a primary Y-axis, another few entities are binary (on/off) on a secondary Y-axis with a common per-axis state_map defined.
  3. New method of defining state_map - defining in "relaxed mode" (in addition to the currently present legacy "strict mode"): original values are NOT replaced in a history array (which is used to build a graph), a mapping is only used to replace a displayed label (1000 -> Danger).
  4. Different ways of "relaxed" mapping:
    a) Use an exact equality – only an exact 1000 value will be mapped:
- value: 1000
  label: Danger

b) Define a tolerance – all values in [950, 1050] range will be mapped (both bounds are "included"):

- value: 1000
  tolerance: 50
  label: Danger

c) Define a range – all values in [950, 1001) range will be mapped. Note that the right bound is open (not closed/included), that is why the 1001 value is used instead of 1000, then values less than 1001 will be mapped:

- min: 950
  max: 1001
  label: Danger

Using the “range” way, it is possible to cover all possible values like:

map:
  - min: 0
    max: 500.99
    label: Normal
  - min: 501
    max: 800.99
    label: Warning
  - min: 801
    max: 1001
    label: Danger
  1. It is possible to define a templated structure of a label option: instead of defining a simple Danger value, set a label: Danger [${min} .. ${max}) template which will generate a Danger [801 .. 1001) text (here raw, value, tolerance, min & max can be used as tokens; raw stands for a matched value & is presented as any other "normal" value, i.e. properly formatted & applied with a possible "value_factor"). Might be easier than repeating same text when defining a label. Note that in the "strict mode", only value token can be used.
  2. It is possible to define a common label for all mappings – and using the new templated structure is a way to simplify a code: define a global label: ${raw} [${min} .. ${max}), then a particular label will be calculated in the same way for each mapping in a runtime (when it is needed to show a state value):
state_map:
  map: ... array of mappings
  keep_values: true
  label: ${raw} [${min} .. ${max})
  1. To clean up a presentation, it is possible to hide a unit for a converted value to prevent cases like Danger %. The hide_unit option can be defined both for a particular mapping or for all mappings (like it is shown for the label option in pt. 8 above).

Gaps for missing data - show periods where an entity’s state was unavailable (for attributes – where an attribute does not exist, "disappears") as gaps:

image image

Also, when a "strict" state_map config is defined & no mapping is found for a particular value – then this case is also treated as an "invalid value" causing displaying a gap.


New cubic bezier smoothing - gives a more accurate "smoothed" representation where extremums are located on real points.

Compare the smoothing: false, smoothing: true & the new smoothing: cubic variant:

image

Don't miss a new mini-graph-card release

NewReleases is sending notifications on new releases.