Skip to content

Comments

fix: getEntityState() for "last" & "bar"#1322

Open
ildar170975 wants to merge 1 commit intokalkih:devfrom
ildar170975:bar-last
Open

fix: getEntityState() for "last" & "bar"#1322
ildar170975 wants to merge 1 commit intokalkih:devfrom
ildar170975:bar-last

Conversation

@ildar170975
Copy link
Collaborator

@ildar170975 ildar170975 commented Dec 12, 2025

Currently using "last" & "bar" causes a card to be not rendered due to an error.

type: custom:mini-graph-card
entities:
  - entity: sensor.system_monitor_processor_use
show:
  state: last
  graph: bar
image

It happens because "this.points" is not defined if graph type = "bar".

After the fix:
image

@ildar170975
Copy link
Collaborator Author

ildar170975 commented Dec 12, 2025

So we have 3 PRs to fix the same problem:

  1. fix: always get points so state last works with other graphs #1075 - "always define points".
  2. fix: state: last to use value from last Graph coordinate #1308 - "use coords"
  3. this one - "ether use points or bars".

Currently "points" & "bars" already have properly (I hope so) defined values.
So why not using these data instead?

Imho:

  1. Calculating "points" in case of bars is too "artificial".
  2. Using "coords" in "main()" is too "low level" because "coords" are inside a Graph object, I do not think we are supposed to use them directly in "main()".

@ildar170975 ildar170975 marked this pull request as ready for review December 12, 2025 05:12
@akloeckner akloeckner changed the base branch from master to dev December 14, 2025 07:48
@akloeckner
Copy link
Collaborator

Imho:

On the conceptual level, I'd agree. I'm wondering: will this fix also work, if show.points is false? (I think, that is a valid option, right?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

State last fails to render card bug: state: last and graph: bar breaks graph rendering

2 participants