Skip to content

Annotation for min and max in a specific timeframe #309

Answered by dbuezas
marce14-git asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Marce,
I don't see any simple way of doing this without using custom functions.
If you want to style the annotations, take a look at these:

type: custom:plotly-graph
hours_to_show: 12

entities:
  - entity: sensor.openweathermap_temperature
    fn: |- # put this one at the end of the entity
      $ex {
        let max = {y: -Infinity};
        let min = {y: +Infinity};
        for (let i = 0; i < ys.length; i++){
          const x = xs[i];
          const y = parseFloat(ys[i]);
          if (y > max.y) max = {x, y};
          if (y < min.y) min = {x, y};

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@marce14-git
Comment options

@jopkoene
Comment options

@dbuezas
Comment options

Answer selected by dbuezas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants