dbuezas/lovelace-plotly-graph-card

Can't plot certain measurements with statistics enabled

andrzej-r opened this issue · 0 comments

I was happily using the plotly card for plotting power entities with statistics enabled. Then, I tried doing the same with other measurements (kWh, %, temperature etc) and I found they were not plotted at all. When I disabled statistics for that waveform it got plotted just fine. Any ideas what may be getting wrong or how to debug it? I do not see any error messages.

The code is a bit complicated but for the sake of completeness. The entity that is not plotted (unless I comment out statistic: section) is "SoC" - state of charge of battery in percents. I can see "SoC" showing up in the legend and the unit of axis y2 is changed to "%".

type: custom:plotly-graph
title: Battery
layout:
  hovermode: x unified
  height: 541
  margin:
    t: 50
  xaxis:
    rangeselector:
      'y': 1.1
      buttons:
        - count: 3
          step: hour
        - count: 12
          step: hour
        - count: 1
          step: day
        - count: 3
          step: day
        - count: 7
          step: day
        - count: 1
          step: month
        - count: 1
          step: year
  yaxis:
    fixedrange: true
    nticks: 11
    zeroline: false
    showgrid: true
    range:
      - -5000
      - 5000
  yaxis2:
    fixedrange: true
    nticks: 11
    zeroline: false
    showgrid: false
    range:
      - 0
      - 100
defaults:
  entity:
    line:
      width: 1
      shape: line
    statistic: mean
    period:
      0m: 5minute
      36h: hour
      10d: day
entities:
  - entity: sensor.solar_to_battery
    name: from solar
    yaxis: y1
    stackgroup: charge
  - entity: sensor.ac_charge_power
    name: from grid
    yaxis: y1
    stackgroup: charge
  - entity: sensor.discharge_power
    name: to grid
    yaxis: y1
    stackgroup: discharge
  - entity: sensor.soc
    name: SoC
    yaxis: y2
hours_to_show: 24