kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
2.85k stars 231 forks source link

show_points: false #1083

Open dusan-ivanco opened 4 months ago

dusan-ivanco commented 4 months ago

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)
ildar170975 commented 4 months ago

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.

dusan-ivanco commented 4 months ago

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 commented 4 months ago

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

akloeckner commented 3 months ago

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