kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
2.96k stars 232 forks source link

[FEATURE REQUEST] use offset in lower/upper bound #888

Open shift-del1 opened 1 year ago

shift-del1 commented 1 year ago

Can you please add the option to have an offset in variable lower_bound or upper_bound? Sometimes the graph is too close to the border of the button, so I would like to shift it a bit. Defining a constant value (like 22.4 (%)) is not ok, as the humidity can vary in a huge range which could flatten the graph too much (like this happened in this case):

image

Using a string like: lower_bound: "[[[ return states['sensor.kitchen_humidity_min_over_last_24_hours'].state - 2.5 ]]]" could help, but defining a statistical sensor for all the rooms and measured values is very painful. So from this:

image

I would like to go to something like this:

image

With a value formatted like ˇ2.5 (example prefix; take the min value of the used period (52.2)and lower it by 2.5) it could be achieved. Thank you.

ildar170975 commented 7 months ago

Have you tested a min_bound_range option? It may help you to achieve your goal.

shift-del1 commented 7 months ago

Have you tested a min_bound_range option? It may help you to achieve your goal.

Yes, but in this case I have to maintain a min value for everything if I want to use that value for the offset. For example: my kitchen temperature varies between 20 and 22 degrees for the last 24 hours, I need to take the min value and considering 3 degrees offset, I need to set the min_bound_range to "min(kitchen temperature) - offset" (so min(20...22) - 3 = 17). Having the offset option would simplify things of creating tens of new statistical sensors. Or do you have a better idea? Thanks in advance.

ildar170975 commented 7 months ago
  1. Have you tried to NOT specify lower_bound? Then the graph will use min & max values.
  2. If you really need a proposed functionality - I would suggest you to prepare a complete algorithm for this functionality. Nobody will do it except you). The algorithm should be as detailed as possible. Also, please read this.