mini-graph-card icon indicating copy to clipboard operation
mini-graph-card copied to clipboard

show_points: false

Open dusan-ivanco opened this issue 1 year ago • 4 comments

show_points: false make exception

          - type: custom:mini-graph-card
            name: Teplota
            icon: mdi:thermometer
            aggregate_func: median
            points_per_hour: 1
            hours_to_show: 12
            line_width: 5
            decimals: 1
            smoothing: true
            hour24: true
            show:
              state: last
              points: false
            tap_action:
              action: none
            entities:
              - entity: sensor.temperature
                name: Priemer
              - entity: sensor.thermo_room_1_temperature
              - entity: sensor.thermo_room_2_temperature
              - entity: sensor.thermo_room_3_temperature
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length')
    at Kd.getEntityState (graph-card.js?v=0.12.0:1:100443)
    at Kd.renderState (graph-card.js?v=0.12.0:1:100638)
    at Kd.renderStates (graph-card.js?v=0.12.0:1:100127)
    at Kd.render (graph-card.js?v=0.12.0:1:99132)
    at Kd.update (graph-card.js?v=0.12.0:1:49160)
    at Kd.performUpdate (graph-card.js?v=0.12.0:1:46377)
    at graph-card.js?v=0.12.0:1:46037
    at Generator.throw (<anonymous>)
    at R (graph-card.js?v=0.12.0:1:17743)
    at g (graph-card.js?v=0.12.0:1:17962)

dusan-ivanco avatar Feb 23 '24 05:02 dusan-ivanco

Show a screenshot with a card in the native HA editor and with this error.

Also, the error which you posted contains a "graph-card.js" filename - but the card's filename is "mini-graph-card-bundle.js". Are you sure that the error is related? Have you manually edited the original js-file?

Update: managed to reproduce it with a simple config:

type: custom:mini-graph-card
show:
  state: last
entities:
  - entity: sensor.xiaomi_cg_1_temperature
  - entity: sensor.xiaomi_cg_2_temperature
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length')
    at Kd.getEntityState (mini-graph-card-bundle.js?hacstag=1512800620120:1:100443)
    at Kd.renderState (mini-graph-card-bundle.js?hacstag=1512800620120:1:100638)
    at Kd.renderStates (mini-graph-card-bundle.js?hacstag=1512800620120:1:100127)
    at Kd.render (mini-graph-card-bundle.js?hacstag=1512800620120:1:99132)
    at Kd.update (mini-graph-card-bundle.js?hacstag=1512800620120:1:49160)
    at Kd.performUpdate (mini-graph-card-bundle.js?hacstag=1512800620120:1:46377)
    at mini-graph-card-bundle.js?hacstag=1512800620120:1:46037
    at Generator.next (<anonymous>)
    at R (mini-graph-card-bundle.js?hacstag=1512800620120:1:17743)
    at f (mini-graph-card-bundle.js?hacstag=1512800620120:1:17926)

and it is rather erratic.

In fact, it seems to be about state: last. Suggest to retest with a simplified code & then rename the issue to reflect a possible cause.

ildar170975 avatar Feb 23 '24 10:02 ildar170975

works: Snímka obrazovky 2024-02-29 o 13 28 24 Snímka obrazovky 2024-02-29 o 13 30 50

not: Snímka obrazovky 2024-02-29 o 13 33 39 Snímka obrazovky 2024-02-29 o 13 31 26

Yes, I renamed the js file.

dusan-ivanco avatar Feb 29 '24 12:02 dusan-ivanco

yes, option "points: false" is in conflict with "state: last"

dusan-ivanco avatar Feb 29 '24 12:02 dusan-ivanco

It might be addressed by this PR: https://github.com/kalkih/mini-graph-card/pull/1075 ?

akloeckner avatar Mar 13 '24 21:03 akloeckner